simon-weber / gmusicapi

An unofficial client library for Google Music.
https://unofficial-google-music-api.readthedocs.io
BSD 3-Clause "New" or "Revised" License
2.49k stars 258 forks source link

Support for 'I'm feeling lucky radio' #184

Closed mario-tux closed 10 years ago

mario-tux commented 10 years ago

Could you investigate about this new interesting way to create a station?

simon-weber commented 10 years ago

Oh, I never responded to this! Sorry! =(

I had kind of expected this to be done clientside, but the webclient hits the server to get it. This should be an easy feature to add once I get some time to check out a recent android build.

elfez commented 10 years ago

Do you have any pointers on how you go about digging out the endpoint? I'd like to see this in the squeezebox plugin, and if I can help I'd be happy to do so.

simon-weber commented 10 years ago

The easiest way to get started is to point an Android device at a mitm proxy like Fiddler or Charles. Then, just use the feature you're looking to reverse and look for relevant calls.

elfez commented 10 years ago

So this is the data that seems to sent, if I understand things correctly:

{
 "kind": "sj#radioFeed",
 "data": {
  "stations": [
   {
    "kind": "sj#radioStation",
    "id": "IFL",
    "name": "IFL",
    "seed": {
     "kind": "sj#radioSeed",
     "seedType": "6"
    },
    "tracks": [
    ...

I'll try and figure out where that should go and see if I can get a valid playlist back.

hechtus commented 10 years ago

So, the radio station ID is simply "IFL" (I'm feeling lucky). If you are using this station ID for looking up the tracks it should work. Great!

elfez commented 10 years ago

Yup, that worked (wasn't sure if the seedType would have an effect)! I guess this just needs documenting and then this case can be closed.

simon-weber commented 10 years ago

Nice work! I think this is the right docstring to add this to: https://github.com/simon-weber/Unofficial-Google-Music-API/blob/6d79fd11a802ef41ddd34103b971b4280196987f/gmusicapi/clients/mobileclient.py#L604.

hechtus commented 10 years ago

I agree. A note about using the "IFL" station ID is sufficient.

elfez commented 10 years ago

It looks correct, but I'm still wrapping my head around the whole thing, so I'll defer to hecthus to comment on if that is the correct API call.

jwdempsey commented 10 years ago

I just tried this out and it works perfectly:

Mobileclient.get_station_tracks('IFL', num_tracks=25)
simon-weber commented 10 years ago

Nice. Whenever I/someone gets to this, let's remember to also add a quick test so we can catch id changes.