Open ghost opened 9 years ago
Another important change: Now they work with the rtmp protocol, not the mp3 itself, so it will be needed to be implemented as the current project doesn't support rtmp stream. (If we manage to solve the permission problem)
Xoxo
I just checked there is a call to sp/track_uri -- the other messages are not replicated by node-spotify-web and I believe that is where the problem lies. I also checked the change to rtmp, this is based on the capabilities of the browser, if you pass a "" (empty string) for the 2nd argument, it returns a http uri -- try it by overloading the function call in Chrome's debugger.
On Mon, Aug 3, 2015 at 5:45 PM, Geekie notifications@github.com wrote:
Another important change: Now they work with the rtmp protocol, not the mp3 itself, so it will be needed to be implemented as the current project doesn't support rtmp stream. (If we manage to solve the permission problem)
Xoxo
— Reply to this email directly or view it on GitHub https://github.com/TooTallNate/node-spotify-web/issues/111#issuecomment-127215684 .
There's $10 in a bounty on https://www.bountysource.com/issues/24783317-trackerror-account-subscription-status-not-spotify-premium?tracker_ids=256038
Whoever cracks this issue deserves something for it!
I too will also donate! I'll throw in $15 when I get a chance!
I, instead, will try to fix the issue ASAP :P
@deysvitali thats the idea, but (only talking by myself) i've been working on itthis two weeks, and i've found nothing :(
Bountysource could be a good idea to make it more visible to others developers :)
Might have spotted the issue, a certain token* is sent through the websocket.
*I call it token because is the only string in the flow that fails at decoding in base64
In my case was this:
{"id":10,"name":"sp/hm_b64","args":[0,"Cj5obTovL3hwcm9tby91c2VyLzExOTQ0NTA4NjIvcGxhdGZvcm0vd2VicGxheWVyL3Byb21vdGUvZGVza3RvcBoDR0VU"]}
This cause a 408 error:
{ error: [ 14, 408, '' ], id: 10 }
I hope this could help
--- EDIT ---
Nevermind, decoded it. Anyway is still interessant, because this is the decoded message:
>hm://xpromo/user/1194450862/platform/webplayer/promote/desktop
(1194450862 is my id)
I've been looking into this issue a bit myself, it's a strange issue as my project spotify.py is still functioning as usual (it's a python port of this library)..
I've compared the web-socket messages between the two libraries and everything matches up.. :confused:
I've still got a few things to try, will keep you updated :smiley:
What UA do you use in your project? How do you get the login token? Where do you get the proto files?
Currently I'm on mobile and I can't check myself nor experiment, sorry for harassing with these questions
Plus, could it be related to a resolution check? In your code you send a resolution:
self.send('sp/log', 41, 1, 1656, 951, 0, 0)
self.send('sp/log', 41, 1, 1656, 951, 0, 0)
In this project IIRC we send a resolution of 0x0, which might be the issue. Can't test right now anyway
What UA do you use in your project?
spotify.py has always used the chrome user-agent, copied that over to node-spotify-web - no change.
How do you get the login token?
spotify.py should be using the same method as node-spotify-web - will need to confirm this matches.
Where do you get the proto files?
Pretty sure they originally came from node-spotify-web, will double-check they match now.
In your code you send a resolution:
self.send('sp/log', 41, 1, 1656, 951, 0, 0) self.send('sp/log', 41, 1, 1656, 951, 0, 0)
In this project IIRC we send a resolution of 0x0, which might be the issue.
Yeah, tried changing that as well. no change..
All my test changes are up at https://github.com/fuzeman/node-spotify-web/commits/issue/111
I tried everything really, changed UA, setted cookies to the Web socket, ... I even tried to send the identical commands that the web ui sends, but with no luck, don't know why this happens.
I have spotted a similar error in my plex plugin using spotify.py some time ago and I have found a small bug on how ids where translated to urls. Check this change: https://github.com/Hexxeh/spotify-websocket-api/commit/e278d515b5eafd0ddcefa91f1d62a3435706bd65
My fix was applied to the python library, so that could explain why it is only happening in node.
Anyway is just a blind shot, I can't test it right now to confirm or discard the cause, but as the symthom was pretty similar I think is worth to mention.
Hope it helps.
@pablorusso thx for the blind shot but it looks like the node version already has this "fix" in its util.js:
exports.id2uri = function (uriType, v) { var id = base62.fromHex(v, 22); return 'spotify:' + uriType + ':' + id; };
Any news on this "issue" ... anyone?
I've managed to narrow down the issue a bit, still haven't worked out exactly what is causing it though.
Relaying the websocket connection over a ws4py server/client (used in spotify.py, which is still working) fixes the track issue somehow :confused: (ws4py is handling the websocket handshake with spotify, and is then relaying the raw masked websocket bytes)
I've tried the following in node-spotify-web:
I'm thinking the websocket client (used in node-spotify-web) might be doing something in the websocket handshake which is detectable by spotify, they could be then flagging the client as "unofficial" and refusing track requests.
@fuzeman that sounds reasonable ... i just configured spotify.js to use this userAgent
this.userAgent = 'ws4py (asyncio)/wsaccel for Python 3.4.0';
and the error changes to line 257 in spotify.js.
@THenkeDE that's because Spotify doesn't support this useragent:
The response says: redirects: [ 'https://play.spotify.com/error/browser-not-supported.php' ]
By updating the useragent to Chrome's user-agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/43.0.2357.130 Chrome/43.0.2357.130 Safari/537.36
I'm getting a different error. My best guess at the moment is the protobufs have had some updates done that's not been pulled into this project.
When trying to play a track...
/home/bencevans/Code/playq/node_modules/spotify-web/node_modules/protobufjs/ProtoBuf.js:1987
throw(e);
^
Error: Illegal value for Message.Field .spotify.metadata.proto.Restriction.catalogue: 4 (not a valid enum value)
at ProtoBuf.Reflect.Field.verifyValue (/home/bencevans/Code/playq/node_modules/spotify-web/node_modules/protobufjs/ProtoBuf.js:2321:27)
at Message.add (/home/bencevans/Code/playq/node_modules/spotify-web/node_modules/protobufjs/ProtoBuf.js:1693:53)
at ProtoBuf.Reflect.Message.decode (/home/bencevans/Code/playq/node_modules/spotify-web/node_modules/protobufjs/ProtoBuf.js:2137:29)
at ProtoBuf.Reflect.Field.decode (/home/bencevans/Code/playq/node_modules/spotify-web/node_modules/protobufjs/ProtoBuf.js:2594:46)
at ProtoBuf.Reflect.Message.decode (/home/bencevans/Code/playq/node_modules/spotify-web/node_modules/protobufjs/ProtoBuf.js:2137:51)
at Message.decode (/home/bencevans/Code/playq/node_modules/spotify-web/node_modules/protobufjs/ProtoBuf.js:1982:41)
at Function.protobufjs_parse_wrapper (/home/bencevans/Code/playq/node_modules/spotify-web/lib/schemas.js:98:39)
at Spotify._parse (/home/bencevans/Code/playq/node_modules/spotify-web/lib/spotify.js:1288:20)
at parseData (/home/bencevans/Code/playq/node_modules/spotify-web/lib/spotify.js:592:18)
at Spotify.<anonymous> (/home/bencevans/Code/playq/node_modules/spotify-web/lib/spotify.js:652:16)
@bencevans I've tried it with your user-agent but I'm not getting a protobuf error, I'm still getting the "Account subscription status not Spotify Premium" Track Error.
@Zazama ah, it was because I was using node@0.12. Running with node@0.10 results in the Account subscription status not Spotify Premium
error :crying_cat_face:
Check out my issue/111 branch for a fix
Note: this fix requires at least node.js v0.11.13 as this change is required: https://github.com/joyent/node/commit/ba7c9ce9649886edf77d01cdcec216c8a0c76f48
If you find it is getting stuck at login try my feature/ping-pong-fix branch, this uses a different service for the ping/pong generation as the http://ping-pong.spotify.nodestuff.net service hasn't been that reliable lately..
@fuzeman Didn't test it but congrats! As soon as I can I'll test it and report
@fuzeman awesome, it works!
Congrats and thanks @fuzeman!
On Thu, Aug 20, 2015 at 1:25 PM, Long Le notifications@github.com wrote:
@fuzeman https://github.com/fuzeman awesome, it works!
— Reply to this email directly or view it on GitHub https://github.com/TooTallNate/node-spotify-web/issues/111#issuecomment-132991035 .
Perfect, it's working! I've updated to Node.js 0.11.13 and all of spotify-web dependencies, but now the "accountTypeMap" aren't Strings anymore, they are numbers, so I had to use the commit 0f16a6a
@fuzeman and I also got the login problem like you said. Some where at the ping/pong generation. Now switching to the feature/ping-pong-fix branch... Update. feature/ping-pong-fix branch works great. Thanks man
Can someone build node 0.10.36 x64 version with the 2 file changes from https://github.com/joyent/node/commit/ba7c9ce9649886edf77d01cdcec216c8a0c76f48? I'm not at home (no visual studio + python) but would like to get protobufs working and with the 0.11.13 one I'm getting issue https://github.com/TooTallNate/node-spotify-web/issues/107 again. Is it even possible or are the changes inherently connected with other commits?
I confirm this is working (tested on Windows x64 node 10.36 (ia32) ). THANK YOU! :tada: Will test this later on some VM's. I didn't use the ping-pong branch because It redirects the login credentials via a non official server? (correct me if I'm wrong) So I don't risk this
Confirmed working! But, I'm getting a ton of errors that resemble one of the problem, causing the app to repeatedly crash. Any ideas where these are originating from? This is with node.js v0.11.16.
events.js:85
throw er; // Unhandled 'error' event
^
Error: unexpected server response (500)
at ClientRequest.response (/var/www/qcast-spotify/node_modules/spotify-web/node_modules/ws/lib/WebSocket.js:675:15)
at ClientRequest.g (events.js:199:16)
at ClientRequest.emit (events.js:107:17)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:419:21)
at HTTPParser.parserOnHeadersComplete (_http_common.js:111:23)
at TLSSocket.socketOnData (_http_client.js:310:20)
at TLSSocket.emit (events.js:107:17)
at readableAddChunk (_stream_readable.js:163:16)
at TLSSocket.Readable.push (_stream_readable.js:126:10)
at TCP.onread (net.js:529:20)
and another one:
events.js:85
throw er; // Unhandled 'error' event
^
Error: socket hang up
at createHangUpError (_http_client.js:215:15)
at TLSSocket.socketOnEnd (_http_client.js:293:23)
at TLSSocket.emit (events.js:129:20)
at _stream_readable.js:908:16
at process._tickCallback (node.js:355:11)
Wow, fucking crack :)
Many thanks @fuzeman I thought this project was going to dead
@sciencepro : Try using node version 10.36 If you want to use multiple node js versions you should check this guide out. This solution is mentioned in multiple issues on this project.
@vincentcox perhaps you missed @fuzeman's post - his updated branch requires at least v0.11.13. My comment pertains to that specifically.
@sciencepro It doesn't require 0.11.13 even tho he says it. I'm using his fix with 0.10.36 and everything works fine.
@Zazama thanks, things seem to be working smoothly on v0.10.36.
For some reason I am intermittently getting [Error: Track is not playable in country "US"]
on some tracks, while most play fine. I'm unsure what to make of this.
Intermittent region errors aside, there's another error I'm seeing periodically:
TypeError: Cannot read property 'version' of undefined
at Spotify._resolveAP (/var/www/qcast-spotify/node_modules/spotify-web/lib/spotify.js:360:50)
at Spotify._onauth (/var/www/qcast-spotify/node_modules/spotify-web/lib/spotify.js:348:10)
at Request.callback (/var/www/qcast-spotify/node_modules/spotify-web/node_modules/superagent/lib/node/index.js:746:30)
at Request.<anonymous> (/var/www/qcast-spotify/node_modules/spotify-web/node_modules/superagent/lib/node/index.js:135:10)
at Request.emit (events.js:117:20)
at IncomingMessage.<anonymous> (/var/www/qcast-spotify/node_modules/spotify-web/node_modules/superagent/lib/node/index.js:938:12)
at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:944:16
at process._tickCallback (node.js:442:13)
I've updated to Node.js 0.11.13 and all of spotify-web dependencies, but now the "accountTypeMap" aren't Strings anymore, they are numbers, so I had to use the commit 0f16a6a
The restriction accountType
seems to change between numbers and strings, this might also be causing the random Error: Track is not playable in country
errors. Possibly a protobuf issue?
Can someone build node 0.10.36 x64 version with the 2 file changes from joyent/node@ba7c9ce? I'm not at home (no visual studio + python) but would like to get protobufs working and with the 0.11.13 one I'm getting issue #107 again. Is it even possible or are the changes inherently connected with other commits?
Yeah, you should be able to port joyent/node@ba7c9ce back to v0.10. This will also likely require some changes to /lib/tls.js
to allow a null
value for servername
to be passed to the process.binding('crypto').Connection
class.
I'll have a look at #107, it sounds related to the accountType
issue mentioned above.
I didn't use the ping-pong branch because It redirects the login credentials via a non official server? (correct me if I'm wrong)
Well, both http://ping-pong.spotify.nodestuff.net and http://spflash.herokuapp.com are unofficial servers (not hosted by spotify). They don't receive any "login credentials" though, it's just a sequence of numbers that are used in a login verification step (see #87 for more details).
Confirmed working! But, I'm getting a ton of errors that resemble one of the problem, causing the app to repeatedly crash. Any ideas where these are originating from? This is with node.js v0.11.16.
Looks like the spotify websocket server is returning a 500 response, maybe this is an issue on their end? not sure..
@sciencepro It doesn't require 0.11.13 even tho he says it. I'm using his fix with 0.10.36 and everything works fine.
Strange, will double-check what happens on v0.10. Pretty sure the SNI extension wasn't being disabled correctly on v0.10.
Intermittent region errors aside, there's another error I'm seeing periodically
Hmm, this probably means account authentication failed. Probably need to check the response Spotify.prototype._onauth
is receiving.
I've made a few changes to fix track restriction parsing (the Error: Track is not playable in country
error) and an issue with protobuf.js support. Grab the changes from my issue/111 or feature/ping-pong-fix branches.
If you see an incorrect Error: Track is not playable in country
error again, let me know the track uri and your account country/region.
@fuzeman I seem to be having tracks that are failing to play that played before.
An example: https://play.spotify.com/track/4tg1G3X26wDTmQbipgxhp5. I'm in the US.
[Error: Track is not playable in country "US"]
@sciencepro try the commit referenced above, pretty sure it should work now.
I'm getting country errors with https://github.com/fuzeman/node-spotify-web/commit/75fdd0cb914bfd5d2401e10602b0f0ea4a58498e
@vincentcox what's the track uri and your account country/region?
@fuzeman, thanks a lot, got everything working again!
Uhm I know I sound like a complete idiot but I was using the "original" program until I got the same error, and I got that fuzeman fixed it but I don´t get how to use his fix, can someone help? I installed the newest version of NodeJS and downloaded the fixed branch from fuzeman but I´m stuck now :( sorry I´m new to this whole python thing...
I now typed "npm isntall spotify-web" to the nodejs command propmpt but I get a whole lot of errors... x(
Update2: I forgot to install Python...the errors are gone, but now I´m really helpless xD
Not to worry!
You can replace the dependency in the package.json file with a git url e.g
"spotify-web": "git+ssh://git@github.com/fuzeman/node-spotify-web.git#feature/ping-pong-fix"
Then reinstall your modules
$ rm -r node_modules && npm install
@fuzeman, is it possible to add a timeout in the spotify_web.login function? It seems that it get stuck waiting for infinite amount of time sometimes.
Since this morning i'm getting this error: can not read property 'csrftoken' of undefined
any idea what might be the problem?
@Watiswat Spotifys Web Player was down, but it should be back up now.
-> https://twitter.com/SpotifyStatus/status/685797886383255552
@Zazama you're right, I did not take that into consideraton :)
Just started seeing these responses today
Is this a server side change by Spotify?