mirror of
https://github.com/Evil0ctal/Douyin_TikTok_Download_API.git
synced 2025-04-20 22:40:08 +08:00
🔧Modified for PyPi
This commit is contained in:
parent
c87f6978c5
commit
9ef19a1150
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
import os
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import platform
|
import platform
|
||||||
import asyncio
|
import asyncio
|
||||||
@ -65,6 +66,8 @@ class Scraper:
|
|||||||
self.tiktok_api_headers = {
|
self.tiktok_api_headers = {
|
||||||
'User-Agent': 'com.ss.android.ugc.trill/2613 (Linux; U; Android 10; en_US; Pixel 4; Build/QQ3A.200805.001; Cronet/58.0.2991.0)'
|
'User-Agent': 'com.ss.android.ugc.trill/2613 (Linux; U; Android 10; en_US; Pixel 4; Build/QQ3A.200805.001; Cronet/58.0.2991.0)'
|
||||||
}
|
}
|
||||||
|
# 判断配置文件是否存在/Check if the configuration file exists
|
||||||
|
if os.path.exists('config.ini'):
|
||||||
self.config = configparser.ConfigParser()
|
self.config = configparser.ConfigParser()
|
||||||
self.config.read('config.ini', encoding='utf-8')
|
self.config.read('config.ini', encoding='utf-8')
|
||||||
# 判断是否使用代理
|
# 判断是否使用代理
|
||||||
@ -81,6 +84,9 @@ class Scraper:
|
|||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
self.proxies = None
|
self.proxies = None
|
||||||
|
# 配置文件不存在则不使用代理/If the configuration file does not exist, do not use the proxy
|
||||||
|
else:
|
||||||
|
self.proxies = None
|
||||||
# 针对Windows系统的异步事件规则/Asynchronous event rules for Windows systems
|
# 针对Windows系统的异步事件规则/Asynchronous event rules for Windows systems
|
||||||
if platform.system() == 'Windows':
|
if platform.system() == 'Windows':
|
||||||
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
|
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user