kkdai / youtube

Download Youtube Video in Golang
MIT License
3.37k stars 433 forks source link

Completely new cache #201

Closed Camelva closed 2 years ago

Camelva commented 3 years ago

Description

IMO this is more like a draft, and any discussion is welcomed

Completely new cache instead of old DecipherOperationsCache. Now it stores version of current youtube player, signatureTimestamp and deciphering operations.

Some key points:

Also i plan to add some mechanism to save backup of this cache locally and somehow import it on start.

Another thing i'm thinking about - maybe store player version temporarily with relatively short expiration time (few minutes, maybe hour?) instead of fetching it for each song, Though fetching only player's version instead of whole player, sts and decipherOps is already win, but still can be better.

Issues to fix

Please link issues this PR will fix: \ #200

if no relevant issue, but this will fix something important for reference , please free to open an issue.

Reminding

Something you can do before PR to reduce time to merge

Camelva commented 3 years ago

Alright, now it can store cache locally at file from CacheStorage variable. This variable is exported so user can easily change location or even disable local cache by passing empty string. Still unsure about caching player version. Maybe will add in future..

Camelva commented 3 years ago

Interesting how i run tests again and again locally and they pass, but here i got error. I suppose there is some element of randomness.. Can i somehow run tests here again without additional commit?

Also i see how this pr was mentioned, but can't find actual mention. Huh

Camelva commented 3 years ago

Alright, reverted commit with additional test since it's weird

Julian-Chu commented 3 years ago

hi @Camelva , thanks for PR, sorry too busy . if other maintainers are busy as well. I will review this PR in two weeks. Have a nice day!

Julian-Chu commented 3 years ago

a small question, is it possible to have same version but with different decipher operations?

cache is difficult, still no clear idea for this pr. :exploding_head:

Camelva commented 3 years ago

a small question, is it possible to have same version but with different decipher operations?

@Julian-Chu could you explain in more detail what do you mean? I didn't quite get it. Decipher operations should be same, if i recall correctly