Skip to content

Instantly share code, notes, and snippets.

@DBRussell123456
Forked from banteg/readme.md
Last active August 29, 2015 14:06

Revisions

  1. @banteg banteg revised this gist Sep 18, 2014. 2 changed files with 2 additions and 2 deletions.
    2 changes: 1 addition & 1 deletion itf.py
    Original file line number Diff line number Diff line change
    @@ -42,7 +42,6 @@ def download_show(tag, artist, quality='1080p'):
    token = requests.get('http://itunes.apple.com/apps1b/authtoken/token.txt').text
    cookies = {'token': token}
    output = artist.split('_')[-1] + ext
    open(output, 'w').close()

    files_url = 'http://streaming.itunesfestival.com/auth/eu1/vod/201409{}/v1/{}/{}_vod.m3u8'.format(tag, stream, artist)
    files = requests.get(files_url, cookies=cookies)
    @@ -51,6 +50,7 @@ def download_show(tag, artist, quality='1080p'):

    total = len(files)
    print('Downloading {} parts to {}'.format(total, output))
    open(output, 'w').close()

    for c, part in enumerate(files, start=1):
    print('Downlading part {}/{} {}'.format(c, total, part))
    2 changes: 1 addition & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@ Requires [Python](http://python.org/) and requests (```pip install requests```).
    ```quality``` 1080p, 720p or ac3 (default: 1080p)

    ### Example:
    To download AC-3 audio stream for Kasabian, type
    To download AC3 audio stream for Kasabian, type

    ```python itf.py 05 20478838_kasabian ac3```

  2. @banteg banteg revised this gist Sep 18, 2014. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -21,7 +21,7 @@ To download AC-3 audio stream for Kasabian, type
    You can mux .ts and .ac3 with [mkvmerge](http://www.videohelp.com/tools/MKVtoolnix).

    ---
    #### Shows available as of 17.09.2014:
    #### Shows available as of 18.09.2014:

    Artist | Command
    --- | ---
    @@ -59,5 +59,7 @@ The Script | ```python itf.py 15 277228393_thescript```
    Foxes | ```python itf.py 15 476901652_foxes```
    Blondie | ```python itf.py 16 1012882_blondie```
    Chrissie Hynde | ```python itf.py 16 2673957_chrissiehynde```
    Eric Whitacre | ```python itf.py 17 98293067_ericwhitacre```
    Gregory Porter | ```python itf.py 17 3437037_gregoryporter```

    Thanks **tdragonite** for original [bash script](https://gist.github.com/tdragonite/b084d4af4beefbde7ef9).
  3. @banteg banteg revised this gist Sep 17, 2014. No changes.
  4. @banteg banteg revised this gist Sep 17, 2014. 2 changed files with 55 additions and 11 deletions.
    41 changes: 33 additions & 8 deletions itf.py
    Original file line number Diff line number Diff line change
    @@ -4,6 +4,22 @@

    print('iTunes Festival London 2014 Downloader\n')

    QUALITY = {
    '1080p': ('8500_256', '.ts'),
    '720p': ('3500_256', '.ts'),
    'ac3': ('448', '.ac3')
    }


    def usage():
    print('''Usage:
    python itf.py
    python itf.py shows
    python itf.py <day> <artist> [quality]
    Options:
    quality 1080p, 720p or ac3 (default: 1080p)''')


    def shows_available():
    print('Shows available to download:\n')
    @@ -21,14 +37,14 @@ def shows_available():
    print('{}\npython itf.py {} {}\n'.format(*show))


    def download_show():
    _, tag, artist = sys.argv

    def download_show(tag, artist, quality='1080p'):
    stream, ext = QUALITY[quality]
    token = requests.get('http://itunes.apple.com/apps1b/authtoken/token.txt').text
    cookies = {'token': token}
    output = artist.split('_')[-1] + '.ts'
    output = artist.split('_')[-1] + ext
    open(output, 'w').close()

    files_url = 'http://streaming.itunesfestival.com/auth/eu1/vod/201409{}/v1/8500_256/{}_vod.m3u8'.format(tag, artist)
    files_url = 'http://streaming.itunesfestival.com/auth/eu1/vod/201409{}/v1/{}/{}_vod.m3u8'.format(tag, stream, artist)
    files = requests.get(files_url, cookies=cookies)

    files = [i for i in files.text.splitlines() if not i.startswith('#')]
    @@ -38,7 +54,7 @@ def download_show():

    for c, part in enumerate(files, start=1):
    print('Downlading part {}/{} {}'.format(c, total, part))
    part_url = 'http://streaming.itunesfestival.com/auth/eu1/vod/201409{}/v1/8500_256/{}'.format(tag, part)
    part_url = 'http://streaming.itunesfestival.com/auth/eu1/vod/201409{}/v1/{}/{}'.format(tag, stream, part)
    data = requests.get(part_url, cookies=cookies)
    with open(output, 'ab') as f:
    f.write(data.content)
    @@ -47,7 +63,16 @@ def download_show():


    if __name__ == '__main__':
    if len(sys.argv) == 1:
    if len(sys.argv) == 2:
    shows_available()
    elif len(sys.argv) == 3:
    _, tag, artist = sys.argv
    download_show(tag, artist)
    elif len(sys.argv) == 4:
    _, tag, artist, quality = sys.argv
    if not quality in QUALITY:
    print('Warning: unknown quality, defaulting to 1080p')
    quality = '1080p'
    download_show(tag, artist, quality=quality)
    else:
    download_show()
    usage()
    25 changes: 22 additions & 3 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,27 @@
    ## iTunes Festival London 2014 – Show Downloader

    Requires [Python](http://python.org/) and requests (```pip install requests```).

    Run ```python itf.py``` to see all shows available for download.
    ### Usage:
    ```python itf.py``` see this help

    ```python itf.py shows``` see shows available for download

    ```python itf.py <day> <artist> [quality]``` download specific show

    ### Options:
    ```quality``` 1080p, 720p or ac3 (default: 1080p)

    ### Example:
    To download AC-3 audio stream for Kasabian, type

    ```python itf.py 05 20478838_kasabian ac3```

    To download 6 channel AC-3 audio, replace ```8500_256``` with ```448``` and ```.ts``` with ```.ac3```.
    ### Note:
    You can mux .ts and .ac3 with [mkvmerge](http://www.videohelp.com/tools/MKVtoolnix).

    Shows available as of 16.09.2014:
    ---
    #### Shows available as of 17.09.2014:

    Artist | Command
    --- | ---
    @@ -40,5 +57,7 @@ David Gray | ```python itf.py 14 316381_davidgray```
    Lisa Hannigan | ```python itf.py 14 435150355_lisahannigan```
    The Script | ```python itf.py 15 277228393_thescript```
    Foxes | ```python itf.py 15 476901652_foxes```
    Blondie | ```python itf.py 16 1012882_blondie```
    Chrissie Hynde | ```python itf.py 16 2673957_chrissiehynde```

    Thanks **tdragonite** for original [bash script](https://gist.github.com/tdragonite/b084d4af4beefbde7ef9).
  5. @banteg banteg revised this gist Sep 16, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    Requires [Python 3](http://python.org/) and requests (```pip install requests```).
    Requires [Python](http://python.org/) and requests (```pip install requests```).

    Run ```python itf.py``` to see all shows available for download.

  6. @banteg banteg revised this gist Sep 16, 2014. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@ Run ```python itf.py``` to see all shows available for download.

    To download 6 channel AC-3 audio, replace ```8500_256``` with ```448``` and ```.ts``` with ```.ac3```.

    Shows available as of 15.09.2014:
    Shows available as of 16.09.2014:

    Artist | Command
    --- | ---
    @@ -38,5 +38,7 @@ Rae Morris | ```python itf.py 13 512065585_raemorris```
    Paolo Nutini | ```python itf.py 13 156669286_paolonutini```
    David Gray | ```python itf.py 14 316381_davidgray```
    Lisa Hannigan | ```python itf.py 14 435150355_lisahannigan```
    The Script | ```python itf.py 15 277228393_thescript```
    Foxes | ```python itf.py 15 476901652_foxes```

    Thanks **tdragonite** for original [bash script](https://gist.github.com/tdragonite/b084d4af4beefbde7ef9).
  7. @banteg banteg revised this gist Sep 15, 2014. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,9 @@ Requires [Python 3](http://python.org/) and requests (```pip install requests```

    Run ```python itf.py``` to see all shows available for download.

    Shows available as of 14.09.2014:
    To download 6 channel AC-3 audio, replace ```8500_256``` with ```448``` and ```.ts``` with ```.ac3```.

    Shows available as of 15.09.2014:

    Artist | Command
    --- | ---
    @@ -33,5 +35,8 @@ Nick Gardner | ```python itf.py 11 437945751_nickgardner```
    Nick Mulvey | ```python itf.py 12 336322969_nickmulvey```
    Elbow | ```python itf.py 12 3240611_elbow```
    Rae Morris | ```python itf.py 13 512065585_raemorris```
    Paolo Nutini | ```python itf.py 13 156669286_paolonutini```
    David Gray | ```python itf.py 14 316381_davidgray```
    Lisa Hannigan | ```python itf.py 14 435150355_lisahannigan```

    Thanks **tdragonite** for original [bash script](https://gist.github.com/tdragonite/b084d4af4beefbde7ef9).
  8. @banteg banteg revised this gist Sep 14, 2014. 2 changed files with 4 additions and 3 deletions.
    4 changes: 2 additions & 2 deletions itf.py
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@
    print('iTunes Festival London 2014 Downloader\n')


    def shows_availabe():
    def shows_available():
    print('Shows available to download:\n')

    atv = requests.get('https://appletv.itunesfestival.com/1b/en-GB/gb.json').json()['video_dict']
    @@ -48,6 +48,6 @@ def download_show():

    if __name__ == '__main__':
    if len(sys.argv) == 1:
    shows_availabe()
    shows_available()
    else:
    download_show()
    3 changes: 2 additions & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@ Requires [Python 3](http://python.org/) and requests (```pip install requests```

    Run ```python itf.py``` to see all shows available for download.

    Shows available as of 13.09.2014:
    Shows available as of 14.09.2014:

    Artist | Command
    --- | ---
    @@ -32,5 +32,6 @@ Maroon 5 | ```python itf.py 11 1798556_maroon5```
    Nick Gardner | ```python itf.py 11 437945751_nickgardner```
    Nick Mulvey | ```python itf.py 12 336322969_nickmulvey```
    Elbow | ```python itf.py 12 3240611_elbow```
    Rae Morris | ```python itf.py 13 512065585_raemorris```

    Thanks **tdragonite** for original [bash script](https://gist.github.com/tdragonite/b084d4af4beefbde7ef9).
  9. @banteg banteg revised this gist Sep 13, 2014. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion itf.py
    Original file line number Diff line number Diff line change
    @@ -10,10 +10,15 @@ def shows_availabe():

    atv = requests.get('https://appletv.itunesfestival.com/1b/en-GB/gb.json').json()['video_dict']
    vods = [atv[x] for x in atv if x.startswith('vod')]
    shows = []

    for show in vods:
    tag, artist = re.search('201409(\d{2})/v\d/(.*)_atv_vod\.m3u8', show['url']).groups()
    print('{}\npython {} {} {}\n'.format(show['title'], sys.argv[0], tag, artist))
    shows.append((show['title'], tag, artist))

    shows = sorted(shows, key=lambda x: x[1])
    for show in shows:
    print('{}\npython itf.py {} {}\n'.format(*show))


    def download_show():
  10. @banteg banteg revised this gist Sep 13, 2014. 1 changed file with 31 additions and 0 deletions.
    31 changes: 31 additions & 0 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -2,4 +2,35 @@ Requires [Python 3](http://python.org/) and requests (```pip install requests```

    Run ```python itf.py``` to see all shows available for download.

    Shows available as of 13.09.2014:

    Artist | Command
    --- | ---
    Friend Within | ```python itf.py 01 599207502_friendwithin```
    deadmau5 | ```python itf.py 01 78011850_deadmau5```
    Kate Simko & London Electronic Orchestra | ```python itf.py 01 76055920_katesimkolondonelectronicorchestra```
    Beck | ```python itf.py 02 312095_beck```
    Jenny Lewis | ```python itf.py 02 117038088_jennylewis```
    David Guetta | ```python itf.py 03 5557599_davidguetta```
    Robin Schulz | ```python itf.py 03 347433400_robinschulz```
    Clean Bandit | ```python itf.py 03 463049461_cleanbandit```
    Charlie Simpson | ```python itf.py 04 431245240_charliesimpson```
    5 Seconds of Summer | ```python itf.py 04 538811449_5secondsofsummer```
    Kasabian | ```python itf.py 05 20478838_kasabian```
    Tony Bennett | ```python itf.py 06 484980_tonybennett```
    Imelda May | ```python itf.py 06 206456819_imeldamay```
    Calvin Harris | ```python itf.py 07 201955086_calvinharris```
    Kiesza | ```python itf.py 07 301580396_kiesza```
    Robert Plant | ```python itf.py 08 288062_robertplant```
    Luke Sital-Singh | ```python itf.py 08 258535972_lukesitalsingh```
    SOHN | ```python itf.py 09 564248557_sohn```
    Sam Smith | ```python itf.py 09 156488786_samsmith```
    Jungle | ```python itf.py 10 825833522_jungle```
    Pharrell Williams | ```python itf.py 10 14934728_pharrellwilliams```
    Matthew Koma | ```python itf.py 11 449191736_matthewkoma```
    Maroon 5 | ```python itf.py 11 1798556_maroon5```
    Nick Gardner | ```python itf.py 11 437945751_nickgardner```
    Nick Mulvey | ```python itf.py 12 336322969_nickmulvey```
    Elbow | ```python itf.py 12 3240611_elbow```

    Thanks **tdragonite** for original [bash script](https://gist.github.com/tdragonite/b084d4af4beefbde7ef9).
  11. @banteg banteg revised this gist Sep 13, 2014. 2 changed files with 2 additions and 2 deletions.
    2 changes: 1 addition & 1 deletion itf.py
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@ def shows_availabe():

    for show in vods:
    tag, artist = re.search('201409(\d{2})/v\d/(.*)_atv_vod\.m3u8', show['url']).groups()
    print('{}\npython itf.py {} {}\n'.format(show['title'], tag, artist))
    print('{}\npython {} {} {}\n'.format(show['title'], sys.argv[0], tag, artist))


    def download_show():
    2 changes: 1 addition & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -2,4 +2,4 @@ Requires [Python 3](http://python.org/) and requests (```pip install requests```

    Run ```python itf.py``` to see all shows available for download.

    Thanks **tdragonite** for original [bash script](https://gist.github.com/tdragonite/b084d4af4beefbde7ef9).
    Thanks **tdragonite** for original [bash script](https://gist.github.com/tdragonite/b084d4af4beefbde7ef9).
  12. @banteg banteg revised this gist Sep 13, 2014. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    Requires [Python 3](http://python.org/) and requests (```pip install requests```).

    Run ```python itf.py``` to see all shows available for download.

    Thanks **tdragonite** for original [bash script](https://gist.github.com/tdragonite/b084d4af4beefbde7ef9).
  13. @banteg banteg created this gist Sep 13, 2014.
    48 changes: 48 additions & 0 deletions itf.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,48 @@
    import requests
    import sys
    import re

    print('iTunes Festival London 2014 Downloader\n')


    def shows_availabe():
    print('Shows available to download:\n')

    atv = requests.get('https://appletv.itunesfestival.com/1b/en-GB/gb.json').json()['video_dict']
    vods = [atv[x] for x in atv if x.startswith('vod')]

    for show in vods:
    tag, artist = re.search('201409(\d{2})/v\d/(.*)_atv_vod\.m3u8', show['url']).groups()
    print('{}\npython itf.py {} {}\n'.format(show['title'], tag, artist))


    def download_show():
    _, tag, artist = sys.argv

    token = requests.get('http://itunes.apple.com/apps1b/authtoken/token.txt').text
    cookies = {'token': token}
    output = artist.split('_')[-1] + '.ts'

    files_url = 'http://streaming.itunesfestival.com/auth/eu1/vod/201409{}/v1/8500_256/{}_vod.m3u8'.format(tag, artist)
    files = requests.get(files_url, cookies=cookies)

    files = [i for i in files.text.splitlines() if not i.startswith('#')]

    total = len(files)
    print('Downloading {} parts to {}'.format(total, output))

    for c, part in enumerate(files, start=1):
    print('Downlading part {}/{} {}'.format(c, total, part))
    part_url = 'http://streaming.itunesfestival.com/auth/eu1/vod/201409{}/v1/8500_256/{}'.format(tag, part)
    data = requests.get(part_url, cookies=cookies)
    with open(output, 'ab') as f:
    f.write(data.content)

    print('Done! Enjoy the show.')


    if __name__ == '__main__':
    if len(sys.argv) == 1:
    shows_availabe()
    else:
    download_show()