Skip to content

Commit

Permalink
fix: ensure url is not a video when determining if we are in a redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-miller committed Jan 7, 2025
1 parent 5be1b3b commit a250eb2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions brozzler/ydl.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,17 @@ class _YoutubeDL(yt_dlp.YoutubeDL):
def process_ie_result(self, ie_result, download=True, extra_info=None):
if extra_info is None:
extra_info = {}
if "redirect_count" in extra_info:
if (
"redirect_count" in extra_info
and "_type" in ie_result
and ie_result.get("_type") in ("url", "url_transparent")
):
self.logger.info(
f"Following redirect URL: {ie_result['url']} redirect_count: {extra_info['redirect_count']}"
)
extra_info["redirect_count"] = 1 + extra_info.get("redirect_count", 0)
extra_info["redirect_count"] = 1 + extra_info.get("redirect_count", 0)
else:
extra_info["redirect_count"] = 0
if extra_info["redirect_count"] > YTDLP_MAX_REDIRECTS:
raise ExtractorError(
f"Too many redirects for URL: {ie_result['url']}",
Expand Down

0 comments on commit a250eb2

Please sign in to comment.