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

match.py crashes on privated videos #58

Closed
hscasn opened this issue May 28, 2023 · 0 comments
Closed

match.py crashes on privated videos #58

hscasn opened this issue May 28, 2023 · 0 comments

Comments

@hscasn
Copy link

hscasn commented May 28, 2023

match.py iterates through the results from YouTube and scores them. However, if a privated video is fed to it, it will crash.

This happened to me when I was trying to import All My Loving - The Beetles. I got the following response from YouTube:

{'category': 'More from YouTube', 'resultType': 'video', 'title': None, 'videoId': 'VadsG2xoHHE', 'videoType': None, 'duration': None, 'year': None, 'artists': [], 'thumbnails': [{'url': 'https://i.ytimg.com/vi/VadsG2xoHHE/mqdefault.jpg', 'width': 0, 'height': 0}]}

Because the video does not have a title, match.py crashes on this line:

https://github.com/sigma67/spotify_to_ytmusic/blob/master/spotify_to_ytmusic/match.py#L27

A simple workaround is to add a continue to ignore the video. I tried this, and it worked:

if ytm["resultType"] == "video":
    if not title:
        # If the video has been made private, it will not have a title
         continue
    else:
        title_split = title.split("-")
        if len(title_split) == 2:
            title = title_split[1]
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

No branches or pull requests

1 participant