forked from kekewind/Kaleidoscope
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDouyinDetect.py
46 lines (40 loc) · 1.32 KB
/
DouyinDetect.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
39
40
41
42
43
44
45
46
import time
from retrying import retry
from selenium.webdriver.common.by import By
import DouyinUtils
import MyUtils
import Maintainace
# region
allusers = DouyinUtils.allusers
allpieces = DouyinUtils.allpieces
readytodownload = DouyinUtils.readytodownload
ExceptionUser = DouyinUtils.exceptuser
history = DouyinUtils.history
# endregion
@retry(retry_on_exception=MyUtils.retry)
def main():
allusers.rollback()
global host,page
page=MyUtils.Chrome()
host=MyUtils.Chrome()
while True:
useruid = list(allusers.get()[0].keys())[0]
host.get(f'https://m.douyin.com/share/user/{useruid}')
MyUtils.sleep(2)
DouyinUtils.滑块验证([host])
DouyinUtils.跳转验证([host])
DouyinUtils.登录验证([host])
try:
author,urls,=DouyinUtils.hostdata([host],tab='作品')
except:
MyUtils.warn('用户异常。')
continue
DouyinUtils.addauthor(useruid, author)
MyUtils.delog(f' ------转到{author}的主页-----',useruid)
for videourl in urls:
DouyinUtils.load([page], videourl, author=author)
while readytodownload.length() > DouyinUtils.maxready:
MyUtils.log('下载队列已满。Detect 等待中...')
time.sleep(10)
if __name__ == '__main__':
main()