Apple Trailer Downloader

This isn’t currently working because of changes to Apple’s site. I hope to fix it before the end of the year.

I wanted all the movie trailers from Apple in the highest resolution available (1080p for most of them), so I wrote this script in python to fetch them all.


Update: I wasn’t very clear about this before. ATD keeps a database of what it’s already downloaded, so each time you run it, it will just download everything you haven’t downloaded yet.

This works through the command line in a very simple manner.

I’ll start out with some examples and then provide a full option list.

The following example will download 500 megabytes worth of trailers and save them to C:\Trailers.

atd -l 500 -d "C:\Trailers"

The next example will do the same and also append “-trailer” to the filename and change the extension to “.hdmov”.

atd -l 500 -d "C:\Trailers" -a "-trailer" -e "hdmov"

If there is a certain trailer you would like atd to download again (say you deleted the trailer on accident), you can call it as follows. The one downside to this method is that all this does is tell ATD to not skip this trailer when processing the trailer list. If it doesn’t make it to the movie because you’ve used the download limit option it won’t download it again. Changing this behavior is on my todo list.

atd --redown "Iron Man 2"

If you want the maximum resolution it downloads to be 480p you do it like so:

atd --respref "480p"

To get help you do this:

atd -h

Which will ouput:

Usage: atd [options]

