PromyLOPh / pianobar

Console-based pandora.com player
http://6xq.net/pianobar/
Other
1.74k stars 321 forks source link

[Feature Request] Support for replay song #601

Open redog opened 7 years ago

redog commented 7 years ago

Pandora Plus includes unlimited song skips and now support replaying the current song.

pianobar should include support for this feature.

PromyLOPh commented 7 years ago

You’re talking about https://help.pandora.com/customer/en/portal/articles/2590339-replays, right?

There’s a new method onDemand.getReplayTrack, which probably does what we’re looking for. However calling it fails with error code 9 (parameter missing) and I can’t figure out which one is missing. If someone figures out how to call that method I’ll have a look.

Simply reusing the known audio urls might be too fragile. They expire after some time.

Lvl4Sword commented 7 years ago

https://www.pandora.com/api/v1/ondemand/getReplayTrack is only available if you've watched an ad on the desktop version and says "Replay not available" otherwise ( my experience, also https://help.pandora.com/customer/en/portal/articles/2590339-replays ). Headers:

Host: www.pandora.com User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0 Accept: application/json, text/plain, / Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Content-Type: application/json X-AuthToken: [EDITED] X-CSRFToken: [EDITED] Referer: https://www.pandora.com/station/play/[EDITED]/history Content-Length: 251 Cookie: wrt=[EDITED]; v2regbstage=true; at=[EDITED]; v3ad=[EDITED]; pwc-2016=true; csrftoken=[EDITED]; _sl_path=/station/play/[EDITED] DNT: 1 Connection: keep-alive

https://www.pandora.com/api/v1/ad/useReplayReward had response: replaysRemaining:1

useReplayReward and getReplayTrack are also used if you watch an ad and then switch on an adblocker of some type ( uBlock Origin or the like ).

Let me know if you need me to get you anything else.

PromyLOPh commented 7 years ago

Note that pianobar is using the mobile API at tuner.pandora.com/services/json/ which is slightly different. I need request url, request data and response data.

normancroan commented 7 years ago

Hi folks, just found this while utilizing the windows binaries (https://github.com/thedmd/pianobar-windows-binaries) - if you pause the track with 0 seconds remaining, resuming will cause it to play from the beginning. I tested this a few times and got a song to play back 3 times. It's a bit of a hack but that could be reproduced in a feature pretty easily if the user indicates they wish to loop the current track.

PromyLOPh commented 7 years ago

That’s a bug in the Windows port. It does not work here.

hatcreek68 commented 6 years ago

is there any way to access the pianobar cache to replay?

PromyLOPh commented 6 years ago

There is no song cache.

hatcreek68 commented 6 years ago

Ok, it just streams the current song URL? Can the current song URL be posted to patiobar or a text file? Similar to the current song text file that gets overwritten?

PromyLOPh commented 6 years ago

The file is streamed and its URL is not available to eventcmd scripts for obvious reasons.

hatcreek68 commented 6 years ago

Hey, if you want to keep it hidden, your call 100%; but here's some reasons it's NOT obvious to me to keep it hidden.

  1. pianobar is already accessing that URL to stream...
  2. You can legally record to the radio (over the air radio), for personal use. Also see VCR/PVR debate...
  3. If you go to pandora.com, play a song. Legally. Hit F12, observe the song URL. Go to said URL, it will work for a limited time. Does pandora want you to do this? Probably not. but it's just a URL made available to listen the a song, paid for by ads between x many songs.
  4. You can even straight download the song from the URL w/ 1 click - and own the consequences of doing so if you breach any law and/or terms of service - but pandora itself doesn't prevent this.
  5. Pandora lets you replay instantly on the mobile app, for the price of 1 ad; would be cool to integrate replay in pianobar (using ads or paid pandora one account). Pianobar is already adfree - so it's a dance here. We follow SOME rules but not all of them....... would be better to just commit one way or the other. Maybe REQUIRE pandora one accounts to use pianobar to mitigate legal issues?

example 1 - observe song URL straight from pandora.com example 2 - said URL functions for some amount of time for a reply