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

Views and duration are incorrectly parsed when searching for a video. #149

Closed
bee395 opened this issue Jan 11, 2021 · 9 comments
Closed
Labels
bug Something isn't working

Comments

@bee395
Copy link

bee395 commented Jan 11, 2021

Environment

  • **System OS: Linux

  • **Python Version: 3.9.1

  • installed from master: cb1f58d

Steps to Reproduce

  1. Create a unit test with results = youtube.search('Adele - Send My Love (To Your New Lover)', filter='videos')
    print(results)
  2. The first to last result is an incorrect parsed video.
    When I get the details of the video through youtube.get_song('wXrZOFRikOY') it correctly returns '... viewCount': '6707', 'author': 'Julie Dowd', ...

Output

...
{'resultType': 'video', 'videoId': 'wXrZOFRikOY', 'title': 'SEND MY LOVE (TO YOUR NEW LOVER) - ADELE - 1 Hour Loop With Lyrics', 'artists': [{'name': 'Julie Dowd', 'id': 'UCB1NyHU7hBR4R_6F1LazkVg'}], 'views': 'Julie', 'duration': '6.7K views', 'thumbnails': [{'url': 'https://i.ytimg.com/vi/wXrZOFRikOY/sddefault.jpg?sqp=-oaymwEWCJADEOEBIAQqCghqEJQEGHgg6AJIWg&rs=AMzJL3lSnjwY_iucJje6idGTFy7zh0ugZg', 'width': 400, 'height': 225}]}
...

Other information

The problem is probably that the video is a "premiere" video
It looks like the get_item_text on parsers/browsing.py:74 takes the wrong columns

@sigma67
Copy link
Owner

sigma67 commented Jan 12, 2021

Unfortunately I cannot reproduce this. Can you show a screenshot of the Web UI where this song is different from the others? Was it a time-limited thing, since you mentioned premiere?

@bee395
Copy link
Author

bee395 commented Jan 12, 2021

I think that a premiere video is a planned video with a countdown and a livechat, during the video
After the premiere ended, there shouldn't be anything special about the video

Screenshot of the video (it's in Dutch, but it should also show in other languages):
image
Link to the video: https://www.youtube.com/watch?v=wXrZOFRikOY

@sigma67
Copy link
Owner

sigma67 commented Jan 12, 2021

Sorry if I wasn't clear, I meant the YouTube Music search page, not actual YouTube page. I found the title you mentioned now, it seems to be missing duration, which is unusual.

@sigma67 sigma67 added the bug Something isn't working label Jan 12, 2021
@bee395
Copy link
Author

bee395 commented Jan 12, 2021

Ah sorry, my bad. I wasn't aware that Youtube Music has a different Web interface.

@bee395
Copy link
Author

bee395 commented Jan 14, 2021

Today, after I pulled the newest version from master, I tried some new songs, and now I the view count is incorrectly parsed for another song
youtube.search('Young Franco - Miss You', filter='videos') returns a result containing:

...
{'resultType': 'video', 'videoId': '4mUJaWqWb_k', 'title': 'Juice', 'artists': [{'name': 'Pell', 'id': 'UCZGko_JjZgHZlLGbm5itUCw'}, {'name': 'Young Franco', 'id': 'UCvOSkOoJ_5NHQE0XE9HhpZw'}], 'views': 'Young', 'duration': '157K views', 'thumbnails': [{'url': 'https://i.ytimg.com/vi/4mUJaWqWb_k/sddefault.jpg?sqp=-oaymwEWCJADEOEBIAQqCghqEJQEGHgg6AJIWg&rs=AMzJL3nPonplHqd_wAPj-1fxJIL5A0iyNQ', 'width': 400, 'height': 225}]}
...

youtube.get_song('4mUJaWqWb_k') returns the output with the correct amount of views and duration.

The song on Youtube Music: https://music.youtube.com/watch?v=4mUJaWqWb_k&list=RDAMVM4mUJaWqWb_k

@sigma67
Copy link
Owner

sigma67 commented Jan 14, 2021

Apologies, I didn't consider the multiple artist case. I have tested both search terms you mentioned locally. Can you retry with latest master and some different search terms?

@bee395
Copy link
Author

bee395 commented Jan 14, 2021

Thanks for your incredible fast responses. That song is now working. But unfortunately I found another song that doesn't work properly:

Namely when I search for Alec Benjamin - Stan - Recorded at Spotify Studios NYC:

...
{'resultType': 'video', 'videoId': 'nFQ4kGbIJa0', 'title': 'Supernova Girl', 'artists': [{'name': 'Tim White', 'id': None}], 'views': 'Ryan', 'duration': '790 views', 'thumbnails': [{'url': 'https://i.ytimg.com/vi/nFQ4kGbIJa0/sddefault.jpg?sqp=-oaymwEWCJADEOEBIAQqCghqEJQEGHgg6AJIWg&rs=AMzJL3mPtskwbVr0z5xNzi5NSCpD1EQgMw', 'width': 400, 'height': 225}]}
...

YT Music link: https://music.youtube.com/watch?v=nFQ4kGbIJa0&list=RDAMVMnFQ4kGbIJa0

@sigma67
Copy link
Owner

sigma67 commented Jan 14, 2021

Ah yes, the tricky edge case where no artists have IDs. Already fixed it for song search, should have seen it coming. I also considered the case with no artist IDs and no duration, even thought I haven't seen it yet. I hope we've covered it all now.

@bee395
Copy link
Author

bee395 commented Jan 14, 2021

When I now search for a song with no song duration found, it returns None. So that looks good

I think that was everything. Thanks for your help 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants