Automatically Downloading Quicktime Trailers and Posters

I’ve written a bash shell script to automatically download the latest Apple Quicktime Movie trailers for consumption on our HTPC. This script will download high definition trailers and fall back to lower resolutions for any trailers that are not published in HD while keeping a record of downloads to avoid duplicates. The movie posters for each trailer are also optionally downloaded which can be used as cover-art for the trailer files in most of the popular HTPC front-ends. Please let me know if you have any comments, questions or suggestions.

Mediaportal HTPC Front-end: “My Videos” View of downloaded Apple Trailers.

Generic setup overview for a Debian based Linux system:

  1. Run “sudo apt-get install xmlstarlet wget” to install xmlstarlet and wget if not already installed on your system.
  2. Modify the script and configure “GET1080p=”, “GETPOSTER=”, “SAVEPATH=”, “DLDBPATH=” and the “EUID” number of the user running the script.
  3. Create an empty “.appletrailers.db” plain text file in the defined “DLDBPATH” with the appropriate permissions.
  4. Create the “SAVEPATH=” path with appropriate permissions for the script to save the trailers and posters.
  5. Execute the script manually and make sure everything is working as expected.
  6. Create an appropriate weekly crontab entry for the script.


v0.5 090825 – fix for Apple changes requiring Quicktime user-agent. download: appletrailers.0.5

v0.4 090225 – fix for stale 720p XML feed

  • I recently noticed that the the 720p XML feed from Apple is not being updated. This updated version will utilize the SD XML feed from Apple to make an educated guess for the the HD trailer URL. This work-around with some quick testing shows it’s working 100% for everything recently posted in the feed.
  • The current work-around for the stale 720p feed will only work if you have “GET1080=1” set. I’m not downloading the 720p trailers and the work-around for 720p trailers and I simply wasn’t motivated to fix something I wasn’t using. If anyone using this script is downloading the 720p versions of the trailers please post feedback and might be motivated to post another update for this. It’s also very possible that the stale 720p feed from Apple is a temporary situation.

v0.3 090123 – fix for h720 a720 filenames encountered recently in the feeds and minor regex fixes.

  • regex updated to correctly handle trailer filenames with h720 or a720.
  • regex fixes to escape periods correctly.
v0.2 081222 – fix for .m4v extension in XML feeds and other minor improvements.
  • removed the logic responsible for renaming .mov file extension to .hdmov: This rename does not seems to be necessary for most media players I have tested against. The rename would cause problems with hardware devices such as the NMT PCH do not support the .hdmov extension and have no user-end method to add supported extensions.
  • added handing for .m4v trailers: This was something that recently started showing up in the XML feeds. The work-around to handle this replaces the .m4v file extension in the feed with a .mov extension which Apple is still publishing on the servers.
  • updated logic for tracking completed downloads: The logic was changed to accommodate the new .m4v extension that started showing up in the XML feeds. The logic is also slightly improved to avoid false positives against the already downloaded database. The script now checks for the ID and filename excluding resolution and extensions portions.
v0.1 081013 – initial release

Posted by luke on 01:10 pm - Monday October 13 2008

4 Responses to “Automatically Downloading Quicktime Trailers and Posters”

  • Sean says:

    Hey guys,
    For some reason, the download isn’t working for me. I’m using Safari under OS X, but I’ve tried it in Firefox too, as well as firing up Linux Mint in a VM. It just redirects me back to this post.
    Is there any chance you could put the source somewhere like pastebin, or email me the script (smenus [at] me [dot] com)?

  • Sean says:

    Thanks Luke! Haven’t had a chance to try the script yet, but it looks lovely.

    This is going to make my XBMC setup just that little bit more awesome!

    Thanks again,

  • LG says:

    Line 13, you should use $SAVEPATH instead of your hardcoded path