Fix author and thumbnails for autogenerated playlists #251
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Template
Description
While testing FreeTubeApp/FreeTube#2903, we noticed that autogenerated playlists like https://m.youtube.com/playlist?list=RDCLAK5uy_nxNaxtS5HwGabWeGHsAADVA4KKl5l12eQ are partially supported by this library, with it spitting out this error:
This pull request fixes that casting issue and also fixes the author field on the playlist being empty, the only missing bit of information is the thumbnails for the playlist author (empty array), although YouTube doesn't show it either, so I think that's fine.
The changes in this pull request work well with this FreeTube pull request FreeTubeApp/FreeTube#2903 and were tested with it. Interestingly when I wanted to add a unit test to this library to test the autogenerated playlist, I ran into this error:
Which is weird, because YouTube will happily return the playlist when the library is used inside of FreeTube. If I had to guess the differences are probably user agent related. Happy to add a unit test if there is a way to make it work in the unit test.
Here are the relevant lines of code in FreeTube, yes we don't have the most standard setup for YouTube.js 馃槵, see FreeTubeApp/FreeTube#2855 for some of the reasoning behind our setup. We also disable CORS entirely in Electron, so that we don't have to deal with that.
_scripts/webpack.renderer.config.js | lines 129-141
src/renderer/helpers/api/local.js | lines 18-43
src/main/index.js | lines 175-183
Type of change
Checklist: