Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: mediafusion sometimes throwing error when parsing response #844

Merged
merged 1 commit into from
Nov 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/program/services/scrapers/mediafusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,18 @@ def scrape(self, item: MediaItem) -> tuple[Dict[str, str], int]:
torrents: Dict[str, str] = {}

for stream in response.data.streams:
raw_title = stream.description.split("\n💾")[0].replace("📂 ", "")
info_hash = stream.url.split("?info_hash=")[1]
description_split = stream.description.split("\n💾")
if len(description_split) < 2:
logger.warning(f"Invalid stream description: {stream.description}")
continue
raw_title = description_split[0].replace("📂 ", "")

url_split = stream.url.split("?info_hash=")
if len(url_split) < 2:
logger.warning(f"Invalid stream URL: {stream.url}")
continue
info_hash = url_split[1]

if not info_hash or not raw_title:
continue

Expand Down
Loading