user234683 / youtube-local

browser-based client for watching Youtube anonymously and with greater page performance
GNU Affero General Public License v3.0
501 stars 61 forks source link

Some older videos are stuck in subscriptions list #49

Closed ByJumperX4 closed 3 years ago

ByJumperX4 commented 3 years ago

Since some days ago, I'm having an annoying problem: a few videos that are shown before newer ones in my subscriptions list I think a screenshot would be better than a long and boring explanation of the problem image

user234683 commented 3 years ago

This is by design. The subscriptions list is not actually sorted by the date the video is published; it's sorted by the date that the program became aware that the video existed.

This is because channels are checked at 10x the rate that the channel posts videos. Channels that post more often are checked more frequently. This is to cut down on the number of requests, since users might have hundreds, even over a thousand subscriptions, and the vast majority of those will be channels that don't post very often.

So if a channel posts one video every 10 months on average, then on average it's checked every month. Once that channel posts a video, it could take up to a month for the program to see it. If we were sorting by the date the video was published, then that video would be buried under videos from channels that post more often, so the user would never see it.

There's some exceptions to these rules (for instance, the first time a channel is checked, the videos are put into the subscriptions based on upload date). It's also sorted by upload date if over 6 new videos are seen, so that if a channel is muted or the autochecker is off for awhile, we don't have a similar problem once it is checked after having posted say 25 videos. This rule might need some more thought though. The rules in general might need some tweaks here and there to get the optimum balance of network efficiency vs smoothness.

It appears that what happened in your screenshot is that a previously infrequent uploader uploaded a lot of videos around the same time.

ByJumperX4 commented 3 years ago

Those videos are stuck there, it's been two weeks that exactly the same videos are stuck above the rest, new videos goes below. And it's not like infrequent uploader, I have videos from the same youtubers that have been posted after the ones that are on top

user234683 commented 3 years ago

Hmm, the most likely cause is that the time_noticed variable is set to some time in the future for some reason. Try this:

  1. cd to ~/.youtube-local/data/
  2. python3 (to inter interactive mode)
  3. Execute this line: import sqlite3; conn = sqlite3.connect('./subscriptions.sqlite'); print(conn.execute('SELECT time_noticed, time_published FROM videos WHERE video_id = "video_id_here"').fetchone()); conn.close() (replace video_id_here with the video id of one of the videos that's stuck)
  4. Post the time values printed
ByJumperX4 commented 3 years ago

I get this: (1615073151, 1612627216) It it possible that the time is at a future date because when I changed of computer, I've set the system clock wrong of one month in the bios :/

user234683 commented 3 years ago

Indeed, the time_noticed is for March 6th, 2021. To fix it, backup your subscriptions.sqlite file and then execute this line: import sqlite3; import time; conn = sqlite3.connect('./subscriptions.sqlite'); conn.execute('UPDATE videos SET time_noticed=time_published WHERE time_noticed > ?', [time.time()+10]); conn.commit(); conn.close() I might put a button somewhere in the subscriptions manager to do this; I don't think there's any safe way to detect and fix it automatically.

ByJumperX4 commented 3 years ago

Thanks ! That fixed the problem ! :D