aag / apple_trailer_downloader

A script to download HD trailers from the Apple Trailers website.
GNU General Public License v3.0
23 stars 5 forks source link

Slow downloads #18

Open forthrin opened 4 years ago

forthrin commented 4 years ago

Some times downloads are very slow (like 10 minutes per trailer with a 50 megabit connection).

If I use wget, videos download at maximum bandwidth speed, but then sometimes throttles down to slow speed during the middle of the file. Also, it gets stuck on 99% some times.

Maybe the server gives you full speed as long as it can, but if there are too many users, it throttles, since the site admittedly is designed for streaming, not downloading?

Maybe a progress meter is a pragmatic solution, since then it gives the user an explanation for intermittent slowdowns, instead of just sitting there for ten minutes.

aag commented 4 years ago

I just want to let you know that I'm able to reproduce this problem, but I don't know what is causing it yet. I'll continue to look at it and see what I can find.

aag commented 4 years ago

An update on this: I've tried a number of different things, but nothing I've tried makes the whole file download at full speed.

I've tried changing the headers the script sends as well as various different methods for transferring files in Python. No matter what, the download gets throttled after a few seconds.

On the other hand, just using wget or curl on the URL with no headers results in a full-speed download.

I'll leave this issue open for now and consider giving the user a progress meter or something similar if I can't find a solution to the root problem.

forthrin commented 4 years ago

My experience was that the same thing happened with wget and even axel, so I think you may just have been temporarily lucky if wget worked for you. I don't think the phenomenon is the fault of your script (though I'm not 100 sure). That's why I suggested to add an ETA meter to get a overview of how often and how severely this is happening. If you do, make sure it prints the actual download time after it's reached 0:00. Something like below, where the bottom item is still downloading. (If you don't know the file size in advance, just counting upwards would work.)

 1:40  Star Wars 10
 1:38  Blade Runner 3
11:18  Police Academy 8
 3:40  Sharknado 17
forthrin commented 3 years ago

This seems to be the pattern:

1080p -- Either fast (<1 minute) or VERY slow (>10 minutes) 720p -- Always fast (~10 seconds)

It seems regardless of this utility. Same happens with curl, axel, etc.

Now, I checked the browser developer console, and get this: Even if I select "1080p" in the menu on the web player, the file that's actually streaming is 720p! And I have a 50 Mbit/s line, so why don't I get 1080p?

Can you check this on your side?

aag commented 3 years ago

This seems to be the pattern:

1080p -- Either fast (<1 minute) or VERY slow (>10 minutes) 720p -- Always fast (~10 seconds)

It seems regardless of this utility. Same happens with curl, axel, etc.

I see the same behavior.

Now, I checked the browser developer console, and get this: Even if I select "1080p" in the menu on the web player, the file that's actually streaming is 720p! And I have a 50 Mbit/s line, so why don't I get 1080p?

I'm also not able to get the web player to download the 1080p file in any Linux or Windows browsers. However, I discovered that using Safari on Mac OS does load the 1080p file, and it seems to consistently download quickly. I'll take a look and see if I can emulate what Safari is doing in the script.

kapps7 commented 2 years ago

I have set the config to only download at 1080p. I cant see a pattern. Some files download almost instantly (Im on 250MB/s) and others take many minutes irrespective of file size.

Do they have any 4k ?