fix:单条举报词,举报时隔5分钟,成功写入截图路径

This commit is contained in:
晓丰 2025-06-06 22:23:07 +08:00
parent f74b5b6df6
commit 11bd09e281
3 changed files with 18 additions and 27 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 40 LIMIT 10
""" """
self.cursor.execute(sql) self.cursor.execute(sql)
return self.cursor.fetchall() return self.cursor.fetchall()

View File

@ -8,28 +8,18 @@ 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(60 * 5)
else: else:
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']} ")
name_title.append(li['name_title']) try:
link.append(li['link']) info = d.process_ticket(li['name_title'], li['link'])
ids.append(li['id']) db.update_fight_record_status(li['id'], 2, info)
time.sleep(30 * 60) db.flush()
try: time.sleep(5 * 60)
info = d.process_ticket(name_title, link) except Exception as e:
for i in ids: logger.logger.error(f"ID:{li['id']}, e:{e}")
db.update_fight_record_status(i, 2, '') db.update_fight_record_status(li['id'], 3, str(e))
db.flush() time.sleep(1 * 60)
except Exception as e:
for i in ids:
logger.logger.error(f"ID:{i}, e:{e}")
db.update_fight_record_status(i, 3, str(e))
time.sleep(1 * 60)

View File

@ -87,7 +87,7 @@ class DailymotionClient:
EMAIL = "copyright@qiyi.com" EMAIL = "copyright@qiyi.com"
PASSWORD = "ppsIQIYI2018@" PASSWORD = "ppsIQIYI2018@"
def __init__(self, headless: bool = True): def __init__(self, headless: bool = False):
self.email = self.EMAIL self.email = self.EMAIL
self.password = self.PASSWORD self.password = self.PASSWORD
self.headless = headless self.headless = headless
@ -96,7 +96,7 @@ class DailymotionClient:
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,
# proxy={'server':'http://127.0.0.1:7890'} proxy={'server':'http://127.0.0.1:7890'}
) )
self.context = self.browser.new_context( self.context = self.browser.new_context(
user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) " user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
@ -187,12 +187,13 @@ class DailymotionClient:
@require_login @require_login
def process_ticket(self, title, link): def process_ticket(self, title, link):
titles = '\r\n'.join(title) # 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(titles) """.format(title)
links = '\r\n'.join(link) # likls = ["\"" + l + "\"" for l in link]
# links = ','.join(likls)
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:
@ -221,7 +222,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(links) self.page.get_by_label("Please indicate the URL of the video you would like to report.").fill(link)
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)