Kethsar / ytarchive

Garbage Youtube livestream downloader
MIT License
1.08k stars 87 forks source link

seek up to 5 days, not from 0 #91

Closed Lesmiscore closed 1 year ago

Lesmiscore commented 2 years ago

As YT only retains up to 5 days for seeking, it detects and adjusts sequence number to keep it working.

For any long enough livestreams, you'll get:

$ ./ytarchive -v https://www.youtube.com/watch?v=fEvM-OUbaKs best --threads 32
ytarchive 0.3.1
Selected quality: 720p (h264)
2022/05/05 03:44:06 INFO: Starting download to /home/lesmi/ytarchive-py/fEvM-OUbaKs__3833454310/Coffee Jazz Music - Chill Out Lounge Jazz Music Radio - 24_7 Live Stream - Slow Jazz-fEvM-OUbaKs.f140.ts
2022/05/05 03:44:06 INFO: Starting download to /home/lesmi/ytarchive-py/fEvM-OUbaKs__3833454310/Coffee Jazz Music - Chill Out Lounge Jazz Music Radio - 24_7 Live Stream - Slow Jazz-fEvM-OUbaKs.f136.ts
2022/05/05 03:44:06 WARNING: video: YT only retains the livestream 5 days past for seeking, starting from sequence 1125174 (latest is 1211574)
2022/05/05 03:44:06 WARNING: audio: YT only retains the livestream 5 days past for seeking, starting from sequence 1125174 (latest is 1211574)
Video Fragments: 363; Audio Fragments: 363; Max Sequence: 1211585; Total Downloaded: 56.17MiB
Kethsar commented 2 years ago

Just gonna say I did see this, but keep forgetting to get around to testing and reviewing it, sorry. 5 days of data cached makes sense from experience of some users, though from what I understand that's not a guarantee is it? Most streams I've experimented with have "maxDvrDurationSec": 43200.0 set in the response object. Did the streams you tested with have this same time, or were they properly set to 432000.0 instead?

Lesmiscore commented 2 years ago

That should be used, I suppose. I'll do a few more investigation about it.

Lesmiscore commented 2 years ago

43200 from maxDvrDurationSec (which is exactly 12 hours) seems to be the seekable duration on player, not their maximum length it has. The limit of 5 days is given by actually tinkering with sq value, which is what I did to implement --live-from-start in yt-dlp.

Actually, I don't think you can get 432000 from Innertube response, though.

Kethsar commented 2 years ago

Okay, I was asking because, as said in my comment, it doesn't seem to be a guarantee. There have been times I and others have tried to start recording streams past the 12 hour mark and it fails, and then people that seem to have no issues if it's within that 5 day length you have set. I'll do some testing at some point and see if it ends up consistent and the 12 hour mark is no longer a thing.

jpfl commented 9 months ago

is there a way to only download the last x amount of hours of a live stream by a time parameter or making the program download only onward from a certain sequence number but not the maximum available sequence number in the past?