Skip to content

Commit 497e50f

Browse files
committed
first commit
0 parents  commit 497e50f

19 files changed

+552
-0
lines changed

.github/workflows/publish.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [ created ]
6+
7+
jobs:
8+
pypi-publish:
9+
name: Publish release to PyPI
10+
runs-on: ubuntu-latest
11+
environment:
12+
name: pypi
13+
url: https://pypi.org/p/scrapeless
14+
permissions:
15+
id-token: write
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: "3.x"
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install setuptools wheel
28+
29+
- name: Build package
30+
run: |
31+
python setup.py sdist bdist_wheel # Could also be python -m build
32+
33+
- name: Publish package distributions to PyPI
34+
uses: pypa/gh-action-pypi-publish@release/v1

.gitignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
*/**/__pycache__/*
2+
*/**/*.pyc
3+
*/**/*.pyo
4+
*/**/*.pyd
5+
*/**/*.pyw
6+
*/**/*.pyz
7+
*/**/*.pywz
8+
*/**/*.pyzw
9+
.vscode
10+
.idea

README.md

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Scrapeless Python SDK
2+
3+
## install
4+
```shell
5+
pip install scrapeless-sdk-python
6+
```
7+
8+
## Usage
9+
10+
Start using the API with your [API KEY](https://app.scrapeless.com/dashboard/account?tab=apiKey)
11+
12+
For more examples, please refer to the `examples` directory
13+
14+
For more information, please refer to our [documentation](https://docs.scrapeless.com/)
15+
16+
### Scraping API
17+
```python
18+
from scrapeless import ScrapelessClient
19+
20+
scrapeless = ScrapelessClient(api_key='your-api-key')
21+
22+
actor = "scraper.shopee"
23+
input_data = {
24+
"type": "shopee.product",
25+
"url": "https://shopee.tw/2312312.10228173.24803858474"
26+
}
27+
28+
result = scrapeless.scraper(actor, input=input_data)
29+
```
30+
31+
### Web Unlocker
32+
```python
33+
from scrapeless import ScrapelessClient
34+
35+
scrapeless = ScrapelessClient(api_key='your-api-key')
36+
37+
actor = 'unlocker.webunlocker'
38+
input_data = {
39+
"url": "https://www.scrapeless.com",
40+
"proxy_country": "ANY",
41+
"method": "GET",
42+
"redirect": false,
43+
}
44+
45+
result = scrapeless.unlocker(actor, input=input_data)
46+
```
47+
48+
### Captcha Solver
49+
```python
50+
from scrapeless import ScrapelessClient
51+
52+
scrapeless = ScrapelessClient(api_key='your-api-key')
53+
54+
actor = 'captcha.recaptcha'
55+
input_data = {
56+
"version": "v2",
57+
"pageURL": "https://www.google.com",
58+
"siteKey": "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-",
59+
"pageAction": ""
60+
}
61+
62+
result = scrapeless.captcha(actor, input=input_data)
63+
```
+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# if you want to run this example, you need to replace "your-api-key"
2+
# import sys
3+
# import os
4+
# sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../../")))
5+
6+
import time
7+
from scrapeless import ScrapelessClient
8+
9+
scrapeless = ScrapelessClient(api_key="your-api-key")
10+
11+
def solve_captcha():
12+
actor = "captcha.recaptcha.enterprise"
13+
input_data = {
14+
"version": "v3",
15+
"pageURL": "https://www.google.com",
16+
"siteKey": "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-",
17+
"pageAction": "scraping",
18+
"invisible": False
19+
}
20+
21+
result = scrapeless.captcha(actor, input=input_data)
22+
return result
23+
24+
def get_captcha_result(taskId):
25+
result = scrapeless.get_captcha_result(taskId)
26+
return result
27+
28+
def main():
29+
captcha_result = solve_captcha()
30+
taskId = captcha_result["taskId"]
31+
32+
while True:
33+
captcha_result = get_captcha_result(taskId)
34+
if captcha_result["success"] == True:
35+
print(captcha_result)
36+
break
37+
time.sleep(5)
38+
39+
main()

examples/captcha/recaptcha.py

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# you can run this example by executing `python examples/captcha/captcha.py` in the terminal
2+
# if you want to run this example, you need to replace "your-api-key"
3+
import sys
4+
import os
5+
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../../")))
6+
7+
import time
8+
from scrapeless import ScrapelessClient
9+
10+
scrapeless = ScrapelessClient(api_key="your-api-key")
11+
12+
def solve_captcha():
13+
actor = "captcha.recaptcha"
14+
input_data = {
15+
"version": "v2",
16+
"pageURL": "https://www.google.com",
17+
"siteKey": "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-",
18+
"pageAction": ""
19+
}
20+
21+
result = scrapeless.captcha(actor, input=input_data)
22+
return result
23+
24+
def get_captcha_result(taskId):
25+
result = scrapeless.get_captcha_result(taskId)
26+
return result
27+
28+
def main():
29+
captcha_result = solve_captcha()
30+
taskId = captcha_result["taskId"]
31+
32+
while True:
33+
captcha_result = get_captcha_result(taskId)
34+
if captcha_result["success"]:
35+
print(captcha_result)
36+
break
37+
time.sleep(5)
38+
39+
main()

examples/scraper/br-consopt.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# if you want to run this example, you need to replace "your-api-key"
2+
# import sys
3+
# import os
4+
# sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../../")))
5+
6+
from scrapeless import ScrapelessClient
7+
8+
scrapeless = ScrapelessClient(api_key="your-api-key")
9+
10+
def br_consopt():
11+
result = scrapeless.scraper(
12+
actor="scraper.consopt",
13+
input={
14+
"taxId": "25032537000164",
15+
},
16+
proxy={
17+
"country": "US",
18+
}
19+
)
20+
21+
print(result)
22+
23+
br_consopt()

examples/scraper/br-solucoes.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# if you want to run this example, you need to replace "your-api-key"
2+
# import sys
3+
# import os
4+
# sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../../")))
5+
6+
from scrapeless import ScrapelessClient
7+
8+
scrapeless = ScrapelessClient(api_key="your-api-key")
9+
10+
def br_solucoes():
11+
result = scrapeless.scraper(
12+
actor="scraper.solucoes",
13+
input={
14+
"taxId": "37.335.118/0001-80",
15+
},
16+
proxy={
17+
"country": "US",
18+
}
19+
)
20+
21+
print(result)
22+
23+
br_solucoes()

examples/scraper/iberia.py

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# if you want to run this example, you need to replace "your-api-key"
2+
# import sys
3+
# import os
4+
# sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../../")))
5+
6+
from scrapeless import ScrapelessClient
7+
8+
scrapeless = ScrapelessClient(api_key="your-api-key")
9+
10+
def iberia():
11+
result = scrapeless.scraper(
12+
actor="scraper.iberia",
13+
input={
14+
"proxy": "72.46.64.6:65173:ssxiqsom:VA8ji024fz",
15+
"username": "00000116280546",
16+
"password": "i72sV7CWbDZ+7",
17+
"body": "{\"slices\":[{\"origin\":\"NYC\",\"destination\":\"SHA\",\"date\":\"2024-11-03\"}],\"passengers\":[{\"passengerType\":\"ADULT\",\"count\":1}],\"marketCode\":\"US\",\"preferredCabin\":\"\"}"
18+
},
19+
proxy={
20+
"country": "US",
21+
}
22+
)
23+
24+
print(result)
25+
26+
iberia()

examples/scraper/shopee-live.py

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# if you want to run this example, you need to replace "your-api-key"
2+
# import sys
3+
# import os
4+
# sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../../")))
5+
6+
from scrapeless import ScrapelessClient
7+
8+
scrapeless = ScrapelessClient(api_key="your-api-key")
9+
10+
def shopee_live():
11+
result = scrapeless.scraper(
12+
actor="scraper.shopee",
13+
input={
14+
"type": "shopee.live",
15+
"url": "https://live.shopee.co.th/api/v1/session/13285347",
16+
}
17+
)
18+
19+
print(result)
20+
21+
shopee_live()

examples/unlocker/akamaiweb-cookie.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# if you want to run this example, you need to replace "your-api-key"
2+
# import sys
3+
# import os
4+
# sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../../")))
5+
6+
from scrapeless import ScrapelessClient
7+
8+
scrapeless = ScrapelessClient(api_key="your-api-key")
9+
10+
def web_unlocker():
11+
result = scrapeless.scraper(
12+
actor="unlocker.akamaiweb",
13+
input={
14+
"type": "cookie",
15+
"proxy_country": "ANY",
16+
"url": "https://www.iberia.com/",
17+
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36",
18+
}
19+
)
20+
21+
print(result)
22+
23+
web_unlocker()

examples/unlocker/akamaiweb-sensor.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# if you want to run this example, you need to replace "your-api-key"
2+
# import sys
3+
# import os
4+
# sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../../")))
5+
6+
from scrapeless import ScrapelessClient
7+
8+
scrapeless = ScrapelessClient(api_key="your-api-key")
9+
10+
def web_unlocker():
11+
result = scrapeless.scraper(
12+
actor="unlocker.akamaiweb",
13+
input={
14+
"abck": "xxxx",
15+
"bmsz": "xxxx",
16+
"url": "https://www.scrapeless.com",
17+
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
18+
}
19+
)
20+
21+
print(result)
22+
23+
web_unlocker()

examples/unlocker/webunlocker.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# if you want to run this example, you need to replace "your-api-key"
2+
# import sys
3+
# import os
4+
# sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../../")))
5+
6+
from scrapeless import ScrapelessClient
7+
8+
scrapeless = ScrapelessClient(api_key="your-api-key")
9+
10+
def web_unlocker():
11+
result = scrapeless.scraper(
12+
actor="unlocker.webunlocker",
13+
input={
14+
"url": "https://www.scrapeless.com",
15+
"proxy_country": "ANY",
16+
"method": "GET",
17+
"redirect": False,
18+
}
19+
)
20+
21+
print(result)
22+
23+
web_unlocker()

pyproject.toml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["setuptools", "wheel"]
3+
build-backend = "setuptools.build_meta"

scrapeless/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from scrapeless.client import ScrapelessClient
2+
3+
__all__ = ["ScrapelessClient"]

scrapeless/__version__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = '0.0.1'

0 commit comments

Comments
 (0)