26 Comments

Apple Trailers Fix

HeaderAs some of you may have found out or read about, Apple trailer downloads for Linux are currently broken. Apple has implemented a Quicktime user agent check prior to downloading. Personally I agree with the decision because Apple is concerned about the quality of reproduction (though Apple trailers still play with an odd hue on Windows – think this has to do with Quicktime not correctly reading Window’s color setting – but I’m getting off topic). This means that movie players plugins for web browsers (like gecko-mediaplayer and totem) will no longer work. Until gstreamer gets a patch that fix’s this, here’s a script that can download them manually. To use the script, right-click on the download link and copy it to the clipboard then append it after the atget script.

You can comment wget line and uncomment the mplayer line to directly play the trailer. The mplayer line needs to have a cache to be sure the video is downloaded before it start or errors will occur (200MB should be enough for just about and video on the site).

Credits

  • Thanks to Ian on stack overflow, who help me figure out how to prepend a regex search.
About these ads

About Gen2ly

<3's linux

26 comments on “Apple Trailers Fix

  1. Great script. Many thanks. :)

    Would it be possible to modify the script to allow downloading of multiple trailers in queued fashion?

  2. > Great script. Many thanks. :)

    No problem. Glad you could make use of it.

    > Would it be possible to modify the script to allow downloading of multiple trailers in queued fashion?

    Yeah, that’s definitely possible. I’ll see if I can get to in in the next couple days.

  3. Btw, check out the update to the post you’ve linked to (http://mirzmaster.wordpress.com/2009/08/20/apple-movie-trailer-downloads-are-broken/). HD-trailers.net claim that simply changing the URL from movies.apple.com to http://www.apple.com should permit direct download (without a User Agent switch)

  4. Good tip. Wonder though if Apple will make that link eventually require a user agent too.

  5. Thanks for the post. I updated my wget with “-U” flag and the user agent code used with mplayer in your code so I can download trailers again.

  6. That was helpful, thanks!

    By the way, what do you use to insert the code snippets? Just manually wrap them in

     and  with a custom CSS style?
  7. Right, the comments DO allow html tags. Here’s what I wanted to post:

        Just manually wrap them in <pre> and &ltdiv> with a custom CSS style?

  8. Thank you.

    For the css I use a html/css editor call Arachnophilia and create my own custom tags. It was a pain to sort out because they can sometimes conflict with the built in ones but if you find the right scheme they can work nicely. Here’s my bash script one in case you can use it:

    <pre><div style="overflow: auto; width=auto; border: solid #c8c8c8; border-width: .1em .1em .1em .8em; padding: .2em .6em .2em .6em; background-color: #dddddf; font-size: 1em;white-space:pre;">|</div></pre>

    Thanks for droppin’ in.

  9. @Gen2ly: I wrote a small app to automate the snippets highlighting, feel free to use it.

  10. Hey cool! Nice. Just had a few things come up though that you should probably know about. I discovered that using div tags for code causes the browser to use western-encoding which I think uses microsoft font (i.e. not UTF-8) encoding. Therefore in the process converts a few characters over to microsoft font value. I particularly had problems with quotes. I’ve since written a new css box with a formatted pre tag that gets the expected behavior:

    <pre style="overflow: auto; width=auto; border: solid #c8c8c8; border-width: .1em .1em .1em .8em; padding: .2em .6em .2em .6em; background-color: #dddddf; font-size: .9em;white-space:pre;"></pre>

    Try it out if you like and tell me what you think.

  11. The method I’m using at hilite.me seems to work fine with Unicode characters and quotes:

    print '"""тестÆÇçæǡ"""'
    

    I’m actually using a pre <tag> wrapped in <div>, not the other way around. It’s the default method of Pygments – the highlighting library I use. I think it’s functionally equivalent to what you are doing with a single <pre> tag.

  12. Yeah, I didn’t have problems with it until recently. The problems I have encountered to could be from a number of problems but I have had a couple people tell me that they had problems with the code boxes. I tested this method out on those trouble scripts. I’m not sure it’s quotes, could be with non-breaking spaces… So if it works for you…

  13. Hey, Gen2ly, your readers may find that in the last few days Apple again broke trailer downloads. I’ve written up a tutorial on using Firefox, Greasemonkey, and a user agent hack to get it working again:

    http://mirzmaster.wordpress.com/2009/10/09/helpful-hints-apple-movie-trailers-download-using-firefox-greasemonkey-and-user-agent-hack/

    Thanks!

  14. I’d thought I’d post this because it’s pretty dang cool. Got this from lollicon on the forums and it reads the Apple trailer webpage and gets the current trailers lists for the opening weekend, then prompts which one to download:

    #!/bin/bash
    
    ###:: Apple Trailer Checker and Downloader. (www.apple.com/trailers/)
    
    Q='720p' # 480p, 720p, 1080p
    M='WBO'  # WBO, OTW, ONE
    C='1'    # Yes, cURL
    D='.'    # Directory
    J='20'   # Threads
    CLR='\x1b[37;22m' # Text Color
    EOC='\x1b[m'
    
    TEMP='/tmp/aPpLeTrAiLeRcHeCk'
    ROOT='http://www.apple.com'
    FAKE='QuickTime/7.6.2 (qtver=7.6.2;os=Windows NT 5.1Service Pack 3)'
    
    while getopts 'q:012n' opt ; do
       case $opt in
          q) Q=$OPTARG ;;
          0) M='ONE'   ;;
          1) M='WBO'   ;;
          2) M='OTW'   ;;
          n) C='0'     ;;
       esac
    done
    shift `expr $OPTIND - 1`
    
    [ $C == 1 ] && curl -s $ROOT/trailers/ -o "$TEMP"
    
    if [ "$M" == 'WBO' ] ; then
       IFS='
    '
       WBO_U=($(sed '/Weekend Box Office/,/weekendboxoffice/!d;/<li>/!d' "$TEMP" | cut -d\" -f4))
       unset IFS
    
       echo -ne "$CLR"
       echo '--== Weekend Box Office ==--'
       sed '/Weekend Box Office/,/weekendboxoffice/!d;/<li>/!d;s/<[^>]*>//g;s/&amp;/\&/g;s/&hellip;/.../;s/^\t*/   /' "$TEMP"
       echo -ne "$EOC"
    
       echo 'Which ones are you interested in?' # e.g. reply:1 3 10
    
       read -a WBO_C
       for i in ${WBO_C[@]} ; do
          ((i--))
          #echo ${WBO_U[$i]}
          curl -s $ROOT${WBO_U[$i]} -o "$TEMP"X
          tr '<>' '\n' < "$TEMP"X | grep -F "$Q.mov" | sed 's/.*\(http.*_\)\([0-9]*p\.mov\).*/\1h\2/' |
          while read url ; do
             #echo $url
             aria2c -d "$D" -j "$J" -U "$FAKE" "$url"
          done
       done
    elif [ "$M" == 'OTW' ] ; then
       IFS='
    '
       OTW_U=($(sed '/Opening this Week/,/openingthisweek/!d;/<li>/!d' "$TEMP" | cut -d\" -f4))
       unset IFS
    
       echo -ne "$CLR"
       echo '--== Opening this Week ==--'
       sed '/Opening this Week/,/openingthisweek/!d;/<li>/!d;s/<[^>]*>//g;s/&amp;/\&/g;s/&hellip;/.../;s/^\t*//' "$TEMP" | sed '=' | sed 'N;s/\n/. /;s/^/   /'
       echo -ne "$EOC"
    
       echo 'Which ones are you interested in?'
    
       read -a OTW_C
       for i in ${OTW_C[@]} ; do
          ((i--))
          #echo ${OTW_U[$i]}
          curl -s $ROOT${OTW_U[$i]} -o "$TEMP"X
          tr '<>' '\n' < "$TEMP"X | grep -F "$Q.mov" | sed 's/.*\(http.*_\)\([0-9]*p\.mov\).*/\1h\2/' |
          while read url ; do
             #echo $url
             aria2c -d "$D" -j "$J" -U "$FAKE" "$url"
          done
       done
    elif [ "$M" == 'ONE' ] ; then
       url=$(echo "$1" | sed 's/[0-9]*p.mov$/h&/')
       aria2c -d "$D" -j "$J" -U "$FAKE" "$url"
    fi
  15. Just wanted to say thanks for this. Not so much the script (though that is neat), but for the information on what Apple was using to block my access and what to add to wget to get it back. Silly Apple.

  16. You rock! :) Was trying to find an easy way to do this for some time! :)

  17. Sadly not working here.

    ./qt http://movies.apple.com/movies/independent/captainaburaed/captainaburaed_720p.mov
    –2010-01-20 20:30:09– http://movies.apple.com/movies/independent/captainaburaed/captainaburaed_h720p.mov
    Resolving movies.apple.com… 72.246.30.59, 72.246.30.72
    Connecting to movies.apple.com|72.246.30.59|:80… connected.
    HTTP request sent, awaiting response… 302 Moved Temporarily
    Location: http://www.apple.com/trailers/ [following]
    –2010-01-20 20:30:09– http://www.apple.com/trailers/
    Resolving http://www.apple.com... 72.247.109.15
    Connecting to http://www.apple.com|72.247.109.15|:80… connected.
    HTTP request sent, awaiting response… 200 OK
    Length: 24243 (24K) [text/html]
    Saving to: `/home/rob/Desktop/captainaburaed_720p.mov’

    100%[======================================>] 24,243 –.-K/s in 0.06s

    2010-01-20 20:30:09 (366 KB/s) – `/home/rob/Desktop/captainaburaed_720p.mov’ saved [24243/24243]

  18. Thanks, that’s a good idea!

    I have pimpt the original script a little bit. With this version you can save the links you want in a file and download one after one automaticaly in a predifined place.

    #!/bin/bash
    
    trailerdir="/home/username/trailers"
    mkdir -p "$trailerdir" || exit 1
    
    trailerfile="${trailerdir}/trailers.txt"
    if [ ! -f "$trailerfile" ]; then
    	echo "the trailer-link-file doesn't exist at \"$trailerdir\""
    fi
    
    # first trailer link
    trailer="$(head -n1 $trailerfile)"
    
    while [ "$trailer" != "" ]; do
    	# Prepend 'h' before resolution to create a valid url
    	newurl=$(echo $trailer | sed 's/_\([0-9]*[0-9][0-9][0-9]\)p.mov/_h\1p.mov/g')
    
    	# Download trailer and save to the desktop
    	wget -U QuickTime/7.6.2 "$newurl" -O "${trailerdir}/${trailer##*/}" || exit 1
    
    	# Play trailer with mplayer (using 200MB cache to be sure trailer is dl'd first)
    	#mplayer -cache 200000 -user-agent 'QuickTime/7.6.2 (qtver=7.6.2;os=Windows NT 5.1Service Pack 3)' $newurl
    
    	sed "/$(echo $trailer | sed 's/.*\///')/d" "$trailerfile" > "${trailerfile}.tmp"
    	mv "${trailerfile}.tmp" "$trailerfile"
    	trailer="$(head -n1 $trailerfile)"
    done
  19. thank you for sharing this information … nice

  20. i always watch moview trailers on youtube, it is really fun to watch so many movie trailers at once “‘*

  21. [...] A “solution” for watching them: #!/bin/bash # atget – download trailers from Apple website # Usage if no parameters given if [ -z $@ ]; then echo " atget "; exit fi # Prepend 'h' before resolution to create a valid url newurl=$(echo $@ | sed 's/_([0-9]*[0-9][0-9][0-9])p.mov/_h1p.mov/g') # Download trailer and save to the desktop wget -U QuickTime/7.6.2 "$newurl" -O $HOME/Desktop/${@##*/} From Linuxtidbits. [...]

  22. To us, who aren’t techie and have no knowledge about these codes is always a challenge, good thing to have such information and post like this around to keep us updated with whats new. Thanks.

  23. I need to to thank you for this fantastic read!! I certainly loved every little bit of it.
    I have got you bookmarked to check out new stuff you post…

  24. Don’t purchase every single dress in distinct shop. In case you are mostly of the items are often, inform the mediocre ones head over to shop your own dresses inside the exact same store. They’ll absolutely offer you a price cut, if your most people the wedding social gathering accept have got a keep shopping, such as the bride, the consideration and also the floral females. The charge will likely be a lesser amount of in case every body acquire attire available as one special shop. Maybe you must take your spending budget into mind, and check your very best self to buy the budget bridesmaids gown.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 43 other followers

%d bloggers like this: