Sorrow446/SberZvuk-Downloader

Feature request: add auth by token (bypass login with emai|pass)

tst32 opened this issue ยท 7 comments

tst32 commented

if we have an of auth token (provided for a non anonymous user 33 chars from https://zvuk.com/api/v2/tiny/profile). it would be useful not to login but proceed directly to all other operations

expected ./main --token <33 secret chars> URLS

it could be done with config.json as well

{
    "email": "",
    "password": "",
    "format": 3,
    "outPath": "Zvuk downloads",
    "albumTemplate": "{{.albumArtist}} - {{.album}}",
    "trackTemplate": "{{.trackPad}}. {{.title}}",
    "maxCover": true,
    "lyrics": true,
    "speedLimit": -1,
    "keepCover": true
    "token": 6SJPyDCub8EJtXQuRPyu5q2meJKW8yleb
}

example token from /dev/urandom

I don't see the point in this. Could you explain the benefit of using a token over credentials?

tst32 commented

In my case I have a token and email, in my profile, but no password. This is because of the way I authorize in openplay - I authorize through a third-party service. accordingly, I can't specify a password. The way I looked at it - in the process the password is only used together with the email to get the token. I'm sorry if I missed something, as I just quickly looked through the code.
cheers!

That makes perfect sense, thanks. This token should be identical to the one the auth function returns, I'll need to check that.

Implemented. de1d87d
It'll use the token if it's not empty, otherwise it'll use credentials. My tokens seem to always be 32 chars long, let me know if yours aren't.
Let me know if you need binaries.

tst32 commented

Yes, mine is also 32 length!
it works, as follow

./main  https://zvuk.com/track/57571043

 _____         _      ____                _           _         
|__   |_ _ _ _| |_   |    \ ___ _ _ _ ___| |___ ___ _| |___ ___ 
|   __| | | | | '_|  |  |  | . | | | |   | | . | .'| . | -_|  _|
|_____|\_/|___|_,_|  |____/|___|_____|_|_|_|___|__,|___|___|_|
   
Signed in successfully - <skipped>.3months

Album 1 of 1:
Invalid URL: https://zvuk.com/track/57571043

so i'm happy token auth works, but something is wrong with request

Album links only, sorry.

tst32 commented

Oh, nice! thanks you so much! ๐Ÿ›ฉ๏ธ all works now! ๐Ÿ‘๐Ÿป