Skip to content

Commit

Permalink
fix title bug
Browse files Browse the repository at this point in the history
if no episodeGermanTitle found use episodeEnglishTitle
  • Loading branch information
phoenixthrush authored Apr 19, 2024
1 parent 0537516 commit 2a57796
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,14 @@ def get_content_providers(url_with_episode): # pylint: disable=too-many-locals
host_series_title = soup.find('div', class_='hostSeriesTitle')
series_title = host_series_title.text.strip() if host_series_title else None

try:
episode_title = soup.find("span", class_="episodeGermanTitle").text
except AttributeError:
episode_title = None

if episode_title is None:
episode_title = soup.find("small", class_="episodeEnglishTitle").text

language_div = soup.find('div', class_='changeLanguageBox')

if language_div:
Expand Down Expand Up @@ -156,7 +164,7 @@ def get_content_providers(url_with_episode): # pylint: disable=too-many-locals
filename=None,
hls_link=None,
episodes=None,
episode_title=soup.find("span", class_="episodeGermanTitle").text
episode_title=episode_title
)
else:
print("No watchEpisode link found within generateInlinePlayer div.")
Expand Down Expand Up @@ -266,7 +274,7 @@ def download_with_ytdlp(url, series):

os = platform()
if os == "Windows":
makedirs(f"Downloads\{series.series}", exist_ok=True)
makedirs(f"Downloads\\{series.series}", exist_ok=True)
else:
makedirs(f"Downloads/{series.series}", exist_ok=True)

Expand Down

0 comments on commit 2a57796

Please sign in to comment.