fix(xtapes): ponawianie listy REST przy chwilowym bledzie proxy
Some checks are pending
Backend tests / test (push) Waiting to run

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
goon-foss 2026-10-15 21:22:39 +02:00
parent b3938abf06
commit 34138ff82f

View file

@ -27,6 +27,7 @@ import html as html_mod
import json
import logging
import re
import time
from collections.abc import Iterator
from datetime import datetime
from urllib.parse import urlparse
@ -130,11 +131,20 @@ class XtapesConnector(BaseMovieConnector):
# Tylko nowsze od ostatniego udanego przebiegu: strona filmu idzie przez proxy
# (~9 s), a 3 pelne strony REST to 90 filmow, ponad limit 6 min na konektor.
url += f"&after={since.strftime('%Y-%m-%dT%H:%M:%S')}"
posts = None
for attempt in range(3):
try:
posts = json.loads(self._get(url).text)
break
except Exception as e:
# Za ostatnia strona WP oddaje 400 (rest_post_invalid_page_number).
log.info("%s REST page=%d: %s", self.name, page, e)
# Za ostatnia strona WP oddaje 400 (rest_post_invalid_page_number), to koniec.
# Inne bledy (proxy, Cloudflare) bywaja chwilowe: pierwszy pelny przebieg
# 2026-10-15 skonczyl sie "sukcesem" z zerem filmow po jednym takim bledzie.
if "400 for" in str(e):
return
log.warning("%s REST page=%d proba %d: %s", self.name, page, attempt + 1, e)
time.sleep(3)
if posts is None:
return
if not isinstance(posts, list) or not posts:
return