From 11bd09e2817846428a5bc3c082f85656b1b3de3c Mon Sep 17 00:00:00 2001 From: Franklin-F Date: Fri, 6 Jun 2025 22:23:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=8D=95=E6=9D=A1=E4=B8=BE=E6=8A=A5?= =?UTF-8?q?=E8=AF=8D,=E4=B8=BE=E6=8A=A5=E6=97=B6=E9=9A=945=E5=88=86?= =?UTF-8?q?=E9=92=9F,=E6=88=90=E5=8A=9F=E5=86=99=E5=85=A5=E6=88=AA?= =?UTF-8?q?=E5=9B=BE=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DB.py | 2 +- report.py | 30 ++++++++++-------------------- report_video.py | 13 +++++++------ 3 files changed, 18 insertions(+), 27 deletions(-) diff --git a/DB.py b/DB.py index a703c38..a1837f0 100644 --- a/DB.py +++ b/DB.py @@ -321,7 +321,7 @@ class DBVidcon: sh_dm_fight_records WHERE status = 1 - LIMIT 40 + LIMIT 10 """ self.cursor.execute(sql) return self.cursor.fetchall() diff --git a/report.py b/report.py index 3c184bd..4b5397c 100644 --- a/report.py +++ b/report.py @@ -8,28 +8,18 @@ db = DBVidcon() d = DailymotionClient() while True: - ids = [] - name_title = [] - link = [] lis = db.get_report_video() if len(lis) == 0: - time.sleep(20) + time.sleep(60 * 5) else: - for li in lis: logger.logger.info(f"name:{li['name_title']},link:{li['link']} ") - name_title.append(li['name_title']) - link.append(li['link']) - ids.append(li['id']) - time.sleep(30 * 60) - 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: - 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) + try: + info = d.process_ticket(li['name_title'], li['link']) + db.update_fight_record_status(li['id'], 2, info) + db.flush() + time.sleep(5 * 60) + except Exception as e: + logger.logger.error(f"ID:{li['id']}, e:{e}") + db.update_fight_record_status(li['id'], 3, str(e)) + time.sleep(1 * 60) diff --git a/report_video.py b/report_video.py index 6fd1846..d7f54ca 100644 --- a/report_video.py +++ b/report_video.py @@ -87,7 +87,7 @@ class DailymotionClient: EMAIL = "copyright@qiyi.com" PASSWORD = "ppsIQIYI2018@" - def __init__(self, headless: bool = True): + def __init__(self, headless: bool = False): self.email = self.EMAIL self.password = self.PASSWORD self.headless = headless @@ -96,7 +96,7 @@ class DailymotionClient: self._pw = sync_playwright().start() self.browser: Browser = self._pw.chromium.launch( 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( user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) " @@ -187,12 +187,13 @@ class DailymotionClient: @require_login 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. 1) please help remove these videos 2) The drama series titles are {} - """.format(titles) - links = '\r\n'.join(link) + """.format(title) + # likls = ["\"" + l + "\"" for l in link] + # links = ','.join(likls) if self.page.query_selector("div.cf-turnstile[data-sitekey]"): ok = solve_turnstile_capsolver(self.page) if not ok: @@ -221,7 +222,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(links) + self.page.get_by_label("Please indicate the URL of the video you would like to report.").fill(link) time.sleep(1) self.page.get_by_label("Description").nth(1).fill(description) time.sleep(1)