ytermusic icon indicating copy to clipboard operation
ytermusic copied to clipboard

Issue while reading playlists

Open natsukashiixo opened this issue 1 year ago • 14 comments

This will most likely not end up being relevant but I'll include it anyway: OS: Arch Linux x86_64 Install method: cloned from repo, built using rustup 1.26.0-3

Actual issue and question: I'm able to launch ytermusic without any errors being thrown but my personal playlists aren't showing up at all. Instead I get generic suggestions for people in my region, this makes me feel like I'm not actually logged in but I have no idea if its possible to check.

Am I supposed to copy the cookie from a specific request on music.youtube.com? Currently I have copied the string from the first music.youtube.com request that pops up after refreshing the page. Aka the cookie: field under Request Headers.

My account is using security key 2fa, my assumption is that this doesn't matter since it should pass if the cookie is valid. My browser is Brave. Obviously I won't post my cookie string, but I assume that user agent is fine. This is the general spec of my headers.txt Cookie: VERYLONGCOOKIESTRING User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36 Each field is on a separate line.

natsukashiixo avatar Jun 01 '23 15:06 natsukashiixo

Should be good from what I can tel. May you send the log file? Maybe something went wrong when decoding your library.

ccgauche avatar Jun 02 '23 09:06 ccgauche

[PERF] Init: 0ms [PERF] Startup: 0ms [PERF] Spawned clean task: 0ms [PERF] Clean task: 0ms [PERF] Spawned system task: 77ms [PERF] Spawned last playlist task: 77ms [PERF] Spawned api task: 78ms [PERF] Running manager: 78ms Last playlist task on [PERF] Last playlist: 0ms API task on Database getter task on [PERF] Local musics: 0ms [PERF] API task: 3035ms [PERF] Browse playlist Call on Me (David Guetta Remix): 338ms [PERF] Browse playlist A Beautiful Game: 360ms [PERF] Browse playlist Puls: 369ms [PERF] Browse playlist Aeroplane: 427ms [PERF] Browse playlist Hero [VIP Mix]: 417ms [PERF] Browse playlist Almost Healed: 411ms [PERF] Browse playlist Plava Krv: 428ms [PERF] Browse playlist She's the One: 563ms [PERF] Browse playlist New Release Mix: 792ms [PERF] Browse playlist Discover Mix: 1414ms [PERF] Browse playlist My Supermix: 1475ms [PERF] Browse playlist Beach Beats: 1573ms [PERF] Browse playlist Tollywood Hitlist: 1661ms [PERF] Browse playlist Bollywood Hitlist: 1672ms [PERF] Browse playlist Summer Dance Classics: 1708ms [PERF] Browse playlist Easy EDM: 1675ms [PERF] Browse playlist Soft Rock Ballads: 1702ms [PERF] Browse playlist Modern Ukrainian Pop: 1688ms [PERF] Browse playlist Classical Focus: 1716ms [PERF] Browse playlist Country Hotlist: 1775ms [PERF] Browse playlist Ultimate Summer Hits: 1788ms [PERF] Browse playlist All-Time Easy Acoustics: 1754ms [PERF] Browse playlist Relaxing 80s Rock: 1766ms [PERF] Browse playlist RELEASED: 1804ms [PERF] Browse playlist The Hit List: 1813ms [PERF] Browse playlist Al Millón: 1793ms [PERF] Browse playlist Reggae Relaxation: 1793ms [PERF] Browse playlist Hip Hop + R&B Summer Hits: 1842ms [PERF] Browse playlist Hip-Hop Classics: 1821ms [PERF] Browse playlist Pop Gold: 1840ms [PERF] Browse playlist Gentle Piano: 1859ms [PERF] Browse playlist Totally Pop: 1861ms [PERF] Browse playlist Golden Gods of Metal: 1880ms [PERF] Browse playlist Biggest Dance Anthems: 1886ms [PERF] Browse playlist Summer Hits 2023: 1946ms [PERF] Browse playlist Highline R&B: 1945ms [PERF] Browse playlist Summer Trappin: 1953ms [PERF] Browse playlist Sunshine Reggae: 1960ms [PERF] Browse playlist BEAT ON: 1968ms [PERF] Browse playlist Summer House: 1968ms [PERF] Browse playlist Glow: Dance Hits: 1971ms [PERF] Browse playlist Chroma: Today's Dance Hits: 1972ms [PERF] Browse playlist Pop's Biggest Hits: 1934ms [PERF] Browse playlist Totally Hits: 1934ms [PERF] Browse playlist Sunshine Indie: 1993ms [PERF] Browse playlist Unstoppable Rock Anthems: 1944ms [PERF] Browse playlist Huge Dance Hits: 1947ms [PERF] Browse playlist Classic Easy Rock: 1967ms [PERF] Browse playlist The Arijit Singh Collection: 2049ms [PERF] Browse playlist Laid Back Summer: 2173ms [PERF] Browse playlist Easy Modern Soul: 2146ms Appended [Blue Archive] Unwelcome School (Seamless 30m) to database panicked at 'index out of bounds: the len is 158 but the index is 158', /home/ntsu/.cargo/registry/src/github.com-1ecc6299db9ec823/tui-0.17.0/src/buffer.rs:176:14

