forked from erma0/douyin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmonitor.py
40 lines (31 loc) · 933 Bytes
/
monitor.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
import time
from typing import List
import schedule
from browser import Browser
from spider import Douyin
edge = Browser()
def start() -> None:
print('开始一轮')
with open('url.txt', 'r', encoding='utf-8') as f:
lines: List[str] = f.readlines()
for url in lines:
a = Douyin(edge.context, url)
a.run()
if a.results:
a.download()
print('结束一轮')
def main():
print('监控启动')
schedule.every(10).minutes.do(start)
# schedule.every().hour.do(start)
# schedule.every().day.at("10:30").do(start)
# schedule.every().monday.do(start)
# schedule.every().wednesday.at("13:15").do(start)
# schedule.every().day.at("12:42", "Europe/Amsterdam").do(start)
# schedule.every().minute.at(":17").do(start)
schedule.run_all()
while True:
schedule.run_pending()
time.sleep(1)
if __name__ == "__main__":
main()