Update to valid json
برخی از چک ها خطاهایی را گزارش کردند
continuous-integration/drone/push Build was killed
برخی از چک ها خطاهایی را گزارش کردند
continuous-integration/drone/push Build was killed
This commit is contained in:
والد
0af5631568
کامیت
06f4593229
27
README.md
27
README.md
@ -1,3 +1,28 @@
|
|||||||
# TikTok Grabber
|
# TikTok Grabber
|
||||||
|
|
||||||
[](https://drone.f-brinker.de/fbrinker/docker-tiktok-grabber)
|
[](https://drone.f-brinker.de/fbrinker/docker-tiktok-grabber)
|
||||||
|
[](https://hub.docker.com/r/fbrinker/tiktok-grabber)
|
||||||
|
|
||||||
|
This is a very basic Docker container to get JSON responses from TikTok "API" calls.
|
||||||
|
I am using the tool [TikTok Signature](https://github.com/carcabot/tiktok-signature) inside the container.
|
||||||
|
|
||||||
|
### Contribute
|
||||||
|
|
||||||
|
You can open any new issues [here](https://git.f-brinker.de/fbrinker/docker-tiktok-grabber/issues). Have a look at the [Dockerfile](https://git.f-brinker.de/fbrinker/docker-tiktok-grabber).
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Basic Usage
|
||||||
|
Just add the TikTok API url (without the `&_signature=...` parameter) as a param and you will get the JSON response:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run --rm fbrinker/tiktok-grabber "https://m.tiktok.com/share/item/list?secUid=&id=&type=5&count=30&minCursor=0&maxCursor=0&shareUid="
|
||||||
|
```
|
||||||
|
|
||||||
|
### Usage with a Webhook
|
||||||
|
You can add a webhook as second parameter.
|
||||||
|
The grabber will send the JSON result to that url as `data` attribute in a POST request:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run --rm fbrinker/tiktok-grabber "https://m.tiktok.com/share/item/list?secUid=&id=&type=5&count=30&minCursor=0&maxCursor=0&shareUid=" "http://example.com/webhook.php"
|
||||||
|
```
|
9
grab.py
9
grab.py
@ -1,15 +1,16 @@
|
|||||||
|
import json
|
||||||
import requests
|
import requests
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
signature = sys.argv[2]
|
signature = sys.argv[2]
|
||||||
url = sys.argv[1] + "&_signature=" + signature
|
url = sys.argv[1] + "&_signature=" + signature
|
||||||
referer = "https://www.tiktok.com/@ondymikula/video/6757762109670477061"
|
|
||||||
|
|
||||||
request = requests.get(url, headers={
|
response = requests.get(url, headers={
|
||||||
"method": "GET",
|
"method": "GET",
|
||||||
"accept-encoding": "gzip, deflate, br",
|
"accept-encoding": "gzip, deflate, br",
|
||||||
"Referer": referer,
|
"Referer": "https://www.tiktok.com",
|
||||||
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36"
|
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36"
|
||||||
})
|
})
|
||||||
|
|
||||||
print(request.json())
|
data = json.loads(response.text)
|
||||||
|
print json.dumps(data)
|
بارگذاری…
مرجع در شماره جدید
Block a user