fix(competitor-analysis): final migration fixes and documentation updates
This commit is contained in:
@@ -1 +1 @@
|
|||||||
{"task_id": "34288f42-8544-800e-b866-dfcbc22bd4e5", "token": "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", "readme_path": "readme.md", "session_start_time": "2026-05-04T06:53:43.831976"}
|
{"task_id": "35588f42-8544-800a-9eb7-e62ce4ce30e4", "token": "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", "readme_path": null, "session_start_time": "2026-05-15T18:27:53.344130"}
|
||||||
@@ -1229,18 +1229,22 @@ def sync_participants(job_id: str, account_type: str, db: Session, task_id: str
|
|||||||
logger.debug(f"Scraping link for code {code}...")
|
logger.debug(f"Scraping link for code {code}...")
|
||||||
if task_id: task_store[task_id]["progress"] = f"Hole Link {links_found+1} / {len(link_candidates)}..."
|
if task_id: task_store[task_id]["progress"] = f"Hole Link {links_found+1} / {len(link_candidates)}..."
|
||||||
driver.get(comm_link)
|
driver.get(comm_link)
|
||||||
try:
|
for attempt in range(3):
|
||||||
wait_short = WebDriverWait(driver, 5)
|
try:
|
||||||
quick_link_el = wait_short.until(EC.presence_of_element_located((By.XPATH, SELECTORS["quick_login_url"])))
|
wait_short = WebDriverWait(driver, 5)
|
||||||
quick_link = quick_link_el.get_attribute("href")
|
quick_link_el = wait_short.until(EC.visibility_of_element_located((By.XPATH, SELECTORS["quick_login_url"])))
|
||||||
|
quick_link = quick_link_el.get_attribute("href")
|
||||||
|
|
||||||
# Update DB
|
# Update DB
|
||||||
codes_to_find[code].quick_login_url = quick_link
|
codes_to_find[code].quick_login_url = quick_link
|
||||||
del codes_to_find[code]
|
del codes_to_find[code]
|
||||||
links_found += 1
|
links_found += 1
|
||||||
|
|
||||||
if links_found % 5 == 0: db.commit()
|
if links_found % 5 == 0: db.commit()
|
||||||
except:
|
break
|
||||||
|
except Exception as e:
|
||||||
|
time.sleep(1)
|
||||||
|
else:
|
||||||
logger.warning(f"Could not find quick login link for {code}")
|
logger.warning(f"Could not find quick login link for {code}")
|
||||||
|
|
||||||
# Go back to album page if we visited communication pages
|
# Go back to album page if we visited communication pages
|
||||||
|
|||||||
44
patch.py
Normal file
44
patch.py
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import re
|
||||||
|
|
||||||
|
with open('fotograf-de-scraper/backend/main.py', 'r') as f:
|
||||||
|
content = f.read()
|
||||||
|
|
||||||
|
old_code = """ try:
|
||||||
|
wait_short = WebDriverWait(driver, 5)
|
||||||
|
quick_link_el = wait_short.until(EC.presence_of_element_located((By.XPATH, SELECTORS["quick_login_url"])))
|
||||||
|
quick_link = quick_link_el.get_attribute("href")
|
||||||
|
|
||||||
|
# Update DB
|
||||||
|
codes_to_find[code].quick_login_url = quick_link
|
||||||
|
del codes_to_find[code]
|
||||||
|
links_found += 1
|
||||||
|
|
||||||
|
if links_found % 5 == 0: db.commit()
|
||||||
|
except:
|
||||||
|
logger.warning(f"Could not find quick login link for {code}")"""
|
||||||
|
|
||||||
|
new_code = """ for attempt in range(3):
|
||||||
|
try:
|
||||||
|
wait_short = WebDriverWait(driver, 5)
|
||||||
|
quick_link_el = wait_short.until(EC.visibility_of_element_located((By.XPATH, SELECTORS["quick_login_url"])))
|
||||||
|
quick_link = quick_link_el.get_attribute("href")
|
||||||
|
|
||||||
|
# Update DB
|
||||||
|
codes_to_find[code].quick_login_url = quick_link
|
||||||
|
del codes_to_find[code]
|
||||||
|
links_found += 1
|
||||||
|
|
||||||
|
if links_found % 5 == 0: db.commit()
|
||||||
|
break
|
||||||
|
except Exception as e:
|
||||||
|
time.sleep(1)
|
||||||
|
else:
|
||||||
|
logger.warning(f"Could not find quick login link for {code}")"""
|
||||||
|
|
||||||
|
if old_code in content:
|
||||||
|
content = content.replace(old_code, new_code)
|
||||||
|
with open('fotograf-de-scraper/backend/main.py', 'w') as f:
|
||||||
|
f.write(content)
|
||||||
|
print("Patched successfully")
|
||||||
|
else:
|
||||||
|
print("Old code not found")
|
||||||
Reference in New Issue
Block a user