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

feat: implement Next Song retrieval and parsing #35

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

mcanam
Copy link

@mcanam mcanam commented Jul 9, 2024

This method comes from youtube-music-api to get a list of songs in the UP NEXT tab.

  • Add getNext() method in YTMusic class
  • Add NextResult type in types.ts
  • Create new parser NextParser class
  • Adds playlistId and params fields to the SongDetailed and VideoDetailed types and updates the data returned in some methods to reflect these changes
Test Results
bun test v1.1.18 (5a0b9352)

src/tests/core.spec.ts:
✓ Query: Lilac > Search suggestions [369.11ms]
✓ Query: Lilac > Search Songs [683.22ms]
✓ Query: Lilac > Search Videos [548.53ms]
✓ Query: Lilac > Search Artists [506.44ms]
✓ Query: Lilac > Search Albums [676.66ms]
✓ Query: Lilac > Search Playlists [472.35ms]
✓ Query: Lilac > Search All [552.58ms]
✓ Query: Lilac > Get Next [863.58ms]
✓ Query: Lilac > Get lyrics of the first song result [801.04ms]
✓ Query: Lilac > Get details of the first song result [979.70ms]
✓ Query: Lilac > Get details of the first video result [802.75ms]
✓ Query: Lilac > Get details of the first artist result [772.81ms]
✓ Query: Lilac > Get the songs of the first artist result [2409.16ms]
✓ Query: Lilac > Get the albums of the first artist result [954.01ms]
✓ Query: Lilac > Get details of the first album result [804.46ms]
✓ Query: Lilac > Get details of the first playlist result [656.16ms]
✓ Query: Lilac > Get the videos of the first playlist result [768.51ms]
✓ Query: Weekend > Search suggestions [160.46ms]
✓ Query: Weekend > Search Songs [669.77ms]
✓ Query: Weekend > Search Videos [542.16ms]
✓ Query: Weekend > Search Artists [683.79ms]
✓ Query: Weekend > Search Albums [603.01ms]
✓ Query: Weekend > Search Playlists [615.39ms]
✓ Query: Weekend > Search All [685.32ms]
✓ Query: Weekend > Get Next [646.49ms]
✓ Query: Weekend > Get lyrics of the first song result [817.00ms]
✓ Query: Weekend > Get details of the first song result [946.69ms]
✓ Query: Weekend > Get details of the first video result [802.54ms]
✓ Query: Weekend > Get details of the first artist result [838.22ms]
✓ Query: Weekend > Get the songs of the first artist result [2237.54ms]
✓ Query: Weekend > Get the albums of the first artist result [1080.17ms]
✓ Query: Weekend > Get details of the first album result [751.35ms]
✓ Query: Weekend > Get details of the first playlist result [824.91ms]
✓ Query: Weekend > Get the videos of the first playlist result [1098.36ms]
✓ Query: Eill > Search suggestions [111.23ms]
✓ Query: Eill > Search Songs [767.89ms]
✓ Query: Eill > Search Videos [569.02ms]
✓ Query: Eill > Search Artists [712.98ms]
✓ Query: Eill > Search Albums [555.77ms]
✓ Query: Eill > Search Playlists [396.92ms]
✓ Query: Eill > Search All [595.76ms]
✓ Query: Eill > Get Next [509.68ms]
✓ Query: Eill > Get lyrics of the first song result [799.23ms]
✓ Query: Eill > Get details of the first song result [890.07ms]
✓ Query: Eill > Get details of the first video result [760.93ms]
✓ Query: Eill > Get details of the first artist result [841.71ms]
✓ Query: Eill > Get the songs of the first artist result [1841.29ms]
✓ Query: Eill > Get the albums of the first artist result [1236.95ms]
✓ Query: Eill > Get details of the first album result [876.98ms]
✓ Query: Eill > Get details of the first playlist result [656.01ms]
✓ Query: Eill > Get the videos of the first playlist result [1063.01ms]
✓ Query: Eminem > Search suggestions [110.57ms]
✓ Query: Eminem > Search Songs [543.26ms]
✓ Query: Eminem > Search Videos [540.89ms]
✓ Query: Eminem > Search Artists [552.93ms]
✓ Query: Eminem > Search Albums [553.60ms]
✓ Query: Eminem > Search Playlists [677.39ms]
✓ Query: Eminem > Search All [639.54ms]
✓ Query: Eminem > Get Next [829.32ms]
✓ Query: Eminem > Get lyrics of the first song result [734.23ms]
✓ Query: Eminem > Get details of the first song result [781.16ms]
✓ Query: Eminem > Get details of the first video result [856.85ms]
✓ Query: Eminem > Get details of the first artist result [922.05ms]
✓ Query: Eminem > Get the songs of the first artist result [2683.68ms]
✓ Query: Eminem > Get the albums of the first artist result [1280.90ms]
✓ Query: Eminem > Get details of the first album result [783.78ms]
✓ Query: Eminem > Get details of the first playlist result [833.31ms]
✓ Query: Eminem > Get the videos of the first playlist result [910.74ms]
✓ Query: Lisa Hannigan > Search suggestions [195.81ms]
✓ Query: Lisa Hannigan > Search Songs [539.98ms]
✓ Query: Lisa Hannigan > Search Videos [481.86ms]
✓ Query: Lisa Hannigan > Search Artists [568.36ms]
✓ Query: Lisa Hannigan > Search Albums [569.34ms]
✓ Query: Lisa Hannigan > Search Playlists [623.87ms]
✓ Query: Lisa Hannigan > Search All [553.31ms]
✓ Query: Lisa Hannigan > Get Next [388.62ms]
✓ Query: Lisa Hannigan > Get lyrics of the first song result [853.25ms]
✓ Query: Lisa Hannigan > Get details of the first song result [693.51ms]
✓ Query: Lisa Hannigan > Get details of the first video result [716.74ms]
✓ Query: Lisa Hannigan > Get details of the first artist result [777.36ms]
✓ Query: Lisa Hannigan > Get the songs of the first artist result [1961.72ms]
✓ Query: Lisa Hannigan > Get the albums of the first artist result [1204.07ms]
✓ Query: Lisa Hannigan > Get details of the first album result [683.62ms]
✓ Query: Lisa Hannigan > Get details of the first playlist result [638.46ms]
✓ Query: Lisa Hannigan > Get the videos of the first playlist result [731.99ms]
Issues: []

85 pass
0 fail
Ran 85 tests across 1 files. [68.17s]

mcanam added 2 commits July 9, 2024 20:19
This method comes from youtube-music-api to get a list of songs in the UP NEXT tab.

- Add getNext() method in YTMusic class
- Add NextResult type in types.ts
- Create new parser NextParser class
…d and VideoDetailed types and updates the data returned in some methods to reflect these changes.

This data can be used for paramater in the getNext() method.
@zS1L3NT
Copy link
Owner

zS1L3NT commented Jul 10, 2024

Modifying the SongParser and VideoParser has broken the tests on my end... trying to figure out what the playlistId and params even are in the first place, especially since playlistId does not look like a real YouTube Music playlist id

@mcanam
Copy link
Author

mcanam commented Jul 10, 2024

Modifying the SongParser and VideoParser has broken the tests on my end...

i tried to run the test on the main branch and it also failed. i think there is a data change from the API again.

trying to figure out what the playlistId and params even are in the first place, especially since playlistId does not look like a real YouTube Music playlist id

yes you are right, playlistId is not the real id of playlist in yt music but the value of query params list as in this url
https://music.youtube.com/watch?v=hjpF8ukSrvk&list=RDAMVMhjpF8ukSrvk

my bad, maybe the name needs to be changed so it's not ambiguous.

@zS1L3NT
Copy link
Owner

zS1L3NT commented Jul 10, 2024

Also I added some workflows to make sure the tests work properly so let's try to get this to work!

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