fix(proxy): treat 'Video unavailable' on a static route as IP-suspect

Five videos 'unavailable' on all three static IPs on 1-sep downloaded fine
through the residential proxy (proxy_usage rows 19:33-07:07): YouTube
serves a fake unavailable to IPs it dislikes, the 19-aug symptom. Blocking
the paid retry on that text would 400 real videos; a truly dead link now
costs ~3 MB to re-check instead.

Claude-Session: https://claude.ai/code/session_014i9z6mLTy978uRCfSsMfBq
This commit is contained in:
juancarlos.cavero 2026-09-02 12:37:10 +02:00
parent c20ecc69c5
commit 0ed40c3a8f
2 changed files with 12 additions and 2 deletions

View file

@ -76,13 +76,20 @@ _IP_SPECIFIC_HINTS = (
"http error 407", "http error 502", "http error 503", "proxyerror",
"tunnel connection failed", "connection reset", "timed out", "timeout",
"unable to download webpage", "unable to download api page",
# "Video unavailable" looks like a content error but is NOT reliable on
# the static pool: on 1-sep-2026 five videos "unavailable" on all three
# Decodo IPs downloaded fine through the residential proxy (proxy_usage
# rows 19:33-07:07). YouTube serves a fake unavailable to IPs it dislikes
# — the same symptom as the 19-aug server-IP ban. A truly dead link costs
# ~3 MB to re-check; a real video wrongly refused costs the job.
"video unavailable",
"available in your country", "in your country", "geo-restricted", "geoblock",
"blocked it in your country",
"remote end closed", "connection refused", "network is unreachable",
"name or service not known", "eof occurred",
)
_CONTENT_HINTS = (
"private video", "video unavailable", "has been removed", "members-only",
"private video", "has been removed", "members-only",
"join this channel", "not available on this app", "is not a valid url",
"unsupported url", "no video formats found", "premieres in", "will begin in",
"this live event", "no duration in metadata", "requested format is not available",

View file

@ -18,6 +18,9 @@ from cloud import metering, proxy_ledger
class TestStaticFailureWarrantsPaid:
def test_ip_specific_failures_do(self):
for err in ("ERROR: Sign in to confirm you're not a bot",
# fake on Decodo IPs: 5 videos "unavailable" on all three
# statics downloaded fine through the paid proxy (1-sep)
"ERROR: [youtube] BJW5gAgk4bg: Video unavailable",
"HTTP Error 403: Forbidden", "HTTP Error 429: Too Many Requests",
"ProxyError: Tunnel connection failed: 407",
"Unable to download webpage: The read operation timed out",
@ -26,7 +29,7 @@ class TestStaticFailureWarrantsPaid:
def test_content_failures_do_not(self):
for err in ("ERROR: Private video. Sign in if you've been granted access",
"ERROR: Video unavailable", "This video has been removed by the uploader",
"This video has been removed by the uploader",
"Join this channel to get access to members-only content",
"no duration in metadata", "Premieres in 3 hours",
"Unsupported URL: https://shopee.vn/product", "Sign in to confirm your age"):