-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtiklydown.py
38 lines (28 loc) · 1.12 KB
/
tiklydown.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import asyncio
import sqlite3
import sys
import aiofiles
import aiohttp
def append_db(data):
con = sqlite3.connect("../tiktok.db")
with con:
cur = con.cursor()
cur.execute("INSERT INTO tiktok VALUES (?)", data)
url = "https://www.tiktok.com/@thaovy1590/video/7164747239729024282?is_from_webapp=1&sender_device=pc&web_id=7169447631952266758"
tiklydown = "https://developers.tiklydown.me/api/download?url="
async def main():
async with aiohttp.ClientSession() as session:
metadata = False
async with session.get(tiklydown + url) as response:
metadata = await response.json()
print(metadata)
print(metadata["video"]["noWatermark"])
if metadata:
async with session.get(metadata["video"]["noWatermark"]) as res:
f = await aiofiles.open(f"download/{metadata['id']}.mp4", mode="wb")
await f.write(await res.read())
await f.close()
for key in metadata.keys():
print(f"{key}: {metadata[key]}")
loop = asyncio.get_event_loop()
loop.run_until_complete(main())