🐛: 修复一些小bug

This commit is contained in:
Evil0ctal 2024-04-23 09:29:21 -07:00
parent baefbba3d8
commit 8190b15832
14 changed files with 86 additions and 53 deletions

1
.gitignore vendored
View File

@ -131,3 +131,4 @@ dmypy.json
# pycharm
.idea
/app/api/endpoints/download/
/download/

View File

@ -4,7 +4,7 @@ ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get -y update \
&& apt-get install -y --no-install-recommends \
python3.11 python3-pip python3.11-dev nodejs
python3.11 python3-pip python3.11-dev
# Using Aliyun pipy mirror
RUN pip3 install -i https://mirrors.aliyun.com/pypi/simple/ -U pip

View File

@ -1 +1 @@
app: python start.py --port=$PORT
web: python3 start.py

View File

@ -33,7 +33,7 @@ async def fetch_data(url: str):
async def download_file_hybrid(request: Request,
url: str, prefix: bool = True, with_watermark: bool = False):
# 是否开启此端点/Whether to enable this endpoint
if not config["Download_Switch"]:
if not config["API"]["Download_Switch"]:
code = 400
message = "Download endpoint is disabled."
return ErrorResponseModel(code=code, message=message, router=request.url.path, params=dict(request.query_params))
@ -50,8 +50,8 @@ async def download_file_hybrid(request: Request,
data_type = data.get('type')
platform = data.get('platform')
aweme_id = data.get('aweme_id')
file_prefix = config.get("Download_File_Prefix") if prefix else ''
download_path = os.path.join(config.get("Download_Path"), f"{platform}_{data_type}")
file_prefix = config.get("API").get("Download_File_Prefix") if prefix else ''
download_path = os.path.join(config.get("API").get("Download_Path"), f"{platform}_{data_type}")
# 确保目录存在/Ensure the directory exists
os.makedirs(download_path, exist_ok=True)

View File

@ -42,6 +42,23 @@ from app.api.router import router as api_router
from app.web.app import MainView
from pywebio.platform.fastapi import asgi_app
# OS
import os
# YAML
import yaml
# Load Config
# 读取上级再上级目录的配置文件
config_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'config.yaml')
with open(config_path, 'r', encoding='utf-8') as file:
config = yaml.safe_load(file)
Host_IP = config['API']['Host_IP']
Host_Port = config['API']['Host_Port']
# API Tags
tags_metadata = [
{
@ -70,9 +87,9 @@ tags_metadata = [
},
]
version = 'V4.0.0'
update_time = '2024-04-20'
environment = 'development'
version = config['API']['Version']
update_time = config['API']['Update_Time']
environment = config['API']['Environment']
description = f"""
### [中文]
@ -119,4 +136,4 @@ webapp = asgi_app(lambda: MainView().main_view())
app.mount("/", webapp)
if __name__ == '__main__':
uvicorn.run(app, host="0.0.0.0", port=80)
uvicorn.run(app, host=Host_IP, port=Host_Port)

View File

@ -20,12 +20,12 @@ config_path = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__fil
with open(config_path, 'r', encoding='utf-8') as file:
_config = yaml.safe_load(file)
pywebio_config(theme=_config['PyWebIO_Theme'],
title=_config['Tab_Title'],
description=_config['Description'],
pywebio_config(theme=_config['Web']['PyWebIO_Theme'],
title=_config['Web']['Tab_Title'],
description=_config['Web']['Description'],
js_file=[
# 整一个看板娘,二次元浓度++
_config['Live2D_JS'] if _config['Live2D_Enable'] else None,
_config['Web']['Live2D_JS'] if _config['Web']['Live2D_Enable'] else None,
])
@ -38,7 +38,7 @@ class MainView:
# 左侧导航栏/Left navbar
with use_scope('main'):
# 设置favicon/Set favicon
favicon_url = _config['Favicon']
favicon_url = _config['Web']['Favicon']
session.run_js(f"""
$('head').append('<link rel="icon" type="image/png" href="{favicon_url}">')
""")
@ -89,4 +89,4 @@ class MainView:
elif select_options == options[1]:
put_markdown(self.utils.t('暂未开放,敬请期待~', 'Not yet open, please look forward to it~'))
elif select_options == options[2]:
a() if _config['Easter_Egg'] else put_markdown(self.utils.t('没有小彩蛋哦~', 'No Easter Egg~'))
a() if _config['Web']['Easter_Egg'] else put_markdown(self.utils.t('没有小彩蛋哦~', 'No Easter Egg~'))

View File

@ -20,7 +20,7 @@ with open(config_path, 'r', encoding='utf-8') as file:
# 网站域名/Website domain
domain = config['Domain']
domain = config['Web']['Domain']
# 校验输入值/Validate input value
@ -35,7 +35,7 @@ def valid_check(input_data: str):
return warn_info
else:
# 最大接受提交URL的数量/Maximum number of URLs accepted
max_urls = config['Max_Take_URLs']
max_urls = config['Web']['Max_Take_URLs']
if total_urls > int(max_urls):
warn_info = ViewsUtils.t(f'输入的链接太多啦,当前只会处理输入的前{max_urls}个链接!',
f'Too many links input, only the first {max_urls} links will be processed!')

View File

@ -1,3 +1,43 @@
# Web
Web:
# APP Information
Domain: https://douyin.wtf # Web domain | Web域名
# APP Configuration
PyWebIO_Theme: minty # PyWebIO theme | PyWebIO主题
Max_Take_URLs: 30 # Maximum number of URLs that can be taken at a time | 一次最多可以取得的URL数量
# Web Information
Tab_Title: Douyin_TikTok_Download_API # Web title | Web标题
Description: Douyin_TikTok_Download_API is a free open-source API service for Douyin/TikTok. It provides a simple, fast, and stable API for developers to develop applications based on Douyin/TikTok. # Web description | Web描述
Favicon: https://raw.githubusercontent.com/Evil0ctal/Douyin_TikTok_Download_API/main/logo/logo192.png # Web favicon | Web图标
# Fun Configuration
Easter_Egg: true # Enable Easter Egg | 启用彩蛋
Live2D_Enable: true
Live2D_JS: https://fastly.jsdelivr.net/gh/TikHubIO/TikHub_live2d@latest/autoload.js
# API
API:
# Network Configuration
Host_IP: 0.0.0.0 # use 127.0.0.1 for local access only | 仅本地访问请使用
Host_Port: 80 # default port is 80 | 默认端口为80
# API Information
Version: V4.0.0 # API version | API版本
Update_Time: 2024/04/22 # API update time | API更新时间
Environment: Demo # API environment | API环境
# Download Configuration
Download_Switch: true # Enable download function | 启用下载功能
# File Configuration
Download_Path: "./download" # Default download directory | 默认下载目录
Download_File_Prefix: "douyin.wtf_" # Default download file prefix | 默认下载文件前缀
# iOS Shortcut
iOS_Shortcut:
iOS_Shortcut_Version: 6.0
iOS_Shortcut_Update_Time: 2024/04/22
@ -5,27 +45,3 @@ iOS_Shortcut:
iOS_Shortcut_Link_EN: https://www.icloud.com/shortcuts/58e3a2cbac784a6782f1031c6b1dd9f8
iOS_Shortcut_Update_Note: 重新适配https://api.douyin.wtf(API-V1 3.0.0版本)
iOS_Shortcut_Update_Note_EN: Re-adapt https://api.douyin.wtf (API-V1 3.0.0 version)
Domain: https://douyin.wtf
Tab_Title: Douyin_TikTok_Download_API
Description: Douyin_TikTok_Download_API is a free open-source API service for Douyin/TikTok. It provides a simple, fast, and stable API for developers to develop applications based on Douyin/TikTok.
Favicon: https://raw.githubusercontent.com/Evil0ctal/Douyin_TikTok_Download_API/main/logo/logo192.png
PyWebIO_Theme: minty
Live2D_Enable: true
Live2D_JS: https://fastly.jsdelivr.net/gh/TikHubIO/TikHub_live2d@latest/autoload.js
Easter_Egg: true
Max_Take_URLs: 30
Download_Switch: true
Download_File_Prefix: douyin.wtf_
# 默认下载目录/Default download directory
Download_Path: "./download"

View File

@ -4,7 +4,7 @@ TokenManager:
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36
Referer: https://www.douyin.com/
Cookie: __ac_nonce=066230555003b69f3d0f8; __ac_signature=_02B4Z6wo00f01w7tO1AAAIDCBMvg-bBoGdMOzT.AAKWia3; ttwid=1%7CFqN4u6-bqw9dKIb4BPG9sJ3uK6liJe-2wLmYxLyKSjo%7C1713571158%7C6ff5e572886adbccc6888596e8c93ead09164ab0553e38b54fcf2266e9f3975f; douyin.com; device_web_cpu_core=32; device_web_memory_size=8; architecture=amd64; IsDouyinActive=true; dy_swidth=1463; dy_sheight=915; stream_recommend_feed_params=%22%7B%5C%22cookie_enabled%5C%22%3Atrue%2C%5C%22screen_width%5C%22%3A1463%2C%5C%22screen_height%5C%22%3A915%2C%5C%22browser_online%5C%22%3Atrue%2C%5C%22cpu_core_num%5C%22%3A32%2C%5C%22device_memory%5C%22%3A8%2C%5C%22downlink%5C%22%3A10%2C%5C%22effective_type%5C%22%3A%5C%224g%5C%22%2C%5C%22round_trip_time%5C%22%3A50%7D%22; strategyABtestKey=%221713571161.726%22; stream_player_status_params=%22%7B%5C%22is_auto_play%5C%22%3A0%2C%5C%22is_full_screen%5C%22%3A0%2C%5C%22is_full_webscreen%5C%22%3A0%2C%5C%22is_mute%5C%22%3A1%2C%5C%22is_speed%5C%22%3A1%2C%5C%22is_visible%5C%22%3A1%7D%22; volume_info=%7B%22isUserMute%22%3Afalse%2C%22isMute%22%3Atrue%2C%22volume%22%3A0.5%7D; csrf_session_id=6f34e666e71445c9d39d8d06a347a13f; FORCE_LOGIN=%7B%22videoConsumedRemainSeconds%22%3A180%7D; passport_csrf_token=5173fb1efb9b16ee61c56dcee57331e4; passport_csrf_token_default=5173fb1efb9b16ee61c56dcee57331e4; bd_ticket_guard_client_data=eyJiZC10aWNrZXQtZ3VhcmQtdmVyc2lvbiI6MiwiYmQtdGlja2V0LWd1YXJkLWl0ZXJhdGlvbi12ZXJzaW9uIjoxLCJiZC10aWNrZXQtZ3VhcmQtcmVlLXB1YmxpYy1rZXkiOiJCTjNWTnlqalFKamc4SmNCS1dFcjdyRmd1bDNXSGhwaFJhbU5jMldhYnRGUis3VGxhbVlyaTJDMlpSbDRjek1QRXlaSTFlQlowQUhrMkQyOGNoS08xdTg9IiwiYmQtdGlja2V0LWd1YXJkLXdlYi12ZXJzaW9uIjoxfQ%3D%3D; bd_ticket_guard_client_web_domain=2; home_can_add_dy_2_desktop=%221%22; odin_tt=f8fd6095f16034d5e61156f2c0ba9fe3a16e158a40aa0586d8cf4a134558489d2ea591bb5beca05b1b561004c75273c5ccc9fe868f102dd137aab43336d9a8f9df0ac6298c783d03e446b7f2ca4ce154; msToken=lKfc9qATIFKJ9_UT6GpjnH3aXhZh6x5pUp4pknx9OmVJazLzv_VRZUnCDpU9nLzDeZPZpd4E3imehA9UicUakm6NVArFul8oi4-3YE4IB66t3Zw1hpkcZDQFbs1egY8=
Cookie: __ac_nonce=06627d480003d58a8190b; __ac_signature=_02B4Z6wo00f01-IZnhQAAIDBe6oblqadIpviKZqAAJ6rf8; ttwid=1%7C-Of7TeBAeGKE24J-G9lQTyYMbarezk-FqHes_m0epmk%7C1713886336%7C9d64a25bb2cdada3b03e96ccf301c566fb433bb79224189c768f14f002807a69; douyin.com; device_web_cpu_core=16; device_web_memory_size=-1; architecture=amd64; IsDouyinActive=true; home_can_add_dy_2_desktop=%220%22; dy_swidth=1323; dy_sheight=827; stream_recommend_feed_params=%22%7B%5C%22cookie_enabled%5C%22%3Atrue%2C%5C%22screen_width%5C%22%3A1323%2C%5C%22screen_height%5C%22%3A827%2C%5C%22browser_online%5C%22%3Atrue%2C%5C%22cpu_core_num%5C%22%3A16%2C%5C%22device_memory%5C%22%3A0%2C%5C%22downlink%5C%22%3A%5C%22%5C%22%2C%5C%22effective_type%5C%22%3A%5C%22%5C%22%2C%5C%22round_trip_time%5C%22%3A0%7D%22; strategyABtestKey=%221713886336.871%22; volume_info=%7B%22isUserMute%22%3Afalse%2C%22isMute%22%3Atrue%2C%22volume%22%3A0.5%7D; stream_player_status_params=%22%7B%5C%22is_auto_play%5C%22%3A0%2C%5C%22is_full_screen%5C%22%3A0%2C%5C%22is_full_webscreen%5C%22%3A0%2C%5C%22is_mute%5C%22%3A1%2C%5C%22is_speed%5C%22%3A1%2C%5C%22is_visible%5C%22%3A1%7D%22; FORCE_LOGIN=%7B%22isForcePopClose%22%3A1%2C%22videoConsumedRemainSeconds%22%3A180%7D; csrf_session_id=120d8aacffb06addd01cb40859003c8e; passport_csrf_token=64ef7bb1551de25edf2de3858052ab1b; passport_csrf_token_default=64ef7bb1551de25edf2de3858052ab1b; msToken=7dqfBo9hjkfDVj7hGxUyIlvtRw4Vzy0T2ruboimJr0bleyxxhwvA099RXW39vbuiPGPYNjpBPZCbeApQHFBdZLShvEO39xGKzXepBnic; odin_tt=293fa6b96fec076695e542177ac867302abf7d59428674c78fea6c748328d4c786346cd86224c956cc6245420100f712eb7bf4ee25782588e316a78b4df4bc7a8d4c63644e7075f9f37a589e597e539d; bd_ticket_guard_client_data=eyJiZC10aWNrZXQtZ3VhcmQtdmVyc2lvbiI6MiwiYmQtdGlja2V0LWd1YXJkLWl0ZXJhdGlvbi12ZXJzaW9uIjoxLCJiZC10aWNrZXQtZ3VhcmQtcmVlLXB1YmxpYy1rZXkiOiJCRHh5OUFmeWhnUUFXdEFpU01tQnBaOVgyZ0tYNGc3ZGN3ckNUM3lHbWZEVWxabllpRjM3MmxpYU9EeER4REtobGF1U2l5OTI4Q0VpTGtQcXBXcVJjbkE9IiwiYmQtdGlja2V0LWd1YXJkLXdlYi12ZXJzaW9uIjoxfQ%3D%3D; bd_ticket_guard_client_web_domain=2
proxies:
http:

View File

@ -327,7 +327,6 @@ class DouyinWebCrawler:
# print(result)
# 获取用户喜欢作品数据
# 这个账号有点东西,晚点看一下 https://www.douyin.com/user/MS4wLjABAAAAW9FWcqS7RdQAWPd2AA5fL_ilmqsIFUCQ_Iym6Yh9_cUa6ZRqVLjVQSUjlHrfXY1Y
# sec_user_id = "MS4wLjABAAAAW9FWcqS7RdQAWPd2AA5fL_ilmqsIFUCQ_Iym6Yh9_cUa6ZRqVLjVQSUjlHrfXY1Y"
# max_cursor = 0
# count = 10

View File

@ -3,7 +3,7 @@ TokenManager:
headers:
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36
Referer: https://www.tiktok.com/
Cookie: tt_csrf_token=swzFbctS-d01xfNEDqKXaPXo2rCgRD9G0eGE; ak_bmsc=FCF8615A4E6BE10A1DD7459465B8BB16~000000000000000000000000000000~YAAQ5OIsF7olH8+OAQAAzCrl+Bd8Fp6TmQBkH2R4pvEPzVfNCvW23aFkf/Y0mVUFcZKNWkK3HNchrpk8cOzoB+oPTpg2cdLX3jXanz4KPVPEL/j/63yZ2/dMIY85Szp9osCX08pO2uUNQ2+wrynmtOO17GbOiEwz88WU+vwmbiLHh3kXYgL05mhk7QPcCbkwmrjrO8MK6eIv61PY2w9hCySeBpDjEymEZaE1//YthsBzKjiin5XEcy02P8Gyjm4JPwCT51ibYMs+MInRSeGeqDe50R14dnnMEplkXpEyvgBc56jfvIC2hLFwodY3/WST+xJBJ/wlXnPQtz4xm2qxPe6GybqqND0ebbC50QEORTU0RVTNcIZLptBmXaMCq3fTUzQakV0Enyae8w==; tt_chain_token=Hd8IafgFe6cvSObNkafaVA==; bm_sv=642D5E006DE69E254946C4A763D9A4FD~YAAQ5OIsF7slH8+OAQAA/ivl+Bc2q1mDEH+wpeYc83apdrOw3IjVn0joPM3aB0QNcF10Gz972bawwuIGWkZiGdNzpshINZ0pD2Pv3Z0dylnaTc4uVwwcjIT7JJyJIxJFs8pN7zmUM4mSj+F6QbgpX9eOO/WemqDW25TUhrS6kLm886MiRaejnoCUcAt4Gt8FGmmpdNBKTLY0EqsLeWhU5++CqzCmJ/CWT9bUrFC3hI2yf54OEru5yP28bLKYPLmj~1; tiktok_webapp_theme=light; ttwid=1%7CV7vzUo1jsQihIMKHnZpNNp9rCrGHcC4bUw4VWm5SSOQ%7C1713572754%7Ca28c6b6eb3c4b597a1111b123a5b45e305626f37f249e9bc56d02bb6be651909; passport_csrf_token=8ed81b4c85a7c20332ec9265d7057fc1; passport_csrf_token_default=8ed81b4c85a7c20332ec9265d7057fc1; perf_feed_cache={%22expireTimestamp%22:1713744000000%2C%22itemIds%22:[%227350454864071150890%22%2C%227342421363656789291%22%2C%227341080338803821866%22]}; msToken=kd_x8QL-A4Z1FfvqdPF--bXF06lUvRkB5Q41QEr-kXiaV30qUXhT9iy5cIiRggNDA1B5vyaPkwPKQwQX4oZHAW2A0C_u23wyNLjdW3p8WfKTfOSCoNLPP5NkM9LCBUXKXvoMIEVU_EvSN-A-bQ==; msToken=pJU9vxWWaHLsaRwF5O3JdwuldPan_W6Zx0TcL3wMMQE1Ni2B76ukBfVfHb_TKnwgAoKAYT7uXB5JiY1TG8bxEAPYJBrIs78KFI6ZU5l79GWsCZHXkDlB7tpMf_jfSAFOYjxBAFy_4XWaGVzBRg==
Cookie: tt_csrf_token=YmksDB6a-h4cT2fF7JpORI2O9UBMCWjsntIc; ttwid=1%7C0FVb9fFc-sjDG2UdJwdC1AirqYozQ0xfbAS4N72vN2Y%7C1713886256%7C78a9d83445b82b73ca8d4e0cf024ea6cdf1329b7f3866c826b0a69a300ebce46; ak_bmsc=51B1D53481A3A4E4D0CEFF2BCF622DA2~000000000000000000000000000000~YAAQ7uIsF6c4j+SOAQAAANmUCxfRGVXZ4D9xnO97l1yDw0OWyomnVkNY7IUKaggUja0kQzFQ+WG4xaxBcPt0AN0n26KeHXGGKgHYpHPUMUBHGHQGDtE4RLyy7U+LPbSJCqVaSDiPuzxHht0YUIbWogvrFmBfkP4ohcmjkZxWtEI9qQ4Whaobb2CFHGdKNt0zlVNBjJQ3uYRAvUe12zSBynQB18y6QhE8goneRkCEw9VIeft2pFIwNQ8tkWWEjDt6wHNaqeND7eASg5WLzYskWbTt6bPAOhSNRLJ38HZrOB5QNg+xxN5uuCSYmjMXCl8SkvQr91pInmOng+V898FLLBQtefs95whvbpfE0mKwBk5Cz2TkkHcUJa/IoC0CLmNqoEk3AtKxpw/J; tt_chain_token=46Xkv2ukMzyJ2e7XU7y0AQ==; bm_sv=A2E67B998DE8E6A4F1C2C02485467446~YAAQ7uIsF6g4j+SOAQAABdqUCxf1J/K4dYG0k7bbw2m5rFujdlSqMoCKDubu4R602nFvbY6zWC5puJczBv3IXwJJRpQxxR03wDCMVlKTCqjQvgDs8BoCuoNQxfY2fdS+F3bKut2lxXPQ2qctqz4kHBrgspJArHn/zu/IuKCIeSzmV4KcyxW6Zvw3/xMRA0MeHgyuHsTRBS+VrFk8Ju2NbJWWC8uSHbLCM/dhFT7/ktw8RE30r24XpQmhLpVTsUSC~1; tiktok_webapp_theme=light; msToken=ySXERzKCE0QUG0cCg6TWLw3wfEB-6kh6kAfuzhzjcQvmV1jBFloSgIsT9xk-QXFVdI99U1Fqb9mhUpIOldoDkjdZwskB8rvt66MHZaHnvBRZRtOKtTYsWT8osDyQXDVZWdPkvyE598h9; passport_csrf_token=1a47d95ebf68fc3648b0018ee75afc9f; passport_csrf_token_default=1a47d95ebf68fc3648b0018ee75afc9f; perf_feed_cache={%22expireTimestamp%22:1714057200000%2C%22itemIds%22:[%227346425092966206766%22%2C%227353812964207594795%22%2C%227343343741916171563%22]}; msToken=yWwG-ITrCnjJbx5ltBa9FTXdCImOJrl-wtQJSQH3afeEumWZcbo_qcrF6F7-NjYcrG6JVxtJiOU208REZeCSgXEZrrs5_65K741fQ7PSzCGOhz6vUyycq3Xvj4Mu-S0kJ6SqyltHnpJp
proxies:
http:
@ -20,7 +20,6 @@ TokenManager:
ttwid:
url: https://www.tiktok.com/ttwid/check/
data: '{"aid":1988,"service":"www.tiktok.com","union":false,"unionHost":"","needFid":false,"fid":"","migrate_priority":0}'
cookie: ttwid=1%7CovVQu2St-HXSHAdEfZ7tljPe151SZ88AbrlTirlaC6w%7C1701072604%7C49b17849da69bafc3638e794f3f26b30fe9677c5253e65a2a5f615489846ce02
cookie: tt_csrf_token=YmksDB6a-h4cT2fF7JpORI2O9UBMCWjsntIc; ttwid=1%7C0FVb9fFc-sjDG2UdJwdC1AirqYozQ0xfbAS4N72vN2Y%7C1713886256%7C78a9d83445b82b73ca8d4e0cf024ea6cdf1329b7f3866c826b0a69a300ebce46; ak_bmsc=51B1D53481A3A4E4D0CEFF2BCF622DA2~000000000000000000000000000000~YAAQ7uIsF6c4j+SOAQAAANmUCxfRGVXZ4D9xnO97l1yDw0OWyomnVkNY7IUKaggUja0kQzFQ+WG4xaxBcPt0AN0n26KeHXGGKgHYpHPUMUBHGHQGDtE4RLyy7U+LPbSJCqVaSDiPuzxHht0YUIbWogvrFmBfkP4ohcmjkZxWtEI9qQ4Whaobb2CFHGdKNt0zlVNBjJQ3uYRAvUe12zSBynQB18y6QhE8goneRkCEw9VIeft2pFIwNQ8tkWWEjDt6wHNaqeND7eASg5WLzYskWbTt6bPAOhSNRLJ38HZrOB5QNg+xxN5uuCSYmjMXCl8SkvQr91pInmOng+V898FLLBQtefs95whvbpfE0mKwBk5Cz2TkkHcUJa/IoC0CLmNqoEk3AtKxpw/J; tt_chain_token=46Xkv2ukMzyJ2e7XU7y0AQ==; bm_sv=A2E67B998DE8E6A4F1C2C02485467446~YAAQ7uIsF6g4j+SOAQAABdqUCxf1J/K4dYG0k7bbw2m5rFujdlSqMoCKDubu4R602nFvbY6zWC5puJczBv3IXwJJRpQxxR03wDCMVlKTCqjQvgDs8BoCuoNQxfY2fdS+F3bKut2lxXPQ2qctqz4kHBrgspJArHn/zu/IuKCIeSzmV4KcyxW6Zvw3/xMRA0MeHgyuHsTRBS+VrFk8Ju2NbJWWC8uSHbLCM/dhFT7/ktw8RE30r24XpQmhLpVTsUSC~1; tiktok_webapp_theme=light; msToken=ySXERzKCE0QUG0cCg6TWLw3wfEB-6kh6kAfuzhzjcQvmV1jBFloSgIsT9xk-QXFVdI99U1Fqb9mhUpIOldoDkjdZwskB8rvt66MHZaHnvBRZRtOKtTYsWT8osDyQXDVZWdPkvyE598h9; passport_csrf_token=1a47d95ebf68fc3648b0018ee75afc9f; passport_csrf_token_default=1a47d95ebf68fc3648b0018ee75afc9f; perf_feed_cache={%22expireTimestamp%22:1714057200000%2C%22itemIds%22:[%227346425092966206766%22%2C%227353812964207594795%22%2C%227343343741916171563%22]}; msToken=yWwG-ITrCnjJbx5ltBa9FTXdCImOJrl-wtQJSQH3afeEumWZcbo_qcrF6F7-NjYcrG6JVxtJiOU208REZeCSgXEZrrs5_65K741fQ7PSzCGOhz6vUyycq3Xvj4Mu-S0kJ6SqyltHnpJp
odin_tt:
url: https://www.tiktok.com/passport/web/account/info/?aid=1459&app_language=zh-Hans&app_name=tiktok_web&browser_language=zh-CN&browser_name=Mozilla&browser_online=true&browser_platform=Win32&browser_version=5.0%20%28Windows%20NT%2010.0%3B%20Win64%3B%20x64%29%20AppleWebKit%2F537.36%20%28KHTML%2C%20like%20Gecko%29%20Chrome%2F119.0.0.0%20Safari%2F537.36&channel=tiktok_web&cookie_enabled=true&device_id=7306060721837852167&root_referer=https%3A%2F%2Fwww.tiktok.com%2Flogin%2F

View File

@ -370,7 +370,7 @@ class TikTokWebCrawler:
# print(response)
# 获取用户的收藏列表
# cookie = "ttwid=1%7Cbf2dxDZQ2bEXkDZCxVuIuo_p3DnLZydqkW-M-yEHrQ8%7C1712658199%7C4163e4b82a08fd8160ec7d3959a3c07b2dea47b1184fd4e35619ba732a48c1f7; tt_chain_token=AlPMTLvrUZOd3f21B8dbGQ==; tiktok_webapp_theme=light; odin_tt=70b04a203cd043dbe532561dd854ce106b9c0253acf3c105969313c9f58b97bafd88ba18dd551651e4a4bf92d02067b281ca82d4a75acb17b95d7d39103aa4da0f3597fe75e56404891f651147b9bc3f; passport_csrf_token=fd79484bbdda182d711ad15fa11c059d; passport_csrf_token_default=fd79484bbdda182d711ad15fa11c059d; multi_sids=7262344915936658478%3Aa5b1dc5805dee79797d4470ffa822e45; cmpl_token=AgQQAPNSF-RO0rT35p6-9h0X_5yvjXFav6jZYNCqgQ; sid_guard=a5b1dc5805dee79797d4470ffa822e45%7C1711264624%7C15552000%7CFri%2C+20-Sep-2024+07%3A17%3A04+GMT; uid_tt=59c2975ea05dc11e9f7f548a658d65348935cb555d188c432fe2e5d0bd6b75e1; uid_tt_ss=59c2975ea05dc11e9f7f548a658d65348935cb555d188c432fe2e5d0bd6b75e1; sid_tt=a5b1dc5805dee79797d4470ffa822e45; sessionid=a5b1dc5805dee79797d4470ffa822e45; sessionid_ss=a5b1dc5805dee79797d4470ffa822e45; sid_ucp_v1=1.0.0-KDNkZDkzMWRkNzMwOTU4NWVjZWNjZDAxZGE0NDgyNDJlYWQ3MTU4YjcKIAiuiJO2k4fC5GQQ8Kb_rwYYswsgDDDCkaSmBjgBQOoHEAQaB3VzZWFzdDUiIGE1YjFkYzU4MDVkZWU3OTc5N2Q0NDcwZmZhODIyZTQ1; ssid_ucp_v1=1.0.0-KDNkZDkzMWRkNzMwOTU4NWVjZWNjZDAxZGE0NDgyNDJlYWQ3MTU4YjcKIAiuiJO2k4fC5GQQ8Kb_rwYYswsgDDDCkaSmBjgBQOoHEAQaB3VzZWFzdDUiIGE1YjFkYzU4MDVkZWU3OTc5N2Q0NDcwZmZhODIyZTQ1; store-idc=useast5; store-country-code=us; store-country-code-src=uid; tt-target-idc=useast5; tt-target-idc-sign=hG594kSqj5ODjFKxKHu5O7_f0V5snMn-pNH9xbtYUWPjnSrq6LBUTwNfeMfgVdLAPiOuLNMMg5XQw54qK0h3--UlLvHwwkLKKvtGRPKb0PV3sJSg_M6EAAMDXHVz8dYwteofNu4j7ojwk10lEmZpuzXaAT574unoAu3gk-gJV9DlFkw-kwD_rHOkelP6Lk0Gw1fGDY3Om20-0tVFVJ8mmEOZtjkxnwgZ8-Eo707aT1lGidJ8PZKIbNkgo3udCLpy3rSl-LuUsYiPOfTwg1Ih7nv4Y2OeBOG5w21c9_6Yeo9SGcjf2gtuwQASkjWDy1vLxipf0cYrfFhVlOk2xgZi-RgbhQg62kiYSUe-Mv0zgmYPTTPXMz9okU3Y3IEklz-2adsaZY5kW8qJRBYp1yUhXPr5e7rf04Clj453VxYO5urfI935gMyB8p1KXpJrSaO3OLyZ2YKyNLnEGXBCMBbDzCOrMj8guP42JPOuf-fTIJkYhfHpqqTBHj3h7st22jY3; last_login_method=email; msToken=uhdWmwVzRuGO6X5Qzob8gV2OmXcf6t0FAQeHHIQAx__ZNZubBNAbfK3W7T-E4EN8_OfagmkDu_qAwo6MSaq-qhtPel9tndR7ZaNzoIhsyueXfEYtl8AfTxR9JZk5UemPY7GQ; tt_csrf_token=kOLsNXq3-r4m3r3K1YME0Ga961eYwydSITsM; ak_bmsc=A665D13C6586D765DDF447442952896E~000000000000000000000000000000~YAAQyuIsF15v8sCOAQAAKNIGwhcV5kjZ/zGNalPWSyQXieZLY9SKy2VxEzWDzgy/YRSQLTVBC9WBFE+RXuayfyihX1Rbsm+DQ4sTtTzHIUY20Yu1tWQjcakcvZXtfLp7I0q6fcP9ai53N1iG5wwovNyFJ1eyMQVLm650J2PK59+7DcZn3kmOAHjMl6plVx6mVRoTqXcRte4b5JDtORNbXAbjSgbQiJK5fpJPSFKd19j3C/7hJij3mFvcVMa7hlBIDYlDAshlyrykE/MaoRof0RRZCNuJfO45ZdftS5+YYhuLZXbUsaJXsj3DjmaZj90kNyhovKh4AepeXm6FeC2Mejp4nCILsF0c9nZmTl2jh+TerAffOmdwieV2UejJgfAIcSXrZ1dVWtu0dQ==; passport_fe_beating_status=true; perf_feed_cache={%22expireTimestamp%22:1712822400000%2C%22itemIds%22:[%227351502927267171630%22%2C%227349225060231679275%22%2C%227351880657787800864%22]}; bm_sv=0B6DC970D9D01727EB672641008F9C9D~YAAQxeIsFy0Bw5iOAQAAOChiwhecEatJ7PnT5D7Z1Cr2pcpz/MkHKvKSfCtcnD+888hhDkzPART3agFPgqxJzjotbMOL9vMYCaF331W/Ahjx+/L9pVnvOqKVyhwYw58LJG1NgB2tliqi18Exun04pomLtD195iDMfNbGdYmGt7WrtWumTuI7qEjkR4QAClrPNP1JFYUGT9A29+iGzc+/wqDZiG+0AGXUlTEBmIKM398S9DqSWpJrRvNODjMe7Fg2~1; _waftokenid=eyJ2Ijp7ImEiOiJweEtDTWVrOENLZEZyMDY5bzE1T01KL2RncVNSVWlzZ0xtQVAyZXJDeWw0PSIsImIiOjE3MTI2NTgxMjYsImMiOiJJTU94cGtQS1FuSG1XbVNOYUx0Yk5ldndQR2w5RkxIbkJXaEExOTVPbzFZPSJ9LCJzIjoiL3JDZDl1dXVIWkRvSTc2M1dLM2VHR2hNQU9vbGJGKy9oMFdtTXE3Zkgwaz0ifQ; msToken=J4gOwTXU0OEU6MH3VjhUVmCYMNGqtznsRSDxyl8KNlfSTPM7fMYYXHPPIpldHRFUx_fPfyhVclvrX6WnrNdxk3GzK_7BHmhIIkQbQ1zSSnqY2Phn6QduvErSGvCQyvxwTctWzslT3BqiIg=="
# cookie = "put your cookie here"
# secUid = "MS4wLjABAAAAq1iRXNduFZpY301UkVpJ1eQT60_NiWS9QQSeNqmNQEDJp0pOF8cpleNEdiJx5_IU"
# cursor = 0
# count = 30
@ -432,7 +432,7 @@ class TikTokWebCrawler:
# print(response)
# 生成ttwid
# cookie = "ttwid=1%7Cbf2dxDZQ2bEXkDZCxVuIuo_p3DnLZydqkW-M-yEHrQ8%7C1712664278%7C6ed45f1bb91c86eda1e08c6f60da7898591ed368ee7feece0a78f48d6e734d71; tt_chain_token=AlPMTLvrUZOd3f21B8dbGQ==; tiktok_webapp_theme=light; odin_tt=dada47a81f211d932ae6c5a0dc99b4e87029d27b49b0fc4a83faf6bc91bebddcf3665c25f1a7c0934dc27c89ab2a7151e116cc22110c24b927051de11b54c3e66e6567dba55e88d2f92f52a7b857d27f; passport_csrf_token=fd79484bbdda182d711ad15fa11c059d; passport_csrf_token_default=fd79484bbdda182d711ad15fa11c059d; multi_sids=7262344915936658478%3Aa5b1dc5805dee79797d4470ffa822e45; cmpl_token=AgQQAPNSF-RO0rT35p6-9h0X_5yvjXFav6jZYNCqgQ; sid_guard=a5b1dc5805dee79797d4470ffa822e45%7C1711264624%7C15552000%7CFri%2C+20-Sep-2024+07%3A17%3A04+GMT; uid_tt=59c2975ea05dc11e9f7f548a658d65348935cb555d188c432fe2e5d0bd6b75e1; uid_tt_ss=59c2975ea05dc11e9f7f548a658d65348935cb555d188c432fe2e5d0bd6b75e1; sid_tt=a5b1dc5805dee79797d4470ffa822e45; sessionid=a5b1dc5805dee79797d4470ffa822e45; sessionid_ss=a5b1dc5805dee79797d4470ffa822e45; sid_ucp_v1=1.0.0-KDNkZDkzMWRkNzMwOTU4NWVjZWNjZDAxZGE0NDgyNDJlYWQ3MTU4YjcKIAiuiJO2k4fC5GQQ8Kb_rwYYswsgDDDCkaSmBjgBQOoHEAQaB3VzZWFzdDUiIGE1YjFkYzU4MDVkZWU3OTc5N2Q0NDcwZmZhODIyZTQ1; ssid_ucp_v1=1.0.0-KDNkZDkzMWRkNzMwOTU4NWVjZWNjZDAxZGE0NDgyNDJlYWQ3MTU4YjcKIAiuiJO2k4fC5GQQ8Kb_rwYYswsgDDDCkaSmBjgBQOoHEAQaB3VzZWFzdDUiIGE1YjFkYzU4MDVkZWU3OTc5N2Q0NDcwZmZhODIyZTQ1; store-idc=useast5; store-country-code=us; store-country-code-src=uid; tt-target-idc=useast5; tt-target-idc-sign=hG594kSqj5ODjFKxKHu5O7_f0V5snMn-pNH9xbtYUWPjnSrq6LBUTwNfeMfgVdLAPiOuLNMMg5XQw54qK0h3--UlLvHwwkLKKvtGRPKb0PV3sJSg_M6EAAMDXHVz8dYwteofNu4j7ojwk10lEmZpuzXaAT574unoAu3gk-gJV9DlFkw-kwD_rHOkelP6Lk0Gw1fGDY3Om20-0tVFVJ8mmEOZtjkxnwgZ8-Eo707aT1lGidJ8PZKIbNkgo3udCLpy3rSl-LuUsYiPOfTwg1Ih7nv4Y2OeBOG5w21c9_6Yeo9SGcjf2gtuwQASkjWDy1vLxipf0cYrfFhVlOk2xgZi-RgbhQg62kiYSUe-Mv0zgmYPTTPXMz9okU3Y3IEklz-2adsaZY5kW8qJRBYp1yUhXPr5e7rf04Clj453VxYO5urfI935gMyB8p1KXpJrSaO3OLyZ2YKyNLnEGXBCMBbDzCOrMj8guP42JPOuf-fTIJkYhfHpqqTBHj3h7st22jY3; last_login_method=email; msToken=t3WAFkKaIqii9eMTPHdks49bnQnrcb-qA8i0K6CbTF-2MBdObKnGfU3icz53Wot781BQXPL4PT4ZI2nIFacyECthXfFPg6JrkghC_Yn7pf6aut5YU7PpqeuAa3Ipg-1OAYS2rF3UrQOetw==; tt_csrf_token=kOLsNXq3-r4m3r3K1YME0Ga961eYwydSITsM; passport_fe_beating_status=true; ak_bmsc=24B67BCA11EE8356DD40E4F7E23FC910~000000000000000000000000000000~YAAQyOIsF//Uz6COAQAAe/5/whdqkLc0AH5d8i2rlJjtjjMuK1K+tU3kWANu/7PWSoOfbjdVZi9uFRKsuQj1DU0Ztew9uihAT+jWEvqNo1cbee/FRwJLMZk80po2nI/GwpLKd51dHN5HW7dWc58oeWwpIOh/g2uVkXJjtVotM4sBcEYxO1i9fpOF0bgOOVXrElmpqaFVfWBJc0iBBHHBZEAHNSIGHjPHY7j+Gy4YMoldkJKJbMVtRWa3ChfagC7vgWsiy2sb3lDGRbSQgjYj128i2lwoPtbcA3bzLZPd6jseTgRHm01arjyMJh3RrhDUyu71D1jMPuWhVkAjAV21vrsJFmgFWQ3Ryv23yDa6kSq7qRBLQAxA6rYcYBRNPdoNOAaiLt5IBCHiWQ==; bm_sv=FB0D8C84058596C33C95C34477181900~YAAQ3+IsF1bJy52OAQAAIOy+whed7uxWbcSbX9ww9mH0hyPTbQLecKO8qrRli6xSOco/iX7wxO9RXW6ikifIc2RFIbvzAZg3j58QNuEJ5hXrIia0yc0T/j1cCjhqBypDWXc6KaC716f293K5lbOFoD7QMFCA3K4YsMK3mJa2KaBzOvwOTdbpmow8PM0fKAXwSxJDPweGCzxZhiMNC+H/TFscBYb5HdDZ7PkuiN97YPtVEtfMd4WcpHos3e5dFJS+~1; living_user_id=743289106087; csrfToken=ndffXer7-a5_J5Me7ffRmSSJfzfMDmX3B6oM; perf_feed_cache={%22expireTimestamp%22:1712836800000%2C%22itemIds%22:[%227348432053190380842%22%2C%227352682225256762666%22%2C%227350485674086157611%22]}; csrf_session_id=120d8aacffb06addd01cb40859003c8e; msToken=8tbUEEpe8rNjEkOrH6M5v-RXjSUaCAARr-Knyk11POdQHvjVvQjbXEbEP4vcAf2ftbB7ycHOz7LlQbADkPURuVvseAstrFbSmxY3uVJOLAgS6O9h3BnXmpHH_kPw4xXgF2zDv4E-U58JZw=="
# cookie = "put your cookie here"
# response = await self.gen_ttwid(cookie)
# print(response)

View File

@ -1,15 +1,16 @@
version: "3.9"
services:
# bot
douyin_tiktok_download_api:
image: evil0ctal/douyin_tiktok_download_api
network_mode: host
container_name: douyin_tiktok_download_api
restart: always
volumes:
- ./config.yaml:/crawlers/douyin/web/config.yaml:/crawlers/tiktok/web/config.yaml:/crawlers/tiktok/app/config.yaml
- ./config.yaml
- ./crawlers/douyin/web/config.yaml
- ./crawlers/tiktok/web/config.yaml
- ./crawlers/tiktok/app/config.yaml
environment:
TZ: Asia/Shanghai
deploy:

View File

@ -34,8 +34,8 @@
# ==============================================================================
from app.main import app
from app.main import app, Host_IP, Host_Port
import uvicorn
if __name__ == '__main__':
uvicorn.run(app, host='0.0.0.0', port=80)
uvicorn.run('app.main:app', host=Host_IP, port=Host_Port, reload=True, log_level="info")