-
Notifications
You must be signed in to change notification settings - Fork 17
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
Playback failing on media with 302 redirect to https resource #52
Conversation
Thanks for the report. Would you like to come up with a pull request? :) A HEAD request to the resource before playing it should be enough.
As requests is already a dependency, that should be easy. |
I actually tried to fix this because I just ran into the same issue. The problem is that when stripping the https from the final URL, it invalidates the request signature. This is the response: <Error>
<Code>SignatureDoesNotMatch</Code>
<Message>
The request signature we calculated does not match the signature you provided. Check your key and signing method.
</Message>
<AWSAccessKeyId>AKIAJNIGGLK7XA7YZSNQ</AWSAccessKeyId>
<StringToSign>
GET 1415698906 /soundcloud-media/R81nGDq4qVFb.128.mp3
</StringToSign>
<SignatureProvided>TPkRetwEnrmxvtZUQOcwg/if8yU=</SignatureProvided>
<StringToSignBytes>
47 45 54 0a 0a 0a 31 34 31 35 36 39 38 39 30 36 0a 2f 73 6f 75 6e 64 63 6c 6f 75 64 2d 6d 65 64 69 61 2f 52 38 31 6e 47 44 71 34 71 56 46 62 2e 31 32 38 2e 6d 70 33
</StringToSignBytes>
<RequestId>FAFA88A224488F0E</RequestId>
<HostId>
DF5pVBaOi+KFZb1zT/B2D2HtSjfMLvM5+pE2xPnGZGzuA92922kXb2NPeezs6JT1
</HostId>
</Error> The best real fix for this would probably be #45... Or do you have any other idea? A workaround would be to download the file to a temporary location with requests and play it from there. |
I got started on this last night (though your solution is much cleaner) and ran into the same problem. This is also the reason why I have not filed a pull request yet. I assume this is a bug on Soundclouds servers. As it seems, the protocol is not part of the signed content and it works fine with a lot of tracks. With me this error only happens occasionally. I agree that #45 would be the best solution. As much as I would like to contribute to it, I fear that it is a bit out of my league. |
#45 is already partially done, so I simply need to find (or take) the time to continue working on it sometime. If you do want to implement the workaround, I'd suggest basing the work on the issue_52 branch. You can then add a HEAD request after switching the protocol from HTTPS to HTTP (line 138) to see whether the status code is fine or not (probably with |
Hm, Soundcloud appear to have fixed their signature issues! I'll merge this for now, hope it solves the problem. |
Playback failing on media with 302 redirect to https resource
Version 0.1.2 is on PyPI! Hope that resolves the playback issues. |
mplayer currently cannot stream via https. This issue has been partially covered in player.py by exchanging the https protocol with http in the url.
This does not cover URLs with redirects though. These are for example used by soundcloud. When this http resource uses a 302 redirect that points to another https resource, orochi doesn't currently handle this and mplayer does not support the URL it is redirected to.