fix: 增加数据库查询限制并优化报告处理逻辑

This commit is contained in:
晓丰 2025-06-05 23:23:14 +08:00
parent 6260f8b69a
commit c7c5b1b078
3 changed files with 24 additions and 11 deletions

2
DB.py
View File

@ -321,7 +321,7 @@ class DBVidcon:
sh_dm_fight_records
WHERE
status = 1
LIMIT 10
LIMIT 40
"""
self.cursor.execute(sql)
return self.cursor.fetchall()

View File

@ -3,21 +3,32 @@ import time
from DB import DBVidcon, DBSA
from report_video import DailymotionClient
import logger
db = DBVidcon()
d = DailymotionClient()
while True:
ids = []
name_title = []
link = []
lis = db.get_report_video()
if len(lis) == 0:
time.sleep(20)
else:
for li in lis:
try:
logger.logger.info(f"name:{li['name_title']},link:{li['link']} ")
info = d.process_ticket(li['name_title'], li['link'])
logger.logger.info(f"info:{info}")
db.update_fight_record_status(li['id'], 2, info)
name_title.append(li['name_title'])
link.append(li['link'])
ids.append(li['id'])
try:
info = d.process_ticket(name_title, link)
for i in ids:
db.update_fight_record_status(i, 2, '')
db.flush()
except Exception as e:
logger.logger.error(f"ID:{li['id']}, e:{e}")
db.update_fight_record_status(li['id'],3,str(e))
for i in ids:
logger.logger.error(f"ID:{i}, e:{e}")
db.update_fight_record_status(i, 3, str(e))
time.sleep(30 * 60)

View File

@ -187,10 +187,12 @@ class DailymotionClient:
@require_login
def process_ticket(self, title, link):
titles = '\r\n'.join(title)
description = """We request that you take immediate actionto stop the infringing activity, take steps to ensure that iQIYI Content is notre-posted on, re-linked to, or otherwise available through your site. Pleaseinform us of the actions you have taken and their results.
1) please help remove these videos
2) The drama series titles are {}
""".format(title)
""".format(titles)
links = '\r\n'.join(link)
if self.page.query_selector("div.cf-turnstile[data-sitekey]"):
ok = solve_turnstile_capsolver(self.page)
if not ok:
@ -219,7 +221,7 @@ class DailymotionClient:
time.sleep(1)
self.page.get_by_label("Subject").fill("Copyright infringement Notification")
time.sleep(1)
self.page.get_by_label("Please indicate the URL of the video(s) you would like to report*").fill(link)
self.page.get_by_label("Please indicate the URL of the video(s) you would like to report*").fill(links)
time.sleep(1)
self.page.get_by_label("Description").nth(1).fill(description)
time.sleep(1)