This is from my latest launch, can't see anything weird except the last line. None of the playlists listed in this log are mine except Local Musics of course. Let me know if there's any way to generate a more detailed log

natsukashiixo avatar Jun 02 '23 15:06 natsukashiixo

Seems strange very strange indeed may you remove your database from your config files? (You can remove all of them) You can also run RUST_BACKTRACE=1 cargo run --release to get more details about the last panic.

ccgauche avatar Jun 05 '23 07:06 ccgauche

the panic didn't happen at my latest launch, feels like it might be related to the 30min long song instead of this cookie issue, so i'll hold off on investigating it for now.

Keep in mind that while i might seem to know what I'm doing, I'm quite new to linux, anyways: I can't find the database files in my ~/.config folder. Is that where they're supposed to be located? Maybe I should also elaborate on my installation in case my steps messed something up. Cloned from git into ~/ytermusic, built in that folder and then mkdir ~/ytermusic-bin, copied the bin into there, generated my headers.txt and now I'm running it with ./ytermusic from inside the ytermusic-bin folder. The reason I did this is because I don't want to populate my .cargo/bin folder with anything but binaries.

I decided to check the permissions of the files in case those are wrong but unless ytermusic is run as a group idk. .rwxr-xr-x ntsu ntsu 94 MB Thu Jun 1 10:50:44 2023  ytermusic

natsukashiixo avatar Jun 05 '23 08:06 natsukashiixo

I doesn't seem to be an issue with your config file. YTermusic would launch if so. Something in one of your playlists is probably disabling YterMusic from reading them (Maybe some sort of specific encoding)

ccgauche avatar Jun 05 '23 11:06 ccgauche

Already had a bug like that which was caused by a foreign layout that wasn't expected ("Arabic" since it's right to left)

ccgauche avatar Jun 05 '23 11:06 ccgauche

A lot of my playlists have names in japanese, so yeah, starting to sound like the most likely reason. My username (but not handle) is also in japanese, which might also explain why even the playlists that don't have japanese names don't show up. Funky!

edit: Should i change the name of the Issue so it can be recategorized as a bug?

natsukashiixo avatar Jun 05 '23 12:06 natsukashiixo

@natsukashiixo I added some further logging, tracing and debugging that can be enabled using YTERMUSIC_LOG=true cargo run --release on the lastest commit. If you can send me the output.

ccgauche avatar Jun 06 '23 08:06 ccgauche

The log file ended up being 83MB so I had to use a separate upload service for it. https://file.io/dquNFeylUGNA

natsukashiixo avatar Jun 06 '23 11:06 natsukashiixo

@natsukashiixo May you check if the issue is fixed ?

ccgauche avatar Jun 06 '23 12:06 ccgauche

https://file.io/4ixQdVaG8hwr Doesn't seem like its fixed sadly

natsukashiixo avatar Jun 06 '23 15:06 natsukashiixo

I ran into a slightly related issue where I was using an old cookie that was no longer valid. This resulted in only getting playlists as if I wasn't logged in. I tried copying my new cookie into the headers.txt file but kept getting an InvalidCookie error from this line: https://github.com/ccgauche/ytermusic/blob/master/ytpapi2/src/lib.rs#L175

The to_str function fails if the string contains non-ascii characters. I used this website to identify non-ascii characters in my cookie: https://pages.cs.wisc.edu/~markm/ascii.html

Turns out I had a unicode ellipses in my cookie because of how I copied it from the dev tools :laughing:

Once I copied the actual value, everything worked perfect. Not sure if you somehow ran into the same problem I did :sweat_smile:

PatOConnor43 avatar Jul 01 '23 05:07 PatOConnor43

I'll probably add some sort of check if it can avoid misuse by users.

ccgauche avatar Jul 03 '23 07:07 ccgauche

"No non-ascii characters found" when I used that checker, but my playlists still aren't appearing. Might look into forking and trying to add a netscape format cookie jar but I've never worked with Rust before and its a bit intimidating

natsukashiixo avatar Jul 10 '23 21:07 natsukashiixo