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

View File

@ -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)

View File

@ -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)