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 'secondSubtitle' KeyError for some playlists #399

Merged
merged 2 commits into from
Jun 25, 2023

Conversation

MarvinSchenkel
Copy link
Contributor

@MarvinSchenkel MarvinSchenkel commented Jun 17, 2023

This PR fixes parsing of playlists that do not have a ['secondSubtitle']['runs'] property. An example of this play list is https://music.youtube.com/playlist?list=RDATgXd-

playlist['duration'] = None if not has_duration else second_subtitle_runs[has_views + has_duration]['text']
song_count = second_subtitle_runs[has_views + 0]['text'].split(" ")
song_count = to_int(song_count[0]) if len(song_count) > 1 else 0
if 'runs' in header['secondSubtitle']:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That will lead to missing views and duration keys. Can you add default value None for these?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Added the default values :-)

@sigma67 sigma67 merged commit e26335e into sigma67:master Jun 25, 2023
sigma67 added a commit that referenced this pull request Jul 2, 2023
sigma67 pushed a commit that referenced this pull request Jul 14, 2024
* Fix 'secondSubtitle' KeyError for some playlists

* Feedback.
sigma67 added a commit that referenced this pull request Jul 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants