Skip to content
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

ogg file is not properly decr ? OGG_VORBIS_320 #10

Open
AmarnathCJD opened this issue Jun 17, 2024 · 38 comments
Open

ogg file is not properly decr ? OGG_VORBIS_320 #10

AmarnathCJD opened this issue Jun 17, 2024 · 38 comments

Comments

@AmarnathCJD
Copy link

[ogg @ 000001dcbcc31e80] Format ogg detected only with low score of 1, misdetection possible!
[ogg @ 000001dcbcc31e80] cannot find sync word
[in#0 @ 000001dcbcc1b480] Error opening input: Invalid data found when processing input
Error opening input file C:\Users\amarn\spotify-downloader\Desperado-encrypted.ogg.
Error opening input files: Invalid data found when processing input
Error: Command '['ffmpeg', '-decryption_key', '1a4adea5249948f37a53f11efddfb2c8', '-i', 'C:\Users\amarn\spotify-downloader\Desperado-encrypted.ogg', 'C:\Users\amarn\spotify-downloader\Desperado.ogg']' returned non-zero exit status 3199971767.

@AmarnathCJD
Copy link
Author

POST https://gae2-spclient.spotify.com/playplay/v1/key/fcaee7629075da20d8765dfeac0608841c68daef HTTP/1.1
Host: gae2-spclient.spotify.com
Connection: keep-alive
Content-Length: 30
Accept-Language: en
App-Platform: Win32_x86_64
Spotify-App-Version: 123900578
User-Agent: Spotify/123900578 Win32_x86_64/Windows 10 (10.0.22631; x64; AppX)
Content-Type: application/x-www-form-urlencoded

its resolved like this ig

@DevLARLEY
Copy link

What does this request?

@AmarnathCJD
Copy link
Author

What does this request?

I got it from intercepting Spotify windows client, as web client only allow low quality audio playback. This req returns the key for decryption ig, need more investigation with windows client.

@DevLARLEY
Copy link

Could a post a sample of the request and response if you have the time?
The only other piece of information I found is this TypeScript file: https://github.com/DaXcess/node-spotify-ap/blob/main/lib/audio/AudioKeyManager.ts#L10 which indicates that i have to parse the needed information as protobuf.
I compiled the playplay.proto file to a *_pb2.py file
protoc.exe --proto_path=proto --pyi_out=gen proto/playplay.proto
and used it with the requests module to query the endpoint. But it seems like I'm not able to understand the mentioned file good enough as I don't know what the 'cache_id' is supposed to be.
The official librespot python module doesn't mention the PlayPlayRequest.
I also tried just sending a raw widevine challenge to the endpoint but that returned a 403 (Forbidden) error code.

My code:

req = playplay_pb2.PlayPlayLicenseRequest(
    version=3,
    cache_id=b'\x00',
    interactivity=playplay_pb2.Interactivity.INTERACTIVE,
    content_type=playplay_pb2.ContentType.AUDIO_TRACK,
)

response = requests.post(
    url='https://gae2-spclient.spotify.com/playplay/v1/key/c0f23483a2a7634a09a7b209ef2242c9b4b03ab0',
    data=req.SerializeToString(),
    headers={
        'Content-Type': 'application/x-protobuf',
        'App-Platform': 'Win32',
        "Authorization": f'Bearer {token_manager.get_access_token()}'
    }
)

Could you help me out here?

@AmarnathCJD
Copy link
Author

AmarnathCJD commented Jul 12, 2024

Could a post a sample of the request and response if you have the time? The only other piece of information I found is this TypeScript file: https://github.com/DaXcess/node-spotify-ap/blob/main/lib/audio/AudioKeyManager.ts#L10 which indicates that i have to parse the needed information as protobuf. I compiled the playplay.proto file to a *_pb2.py file protoc.exe --proto_path=proto --pyi_out=gen proto/playplay.proto and used it with the requests module to query the endpoint. But it seems like I'm not able to understand the mentioned file good enough as I don't know what the 'cache_id' is supposed to be. The official librespot python module doesn't mention the PlayPlayRequest. I also tried just sending a raw widevine challenge to the endpoint but that returned a 403 (Forbidden) error code.

My code:

req = playplay_pb2.PlayPlayLicenseRequest(
    version=3,
    cache_id=b'\x00',
    interactivity=playplay_pb2.Interactivity.INTERACTIVE,
    content_type=playplay_pb2.ContentType.AUDIO_TRACK,
)

response = requests.post(
    url='https://gae2-spclient.spotify.com/playplay/v1/key/c0f23483a2a7634a09a7b209ef2242c9b4b03ab0',
    data=req.SerializeToString(),
    headers={
        'Content-Type': 'application/x-protobuf',
        'App-Platform': 'Win32',
        "Authorization": f'Bearer {token_manager.get_access_token()}'
    }
)

Could you help me out here?

Yeah wait till tommorow I'll send the details;

you could try intercepting windows Spotify client requests using Fiddler and try to understand the woorking.

@DevLARLEY
Copy link

r = requests.post(
    url="https://gew4-spclient.spotify.com/playplay/v1/key/f9608d4d11ce765a2f901fa8fddf76b0fd9d9e81",
    headers={
        "Authorization": f"Bearer {token_manager.get_access_token()}",
    },
    data=bytes.fromhex("0803121001a3840cfd43462497863e0d52139bd62001280130e7fec4b406")
)
        
print(r.status_code, r.content.hex())
# 200 0a1058cb0cd8f16b0f7bd4fe0890910a7e4412040895d37d

This works

@AmarnathCJD
Copy link
Author

AmarnathCJD commented Jul 12, 2024

that sounds cool

But the next steps?

@DevLARLEY
Copy link

DevLARLEY commented Jul 12, 2024

Some analysis later i got to this point:

PlayPlayLicenseRequest:
version: 3
token: 01a3840cfd43462497863e0d52139bd6
interactivity: INTERACTIVE
content_type: AUDIO_TRACK

PlayPlayLicenseResponse:
obfuscated_key: aaedcf042aae01f00836ed93e2ca1c71

I parsed the request and response as Protobuf and got this.

Next step would be to figure out how to use the output and where the input comes from.
Do you know if the spotify client javascript-based?

@DevLARLEY
Copy link

DevLARLEY commented Jul 12, 2024

ok it seems like this is quite complicated.
For reference:

https://github.com/librespot-org/librespot-java/discussions/421
https://github.com/librespot-org/librespot-java/discussions/421/comments/1812935/threads

@AmarnathCJD
Copy link
Author

wait can we rec eng libspot to get the track.?

if you ever figure out anything more please post here, these seems interesting

@DevLARLEY
Copy link

I'll try to, yes

@DevLARLEY
Copy link

I did it!
Look at this: https://github.com/librespot-org/librespot-java/discussions/421#discussioncomment-10035969

@AmarnathCJD
Copy link
Author

AmarnathCJD commented Jul 13, 2024

I did it! Look at this: https://github.com/librespot-org/librespot-java/discussions/421#discussioncomment-10035969

where to get the playplay.exe ?

@DevLARLEY
Copy link

I won't upload it here but it's the decrypt code leaked compiled using CMake on Windows. The code is accessible on the internet, that's all I'm going to say.

@AmarnathCJD
Copy link
Author

I won't upload it here but it's the decrypt code leaked compiled using CMake on Windows. The code is accessible on the internet, that's all I'm going to say.

ah come.on just a hint where to find the uncompiled version :(

@DevLARLEY
Copy link

github

@AmarnathCJD
Copy link
Author

github

suischan?

@DevLARLEY
Copy link

DevLARLEY commented Jul 13, 2024

that got taken down, but it can still be found. just search for it

@AmarnathCJD
Copy link
Author

wow that's amazing 😹😹

@DevLARLEY
Copy link

seems like it worked?

@AmarnathCJD
Copy link
Author

seems like it worked?

Yup figuring out how to write the ogg headers

@DevLARLEY
Copy link

let me know if you figure something out, as i was only able to play the file using vlc. ffmpeg failed

@AmarnathCJD
Copy link
Author

AmarnathCJD commented Jul 13, 2024

let me know if you figure something out, as i was only able to play the file using vlc. ffmpeg failed

https://gist.github.com/AmarnathCJD/ef4c368c38d5dfcb76f520dd76076189

here

after that you can rebuild proper metadata via ffmpeg

@DevLARLEY
Copy link

DevLARLEY commented Jul 13, 2024

Do you mind if integrate this into my spotify downloader that I'm developing?
Also, while you're at it, could you also do this to the AAC_24 quality, as it's also protected using the same system?

@AmarnathCJD
Copy link
Author

AmarnathCJD commented Jul 13, 2024 via email

@DevLARLEY
Copy link

DevLARLEY commented Jul 13, 2024

A sample aac file
sample_aac.zip

@AmarnathCJD
Copy link
Author

Do you mind if integrate this into my spotify downloader that I'm developing? Also, while you're at it, could you also do this to the AAC_24 quality, as it's also protected using the same system?

Ah aac

why do we need it?

isn't ogg 320 the best quality

@DevLARLEY
Copy link

Sure, but i'd like the downloader to support it too. It's up to you if you want to create another rebuilder.

@AmarnathCJD
Copy link
Author

I'll try;

@AmarnathCJD
Copy link
Author

A sample aac file sample_aac.zip

this aint even playable in vlc

https://gist.github.com/AmarnathCJD/7c3a804e7685b0237f6da42d32f7986a

try with this

@DevLARLEY
Copy link

No luck, did you get it to work?

@AmarnathCJD
Copy link
Author

AmarnathCJD commented Jul 13, 2024

No luck, did you get it to work?

is the decrypt failing on some songs??

for eg;- https://open.spotify.com/track/2qSkIjg1o9h3YT9RAgYN75

are you able to do on this.

@DevLARLEY
Copy link

Yes, i've had this too. Don't know why this is happening...

@DevLARLEY
Copy link

What i do know is that you can go down to OGG_VORBIS_160 and it should work (that's what the desktop app is requesting by default)

@AmarnathCJD
Copy link
Author

What i do know is that you can go down to OGG_VORBIS_160 and it should work (that's what the desktop app is requesting by default)

Is this still working?

@DevLARLEY
Copy link

Of course, just make sure to compile the latest playplay version: https://git.gay/uhwot/unplayplay the old one got deprecated.

@AmarnathCJD
Copy link
Author

AmarnathCJD commented Nov 6, 2024 via email

@abolfazlMKazemi
Copy link

i have this proble can help me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants