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

Support for multiple trailers per URL #2

Closed forthrin closed 8 years ago

forthrin commented 8 years ago

Hi!

Great utility! I've been looking for this for a while!

However, it only seems to download one trailer per page, even though there might be several.

For example, this URL has two trailers, and thus both should be downloaded:

http://trailers.apple.com/trailers/lucasfilm/starwarstheforceawakens/

Could you commit a change that would support this?

Thanks!

aag commented 8 years ago

I've added support to the script for multiple videos per page. The default is still to just download the first trailer, but there is now a video_types config option in the settings file that lets you download multiple videos. The options are explained in settings-example.cfg, but here they are again:

Please give it a try and let me know if you find any bugs or if these options don't satisfy your use case.

Note: the script now uses a slightly different method to figure out which video is Trailer 1. Previously, it used the file name in the URL, but now it uses the name of the video as displayed on the web page. So, for example, on this page:

http://trailers.apple.com/trailers/sony_pictures/thenightbefore/

The trailer filename looks like "Trailer 3", because it contains tlr3, so the script previously didn't identify it as Trailer 1. But now that it uses the title displayed on the web page, "Trailer", it is correctly identified. This means that some files might get re-downloaded under different names than previously.