NISH1001/playx

Suggest related songs

Closed this issue · 13 comments

Hey I tried selenium with chrome to scrap the youtube page and get the related songs list. It worked.
I had tried it earlier but it never was able to get the resulst

Check this code.

I'm thinking of using the above algo to run in the bg while playx plays the current song and once the songs are extracted, we will start playing them.

Do share your thoughts.

Okay. I will check the script and get back to this thread. Does it fetch multiple suggestions? Or just simply "next video"? Then how can we make it dynamic while our songs are being played (if it's pre-fetched)?

Another thing

If we do this, then we can create argument to autoplaylist thing. Something like:

For using youtube scraped information

playx --auto --youtube

For frequency-based local songs

playx --auto --count

This way we will not have to remove existing features (for now).

The script gets all the related songs available. We can run the script in the bg after the song starts playing and then add all these songs to yhe current playing list.

Yes, we can do thag --auto thing.

So I tried the script. Does the work. Let's create a module to do it seamlessly without affecting existing features.

I can make the module, lets see how to add it to playx.

@NISH1001 I think we should consider the extracted list as a playlist.

So everytime we will have a list, we will just pass it as a playlist to the player just after the song is done playing. This, I think is the easiest way to do it without making changes to the Player class.

Also we can have the song fetching script as a seperate file, that will have a simple function, that will return a list of object of youtube song containers just like the youtube playlist module does.

@deepjyoti30 will it be possible to suggest related songs indefinitely until ctrl+c? That way we can listen to songs infinitely.

@NISH1001 Actually the number of songs extracted varies everytime because of the internet(not exactly sure).
What I think is when the JS script is run by selenium, it depends how fast the internet is and accordingly number of songs are fetched.
If you use this in different songs, you'll notice in some songs, a lot of songs are suggested.

Just checked youtube page, we can do what you said I think.
We will take the user passed song as the first song and then we'll extract the next song in the list and then we'll extract another song suggested using the script on the current song. This way it'll keep going.

@deepjyoti30 so, it will be dynamic, right? More like getting the next song using the current song.

Yes, thats what it will be, but I'm not sure how good that would be.

Lets say we start with a song name Better and we extract the song Talk from the suggestions.
And then we use the song Talk to extract a song named Saturday Nights
But there'd be a real possibility that the next song we find is Better itself.

This is just for 3 songs, we are talking about an infinite loop until the user presses Ctrl+C which means a lot of songs will be played again and again.

So we have to ignore repeated songs I guess for now. (More like a cheap trick :D).
Is there any chance the next "video" in youtube will be "not a music" thing if current video being played is a song? My concern is that.
If something is being played and the next recommendation being video other than song will suck.

@NISH1001 While I was testing the app, sometimes it does suggest movies.

About the dynamic song suggestion, I can work on that but I'm a bit busy lately. Finally in second year of college. Will probably make a PR when I can.

Sure thing!

Same here. I have been busy on other things at the moment that I have to prioritize them over playx for now. Been working on an animation engine currently. So, I am switching between this and that intermittently.