forked from JoeanAmier/TikTokDownloader
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7ebfdff
commit e56b34a
Showing
24 changed files
with
513 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
requests>=2.31.0 | ||
openpyxl>=3.1.2 | ||
Flask>=3.0.2 | ||
qrcode>=7.4.2 | ||
emoji>=2.10.1 | ||
rich>=13.7.1 | ||
lxml>=5.1.0 | ||
browser-cookie3>=0.19.1 | ||
aiosqlite>=0.20.0 | ||
aiohttp>=3.9.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,46 @@ | ||
from asyncio import run | ||
from contextlib import suppress | ||
from typing import TYPE_CHECKING | ||
|
||
from rich.console import Console | ||
|
||
from src.custom import ERROR | ||
from src.tools import request_post | ||
|
||
if TYPE_CHECKING: | ||
from src.module import ColorfulConsole | ||
__all__ = ["TtWid", "TtWidTikTok"] | ||
|
||
|
||
class TtWid: | ||
pass | ||
NAME = "ttwid" | ||
API = "https://ttwid.bytedance.com/ttwid/union/register/" | ||
DATA = ( | ||
'{"region":"cn","aid":1768,"needFid":false,"service":"www.ixigua.com","migrate_info":' | ||
'{"ticket":"","source":"node"},"cbUrlProtocol":"https","union":true}') | ||
|
||
@classmethod | ||
async def get_tt_wid(cls, console: "ColorfulConsole", ) -> dict | None: | ||
if response := await request_post(console, cls.API, cls.DATA): | ||
return cls.extract(console, response, cls.NAME) | ||
console.print(f"获取 {cls.NAME} 参数失败!", style=ERROR) | ||
|
||
@staticmethod | ||
def extract(console: "ColorfulConsole", headers, key: str) -> dict | None: | ||
if c := headers.get("Set-Cookie"): | ||
with suppress(IndexError): | ||
kv = c.split("; ")[0].split("=", 1) | ||
return {kv[0]: kv[1]} | ||
console.print(f"获取 {key} 参数失败!", style=ERROR) | ||
|
||
class TtWidTikTok: | ||
|
||
class TtWidTikTok(TtWid): | ||
pass | ||
|
||
|
||
async def debug(): | ||
print(await TtWid.get_tt_wid(Console())) | ||
|
||
|
||
if __name__ == "__main__": | ||
run(debug()) |
Oops, something went wrong.