If no options passed, it will download all not already downloaded trailers to a
subdir called Trailers.

  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -l MB, --downlimit=MB
                        Approxmiate megabytes to download per session
                        (default: 0)
  -d DIR, --dest=DIR    Destination directory. (default: Trailers)
  -a TEXT, --append=TEXT
                        Appends the specified text to the filename. (default:
  -r, --rename          Rename trailer with movies name.
                        Changes file extension to what is specified
  --redown=movie name   Redownloads the trailer for the specified movie.  Ex:
                        --redown Iron Man 2
  --flush               WARNING: This option deletes your download history
                        which means that all trailers will be downloaded again
  --respref=RESPREF     Get specified resolution or less.  Options are
                        ['1080p', '720p', '480p', '640w', '480']
  --reslimit=RESLIMIT   Get specified resolution or dont get trailer at all
  --mdate=DATE          Only get trailers for movies with a release date after
                        this. (format: YYYY-MM-DD)
  --tdate=DATE          Only get trailers released after this date. (format:
  --fake                Don't download, just print list of movies it would
                        download trailers for with the specified commandline.
                        (Ignores download limit)
  --htenfo              Writes an nfo file for use with the Home Theater
                        Experience XBMC script.
  --imdb                Fetches missing information like MPAA rating from
                        IMDB.  (Slows down parsing)

Please report any bugs or feature requests you may have. This script is dependent upon how Apple presents it’s trailers on the web. If they change the correct (or incorrect depending on how you look at it) things this script will break. I’ll do my best to keep up with such changes.

Newest Version

Version 0.2.2 is here.


ATD is now on github.

Older versions

Version 0.2.1 is here.

Version 0.2 for Windows users is here.
Version 0.2 for Linux users or users interested in the source can get it here.

Version 0.1 for Windows users is here.
Version 0.1 for Linux users or users interested in the source can get the source code here.

Planned Features

Rolling updates

With this feature, ATD will be able to keep a folder full of only trailers for movies past a certain date (for example, only trailers for movies that haven’t been released yet).  It will remove trailers for movies before the date and add/dl trailers for movies with new trailers.

Known Bugs

  • With --imdb, ATD fetches info for all trailers even if because of other options like --downlimit we’ve limited the number of trailers that will download.
  • Funkiness with --redown.
  • Unicode handling is currently a hackjob.
Leave a comment ?


  1. This script is absolutely amazing! Man. how you managed to circumvent all their defense measures?!

  2. I invoked it with this command:

    atd -r –respref=480p –mdate=2009-12-20

    It worked fine and downloaded 23 of 66 trailers until my ADSL modem reconnected. Then I invoked it again with the same command and expected it to continue with just the “missing” titles.

    However, the program started downloading from the first title again. Looks like it did not look if the file already exists in ./Trailers folder. Is the -r option causing this?

  3. Without the -mdate parameter, it got only the missing ones πŸ™‚

  4. Contriving » Apple Trailer Downloader .2 - pingback on January 8, 2010 at 5:45 pm
  5. This seems really cool, and hopefully I’m missing an obvious step … but all I get is this:

    D:\AppleTrailerDL> atd –fake
    Fetching trailer list from Apple.
    Traceback (most recent call last):
    File “”, line 560, in
    File “”, line 290, in download_trailers
    File “”, line 105, in _get_current_trailer_info
    File “xml\etree\ElementTree.pyc”, line 546, in __init__
    File “xml\etree\ElementTree.pyc”, line 587, in parse
    File “xml\etree\ElementTree.pyc”, line 1254, in close
    xml.parsers.expat.ExpatError: no element found: line 1, column 0


    I have tried it on Windows 7 and Windows 2008 and I get the same error(s).

    • @Jim:

      I’ll be sure and put in a more useful error message in the next version.

      It looks like something is broken on Apple’s end right now since the XML file they provide is currently empty instead of full of information about the trailers.

      Hopefully they fix it soon.

  6. @Jim: Apple fixed their stuff. It should work fine now.

  7. Contriving » Apple Trailer Downloader .2.1 - pingback on January 12, 2010 at 8:01 pm
  8. The file seems not to run on Ubuntu 8.04. It specifically complains about imdb not being able to import. Is there an archive including all of the files required for this to run on Hardy?

  9. @GJones: You need to install imdbpy. Looks like 8.04 has an imdbpy package:

    You’ll need to apt-get this or use Synaptic.

    Let me know if this works out for you.

  10. I have the same problem as Ilya above…..with mdate or tdate parameter set atd.exe will redownload all trailers….

    remove -mdate / -tdate and it behaves as expected…

    Is this a knonw bug?

    Thanks for any suggestions… and thinks in general for this amazing script! πŸ™‚

  11. Also, the script seems to be quitting before completion…..seemingly each time it gets to the trailer for “The Wolfman” ???

  12. That second problem seems to have been fixed by removing the –htenfo parameter.

    Does HTE only need the nfo if we want it to show trailers that match the genre and rating of the feature presentation?

  13. @kilboy6: -mdate/-tdate bug will be fixed soon.

    I’m not sure why it would be quitting. I’ll run a full download in a few minutes and see if I get the same problem.

    You’re correct about the –htenfo paramter. It’s only needed for HTE to filter by various things like trailer resolution/genre/rating. Actually, I don’t think it’s needed for anything just yet. I don’t think the current version of HTE even supports the .nfo files. I would assume it will be the next released version of HTE before support for these .nfo files is added.

    Anyway, I’ll see if I can figure out what the deal with your bug reports is. Thanks.

  14. @kilboy6: I’ve fixed the bug that was causing ATD to freak out on “The Wolfman”. New version available above.

  15. Working perfect for me on Ubuntu 9.10! Thanks, now I’ll be extending drop the movie in the correct location in my directory of movies.

    Wish there was a way to get download older trailers from years past.

  16. @Michael: Glad it’s working out for you.

    ATD is now on github if you want access to the latest source. (Updated post with link)

  17. Looks like an awesome script, however doesn’t seem to be working for me in Debian 5 or Ubuntu 9.10 – the script appears to run just fine, but all I’m left with are 0-byte .mov files when it’s done.

    Seems like it was working for people since the last release, apple issue maybe?

  18. Doesn’t seem to matter what options I specify..

    I’ve been running it as:

    #> python /usr/local/bin/atd-2.2/ –dest=”/media/trailers”

    The /media/trailers is world r/w, the trailer_dl.db file is created properly, it appears to want to download but no data ever comes down;

    #> ls -lh /media/trailers
    total 436K
    -rw-r–r– 1 pat pat 0 2010-01-29 12:38
    -rw-r–r– 1 pat pat 432K 2010-01-29 12:38 trailer_dl.db

    Stumped πŸ™‚

  19. When does the database of what’s already been downloaded get created? I have 6 trailers downloaded before having to stop the process. Started again and all my downloads are being repeated.

    • It currently only writes the database when it completes running in a normal manner. If you terminate it, the database never gets written.

      I’ll look in to changing this behavior in the next version.

  20. Hey Dustin,

    first of all, thank you for this excellent script.
    Let me also ask a question.
    I ran the script on 28 Feb for the first time, it downloaded somewhat 96 trailers.
    I ran it again today and it downloaded two new trailers:
    – The Young Victoria
    – Leaves of Grass
    Checking apple’s website the first one was posted on 3 Dec 2009 and the second one on 8 Feb.

    My question is why they are only downloaded today?
    And also, new trailers from 2 March haven’t been downloaded (Defendor, After.Life, The Runaway, etc.)

    I invoked the script both times with:
    atd.exe” –respref “720p” -d “z:\Trailers2” -r -a “”

    Am I doing something wrong which resulting the new ones are not going to be downloaded?

    Thank you for your feedback in advance!

    • @olympia: I suspect those are trailers it had trouble downloading because of connection issues or some such thing. I’m running a test with your commandline now (except I removed the extra quote marks you have).

  21. Hi Dustin,

    thanks for the feedback. Two comments:
    – I ran again the script in the afternoon and two of the 4 new trailers from yesterday has been downloaded (The Runaway and After.Life), but two is still remaining. Based on this most probably they will be downloaded as well at some future run…

    I needed the extra quotemarks, because I found no other way to save the trailers without the “-trailer” string addition.

  22. Hi Dustin,

    atd.exe –respref “720p” –tdate=2010-03-01 –fake
    Fetching trailer list from Apple.
    downloading because of trailer date: Karate Kid
    downloading because of trailer date: The Runaways
    downloading because of trailer date: Killers
    downloading because of trailer date: The Good Heart
    downloading because of trailer date: A Nightmare On Elm Street
    downloading because of trailer date: After.Life
    6 trailers to fetch. (Limiting dl to 0 MB)

    While there are 14 trailers after 1st of March. If the param should include the trailers from 1st of March too, then there are even more.

    To make it clear. This is really not a complaint, thank you for the wonderful script, I am just wondering if you can do anything about this?

    Thank you!

  23. Doesn’t seem to matter what options I specify..

    I’ve been running it as:

    #> python /usr/local/bin/atd-2.2/ –dest=”/media/trailers”

    The /media/trailers is world r/w, the trailer_dl.db file is created properly, it appears to want to download but no data ever comes down;

    #> ls -lh /media/trailers
    total 436K
    -rw-r–r– 1 pat pat 0 2010-01-29 12:38
    -rw-r–r– 1 pat pat 432K 2010-01-29 12:38 trailer_dl.db

    Stumped πŸ™‚

  24. @Bruce: This is due for a rewrite soon.

  25. I (and my kids) love this script however I would like to make a feature request. Is it possible to add a switch/parameter to filter on MPAA rating? Because HTE currently does not support the NFO file and because I use HTE mainly for the kids, it would be nice to only download PG or under rated movies. This prevents the likes of Saw IV trailer being shown before Princess & The Pea starts πŸ™‚ So a switch that supports multiple ratings and filters on them like –rating=PG|12 etc. I think would be great!

    Great job!

  26. Dustin – I’m having a problem with the –imdb switch. Getting the following error:

    Fetching trailer list from Apple.
    Attempting to fetch rating for Adjustment Bureau from imdb.
    2010-06-22 20:46:16,500 CRITICAL [imdbpy] imdb\_exceptions.pyc:35: IMDbDataAcces
    sError exception raised; args: ({‘url’: ‘;mx=20;q=
    adjustment+bureau+%282010%29’, ‘error type’: ‘http_error_default’, ‘errcode’: 40
    3, ‘headers’: , ‘proxy’: ”, ‘errmsg
    ‘: ‘Forbidden’},); kwds: {}
    Traceback (most recent call last):
    File “”, line 570, in
    File “”, line 284, in download_trailers
    File “”, line 214, in _get_current_trailer_info
    File “imdb\__init__.pyc”, line 381, in search_movie
    File “imdb\parser\http\__init__.pyc”, line 431, in _search_movie
    File “imdb\parser\http\__init__.pyc”, line 414, in _get_search_content
    File “imdb\parser\http\__init__.pyc”, line 400, in _retrieve
    File “imdb\parser\http\__init__.pyc”, line 167, in retrieve_unicode
    File “urllib.pyc”, line 206, in open
    File “urllib.pyc”, line 361, in open_http
    File “urllib.pyc”, line 378, in http_error
    File “imdb\parser\http\__init__.pyc”, line 221, in http_error_default
    imdb._exceptions.IMDbDataAccessError: {‘url’: ‘;mx
    =20;q=adjustment+bureau+%282010%29’, ‘error type’: ‘http_error_default’, ‘errcod
    e’: 403, ‘headers’: , ‘proxy’: ”, ‘
    errmsg’: ‘Forbidden’}

    I’d like to run this feature because often the trailers are “Not yet rated”. If this does what I think it does then it goes to imdb to get the correct MPAA rating instead of using the one on Apple’s website. Very useful for me as I’m using this with HTE and trying to make a mod to that script so trailers play by rating.


  27. Dustin, one more request. Currently the description tag in the NFO file contains special characters which means the NFO cannot be parsed by an XML reader. Can these be parsed out or converted prior to writing to the NFO file? As an example ampersand is found in a lot of the descriptions, this should be &.


  28. I’ve been using this application for a while, but since the begin of july it stopped downloading trailers. I’m not getting any errors. The application just quits.

  29. Hi,

    I can’t make this work. It says downloading but it never actually does. What are the requirements and install location for these files? Thanks in advance.

  30. 12aon:

    I’d be surprised if this script is currently functioning.

    Apple made changes to their website and this script needs updating to handle that.

    Unfortunately, I’ve been too busy to make these updates yet.

  31. So this isn’t working, correct? I got my cmd line all figured out then got to the very bottom to ask a question (whether -d supports UNC paths) and noticed your post. πŸ˜‰

  32. @JG: That is correct.

    I’ll post a note at the beginning of the post to note that it isn’t working right now.

    I will be working on this again soon since I’ll need this scripts functionality in another project I’m working on.

  33. I’m pretty close to releasing a completely rewritten version of this.

    Just thought I’d post a note here to anyone that is following along.

  34. Any updates on the progress of the new version?

  35. Yeah, I still miss this program. I’m using HD-trailers downloader for XBMC now, but it just isn’t the same πŸ™

  36. Keep up the good piece of work, I read few posts on this web site and I think that your blog is really interesting and holds bands of wonderful info .

  37. Thanks for the post and your script Dustin.

    Here is my perl script to download trailers if any one interested,

Leave a Reply to pakar digital marketingCancel reply

Trackbacks and Pingbacks: