Compare commits
2 Commits
603ad33ceb
...
97d00d04ab
Author | SHA1 | Date | |
---|---|---|---|
97d00d04ab | |||
4d588f3db6 |
44
report.py
44
report.py
@ -22,24 +22,24 @@ while True:
|
|||||||
now = int(time.time())
|
now = int(time.time())
|
||||||
|
|
||||||
# 处理主流程
|
# 处理主流程
|
||||||
if now - last_main_run >= MAIN_INTERVAL:
|
# if now - last_main_run >= MAIN_INTERVAL:
|
||||||
last_main_run = now
|
# last_main_run = now
|
||||||
lis = db.get_report_video()
|
# lis = db.get_report_video()
|
||||||
if len(lis) > 0:
|
# if len(lis) > 0:
|
||||||
for li in lis:
|
# for li in lis:
|
||||||
logger.logger.info(f"name:{li['name_title']},link:{li['link']} ")
|
# logger.logger.info(f"name:{li['name_title']},link:{li['link']} ")
|
||||||
try:
|
# try:
|
||||||
info, report_id, status, report_ts = d.process_ticket(li['name_title'], li['link'])
|
# info, report_id, status, report_ts = d.process_ticket(li['name_title'], li['link'])
|
||||||
subsequent_status = k.get(status, 1)
|
# subsequent_status = k.get(status, 1)
|
||||||
db.update_fight_record_status(
|
# db.update_fight_record_status(
|
||||||
li['id'], report_id, 2, f"http://123.58.197.91:5000/image/{info}",
|
# li['id'], report_id, 2, f"http://123.58.197.91:5000/image/{info}",
|
||||||
report_ts, subsequent_status
|
# report_ts, subsequent_status
|
||||||
)
|
# )
|
||||||
db.flush()
|
# db.flush()
|
||||||
except Exception as e:
|
# except Exception as e:
|
||||||
logger.logger.error(f"ID:{li['id']}, e:{e}")
|
# logger.logger.error(f"ID:{li['id']}, e:{e}")
|
||||||
db.update_fight_record_status(li['id'], 0, 3, str(e))
|
# db.update_fight_record_status(li['id'], 0, 3, str(e))
|
||||||
time.sleep(60) # 出错延迟
|
# time.sleep(60) # 出错延迟
|
||||||
|
|
||||||
|
|
||||||
if now - last_subsequent_run >= SUBSEQUENT_INTERVAL:
|
if now - last_subsequent_run >= SUBSEQUENT_INTERVAL:
|
||||||
@ -50,13 +50,13 @@ while True:
|
|||||||
rs_id = li['id']
|
rs_id = li['id']
|
||||||
r_id = li['report_id']
|
r_id = li['report_id']
|
||||||
logger.logger.info(f"subsequent id:{rs_id},report_id:{r_id} ")
|
logger.logger.info(f"subsequent id:{rs_id},report_id:{r_id} ")
|
||||||
try:
|
# try:
|
||||||
subsequent_status, info = d.report_follow_up(r_id)
|
subsequent_status, info = d.report_follow_up(r_id)
|
||||||
db.update_subsequent_status_by_id(
|
db.update_subsequent_status_by_id(
|
||||||
rs_id, subsequent_status, f"http://123.58.197.91:5000/image/{info}"
|
rs_id, subsequent_status, f"http://123.58.197.91:5000/image/{info}"
|
||||||
)
|
)
|
||||||
except Exception as e:
|
# except Exception as e:
|
||||||
logger.logger.error(f"ID:{rs_id}, e:{e}")
|
# logger.logger.error(f"ID:{rs_id}, e:{e}")
|
||||||
db.update_subsequent_status_by_id(rs_id, 1, str(e))
|
# db.update_subsequent_status_by_id(rs_id, 1, str(e))
|
||||||
time.sleep(5) # 避免频繁请求
|
time.sleep(5) # 避免频繁请求
|
||||||
time.sleep(5)
|
time.sleep(5)
|
@ -104,7 +104,7 @@ class DailymotionClient:
|
|||||||
proxy = None
|
proxy = None
|
||||||
else:
|
else:
|
||||||
proxy={'server': 'http://127.0.0.1:7890'}
|
proxy={'server': 'http://127.0.0.1:7890'}
|
||||||
|
logger.info(f"Launching DailymotionClient with headless={self.headless}, proxy={proxy}")
|
||||||
self._pw = sync_playwright().start()
|
self._pw = sync_playwright().start()
|
||||||
self.browser: Browser = self._pw.chromium.launch(
|
self.browser: Browser = self._pw.chromium.launch(
|
||||||
headless=self.headless,
|
headless=self.headless,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user