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 sh_dm_fight_records
WHERE WHERE
status = 1 status = 1
LIMIT 10 LIMIT 40
""" """
self.cursor.execute(sql) self.cursor.execute(sql)
return self.cursor.fetchall() return self.cursor.fetchall()

View File

@ -3,21 +3,32 @@ import time
from DB import DBVidcon, DBSA from DB import DBVidcon, DBSA
from report_video import DailymotionClient from report_video import DailymotionClient
import logger import logger
db = DBVidcon() db = DBVidcon()
d = DailymotionClient() d = DailymotionClient()
while True: while True:
ids = []
name_title = []
link = []
lis = db.get_report_video() lis = db.get_report_video()
if len(lis) == 0: if len(lis) == 0:
time.sleep(20) time.sleep(20)
for li in lis: else:
try:
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']} ")
info = d.process_ticket(li['name_title'], li['link']) name_title.append(li['name_title'])
logger.logger.info(f"info:{info}") link.append(li['link'])
db.update_fight_record_status(li['id'], 2, info) 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() db.flush()
except Exception as e: except Exception as e:
logger.logger.error(f"ID:{li['id']}, e:{e}") for i in ids:
db.update_fight_record_status(li['id'],3,str(e)) 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 @require_login
def process_ticket(self, title, link): 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. 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 1) please help remove these videos
2) The drama series titles are {} 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]"): if self.page.query_selector("div.cf-turnstile[data-sitekey]"):
ok = solve_turnstile_capsolver(self.page) ok = solve_turnstile_capsolver(self.page)
if not ok: if not ok:
@ -219,7 +221,7 @@ class DailymotionClient:
time.sleep(1) time.sleep(1)
self.page.get_by_label("Subject").fill("Copyright infringement Notification") self.page.get_by_label("Subject").fill("Copyright infringement Notification")
time.sleep(1) 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) time.sleep(1)
self.page.get_by_label("Description").nth(1).fill(description) self.page.get_by_label("Description").nth(1).fill(description)
time.sleep(1) time.sleep(1)