-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Youtube video download slow #30583
Comments
YT made the client solve a puzzle in order to get full download speed. We can do that now (again, after YT broke it last night) and an imminent release will fix it. Or you can install from the git HEAD using pip, but as you're using the Windows .exe probably you should wait for the release. |
This issue also happened to me. using the last update, the download stuck at 74.93KiB/s Good luck team. |
Using the "fixed" version of the youtube.py, works now, but there is a problem. @dirkf Should i open a different issue with this? |
The results are supposed to be cached. In my original version, I had a local per-item memo so the descramble was only done once. This version is meant to use the player cache as in yt-dlp. You can see that it does so with I've only tested it on a scrap laptop (OK, I upgraded the CPU to T7700 2.4GHz) and I didn't see anything unusual. Equally I didn't Would you be able to try your playlist against yt-dlp as well, or reveal the URL anyway? |
I use it like a library in an app, so I can't use UPDATE: I couldn't make the older cashing code to work with the current changes. |
The code uses the IV S/t like this:
Here I'm assuming you have a different |
That was a nice idea, but unfortunately it produces an error:
|
This says fixed but I am getting 526 B/s downloads - slower than if I watched the video! Realplayer download works at 10 MiS but not what I want. I tried with both youtube-dl and yt-dlp both running that slow. |
The master version in the yt-dl repo is fixed. The fix is not in a released version yet. yt-dlp release 2022.02.04 should run unthrottled. |
If you can make a small program that reproduces the problem, we might be able to make progress. |
Unfortunately, I use Any already existing, simple threading example, will be greatly appreciated.. P.S. The updated extractor has the same results.. 😢 |
Sorry for the delay, but I was busy yesterday.. # coding=utf-8
from __future__ import absolute_import, division, print_function, unicode_literals
from queue import Queue
from threading import Thread, Event
import youtube_dl
# import yt_dlp as youtube_dl
ydl_opts = {'quiet': True, 'no_warnings': True}
link_ids = ["4jduuQh-Uho", "9GNpv7QDvMY", "MbEOR2Flc-4", "ZKUzNF21n9w", "y-JqH1M4Ya8",
"c5pi-SOlXQc", "pUqfaiUb3l4", "bL5eqSOXMtE", "HyMm4rJemtI", "BU4kGkrrJEw",
"pFS4zYWxzNA", "aF6hDcAbSoE", "G1ckKDRc69w", "o9_jzBtdMZ4", "AGoQZx8Mn0g",
"6W-pHCD6Tow", "kszLwBaC4Sw", "mwTd_PzGY-c", "iqLTYD_nhsU", "X335gdcPE7A",
"z_54vDk8lWw", "8a82arE0JSQ", "tJmzQHWl9kc", "8jPQjjsBbIc", "ENJUB5thpB4",
"dEhUMvjFuQY", "D6XyJh1tsGI", "tFCfb-Qqdz0", "UkafA6r1caQ", "OO8HtAXnRqQ",
"--da0m2K4I4", "EOlI0UtLDk4", "r7tQbxTImKw", "s_YLPcW4Tu8", "9wIbhES2UkA",
"YkX9X4td7j8", "14cHz4ebonY", "saVUUZE50Co", "N1K4NYHqMx4", "iCBL33NKvPA",
"QPTNS3llm2E", "pFS4zYWxzNA", "wA1v207xlOw"]
infos = []
class Base(object):
def __init__(self, **kwargs):
super(Base, self).__init__(**kwargs)
self.feed_q = Queue()
self.threads = []
for i in range(8):
thread = Worker(self.feed_q)
thread.daemon = True
self.threads.append(thread)
thread.start()
class Node(object):
pass
class Worker(Thread):
def __init__(self, feed_q):
super(Worker, self).__init__()
self.node = None
self.feed_q = feed_q
self.stop = False
def run(self):
while not self.stop:
self.node = self.feed_q.get()
url = "https://www.youtube.com/watch?v=" + self.node.id
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
try:
ydl_info = ydl.extract_info(url, download=False)
except Exception as e:
error_text = "A {0} occurred for {2}. Arguments:\n{1!r}"
print(error_text.format(type(e).__name__, e.args, url))
self.feed_q.task_done()
continue
infos.append(ydl_info)
print("Got info from {}".format(url))
self.node.updated.set()
while True:
if self.node.updated.wait(timeout=2):
break
self.feed_q.task_done()
if __name__ == "__main__":
base = Base()
print("Getting info for {} YouTube videos".format(len(link_ids)))
for tube_id in link_ids:
node = Node()
node.id = tube_id
node.updated = Event()
base.feed_q.put(node)
from timeit import default_timer as timer
start = timer()
base.feed_q.join()
print("Finished in {} seconds".format(round(timer() - start)))
The links are random, you can use whatever links you like.. |
FYI: Followed advice regarding pulling from 'master'.....
For those wishing to build, here's what I did ( for better or worse & whether correct or not... ): MAKE SESSION/git/youtube-dl$ make LS YOUTUBE-DL-rwxrwxr-x 1 god god 1849986 Feb 9 01:00 youtube-dl FAST DL SPEED[download] 100% of 51.86MiB in 00:04 |
If anyone has a Python installation with a recent pip (pip3), you can install the latest master branch (or any other commit level) directly from GitHub or a downloaded tar.gz. |
Tested the current latest master with the example above, and the time got improved from 96 to 76 secs. |
As a temporary fix you can use Aria2c external downloader to get split file downloading and/or batch file downloading, effectively removing throttle issues. |
CONFIRMING FIX ON MASTER: had throttling issue on 2022.12.17... pulled master > make = resolved [download] 43.0% of 274.52MiB at 15.43MiB/s ETA 00:10 |
i"m on windows, i don't understant your "fix". can you explain please :) |
This comment was marked as resolved.
This comment was marked as resolved.
The fix committed to the repo requires more than one file to be updated. @TagAcheron, #30583 (comment), or install Python and #30583 (comment). |
@dirkf Yes, I already had that update. |
Building and replacing the binaries, worked for me too |
Checklist
Verbose log
Description
I can't understand why my youtube download is so slow, can someone explain me what i'am missing here because my internet is like 45 Mbps
The text was updated successfully, but these errors were encountered: