Last active
August 31, 2017 21:32
-
-
Save dreness/d4180e9032960f5f9cdc71a3850d0f51 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import json | |
import urllib2 | |
from pprint import pprint | |
# These URLs are discovered by viewing https://developer.apple.com/wwdc/live/#/ | |
# and using the web inspector to find the wwdc-streaming javascript. | |
# Currently: https://developer.apple.com/wwdc/live/scripts/app/min/wwdc-streaming-0.1.0.min.js | |
# Search that javascript for "videos.json" and "videos_live.json" | |
live = "https://devimages-cdn.apple.com/wwdc-services/g7tk3guq/xhgbpyutb6wvn2xcrbcz/videos_live.json" | |
videos = "https://devimages-cdn.apple.com/wwdc-services/g7tk3guq/xhgbpyutb6wvn2xcrbcz/videos.json" | |
# Target year (for VODs) | |
year = "2016" | |
live_format = "iosUrl" | |
#live_format = "tvosUrl" | |
vod_format = "download_hd" | |
#vod_format = "download_sd" | |
print "LIVE" | |
response = urllib2.urlopen(live) | |
js = response.read() | |
j = json.loads(js) | |
seenkeys = [] | |
live_vids = [] | |
for id, v in j['live_sessions'].iteritems(): | |
if v['actualEndDate'] is None: | |
d = v['images'].values()[0] | |
d = d.split("/")[-1] | |
d = d.split(".")[0] | |
if d not in seenkeys: | |
live_vids.append({d: v[live_format]}) | |
seenkeys.append(d) | |
# These have fairly short descriptions, so do 2 column output | |
width = 0 | |
for x in live_vids: | |
width = max(width, len(x.keys()[0])) | |
for x in live_vids: | |
print("{desc:<{width}} {url}".format(desc=x.keys()[0], url=x.values()[0], width=width+2)) | |
print "\nVODs" | |
response = urllib2.urlopen(videos) | |
js = response.read() | |
j = json.loads(js) | |
# Longer descriptions; 2 line output per video | |
for s in j['sessions']: | |
if str(s['date']).startswith(year) and s[vod_format] is not None: | |
if s['title'] is not None: | |
print s['title'] | |
print("{}\n".format(s[vod_format])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
╭─ andre@flux ~/bin
╰─ $ python wwdc_videos.py
LIVE
app_frameworks_734x413 http://devstreaming.apple.com/videos/wwdc/2016/live/nobhill_im1va1heedd7ith/hls_mvp.m3u8
system_frameworks_734x413 http://devstreaming.apple.com/videos/wwdc/2016/live/nobhill_im1va1heedd7ith/hls_mvp.m3u8
developer_tools_734x413 http://devstreaming.apple.com/videos/wwdc/2016/live/pacheights_ob2wof8og5tu3if/hls_mvp.m3u8
graphics_and_games_734x413 http://devstreaming.apple.com/videos/wwdc/2016/live/mission_ghub2yon5yewl2i/hls_mvp.m3u8
distribution_734x413 http://devstreaming.apple.com/videos/wwdc/2016/live/presidio_greys2jog1ot6u7/hls_mvp.m3u8
media_734x413 http://devstreaming.apple.com/videos/wwdc/2016/live/mission_ghub2yon5yewl2i/hls_mvp.m3u8
design_734x413 http://devstreaming.apple.com/videos/wwdc/2016/live/presidio_greys2jog1ot6u7/hls_mvp.m3u8
VODs
What's New in watchOS 3
http://devstreaming.apple.com/videos/wwdc/2016/208j30f4v1a1i9i5fg9/208/208_hd_whats_new_in_watchos_3.mp4
Go Live with ReplayKit
http://devstreaming.apple.com/videos/wwdc/2016/601nsio90cd7ylwimk9/601/601_hd_go_live_with_replaykit.mp4
Mastering UIKit on tvOS
http://devstreaming.apple.com/videos/wwdc/2016/210e4481b1cnwor4n1q/210/210_hd_mastering_uikit_on_tvos.mp4
What's New with Wallet and Apple Pay
http://devstreaming.apple.com/videos/wwdc/2016/704s1a6rjyi2dqhhyi7/704/704_hd_whats_new_with_wallet_and_apple_pay.mp4
Typography and Fonts
http://devstreaming.apple.com/videos/wwdc/2016/803z7m1ln9vmbpg35x9/803/803_hd_typography_and_fonts.mp4
Apple Pay on the Web
http://devstreaming.apple.com/videos/wwdc/2016/703rx8zlfedjfom6l93/703/703_hd_apple_pay_on_the_web.mp4
What's New in tvOS
http://devstreaming.apple.com/videos/wwdc/2016/206a38wgme6uponcuwd/206/206_hd_whats_new_in_tvos.mp4
Internationalization Best Practices
http://devstreaming.apple.com/videos/wwdc/2016/201h1g4asm31ti2l9n1/201/201_hd_internationalization_best_practices.mp4
Optimizing App Startup Time
http://devstreaming.apple.com/videos/wwdc/2016/406i3zbazbegkeh0udt/406/406_hd_optimizing_app_startup_time.mp4
Introducing Expanded Subscriptions in iTunes Connect
http://devstreaming.apple.com/videos/wwdc/2016/301fbtjd9exjetky78s/301/301_hd_introducing_expanded_subscriptions_in_itunes_connect.mp4
What's New in Foundation for Swift
http://devstreaming.apple.com/videos/wwdc/2016/207i37356qcyyh2yxos/207/207_hd_whats_new_in_foundation_for_swift.mp4
What's New in LLVM
http://devstreaming.apple.com/videos/wwdc/2016/405i2ilotov3bazyei1/405/405_hd_whats_new_in_llvm.mp4
Apple Design Awards
http://devstreaming.apple.com/videos/wwdc/2016/103m0752oxdkymyk6gy/103/103_hd_apple_design_awards.mp4
Auditing Your Apps for Accessibility
http://devstreaming.apple.com/videos/wwdc/2016/407itxn2ujs52fwcgw5/407/407_hd_auditing_your_apps_for_accessibility.mp4
Advances in AVFoundation Playback
http://devstreaming.apple.com/videos/wwdc/2016/503lkp4vimgv7tqecn7/503/503_hd_advances_in_avfoundation_playback.mp4
Introduction to Notifications
http://devstreaming.apple.com/videos/wwdc/2016/707s77u9e6pv0dy9ggm/707/707_hd_introduction_to_notifications.mp4
What's New in Security
http://devstreaming.apple.com/videos/wwdc/2016/706sgjvzkvg6rrg9icw/706/706_hd_whats_new_in_security.mp4
What's New in Cocoa Touch
http://devstreaming.apple.com/videos/wwdc/2016/205n2okotvilcayc8rc/205/205_hd_whats_new_in_cocoa_touch.mp4
iMessage Apps and Stickers, Part 1
http://devstreaming.apple.com/videos/wwdc/2016/204t23fvanrkj7a1oj7/204/204_hd_imessage_apps_and_stickers_part_1.mp4
Advances in iOS Photography
http://devstreaming.apple.com/videos/wwdc/2016/501l32ujtbnw2ad06wy/501/501_hd_advances_in_ios_photography.mp4
Introducing Apple File System
http://devstreaming.apple.com/videos/wwdc/2016/701q0pnn0ietcautcrv/701/701_hd_introducing_apple_file_system.mp4
Getting Started with Swift
http://devstreaming.apple.com/videos/wwdc/2016/404hskg1ijeev16mdej/404/404_hd_getting_started_with_swift.mp4
Swift API Design Guidelines
http://devstreaming.apple.com/videos/wwdc/2016/403hb0ie2m86hvs7yyn/403/403_hd_swift_api_design_guidelines.mp4
Designing for tvOS
http://devstreaming.apple.com/videos/wwdc/2016/802z6j79sd7g5drr7k7/802/802_hd_designing_for_tvos.mp4
Using Store Kit for In-App Purchases with Swift 3
http://devstreaming.apple.com/videos/wwdc/2016/702rhpkb0ux7uuzixps/702/702_hd_using_store_kit_for_inapp_purchases_with_swift_3.mp4
Adopting Metal, Part 2
http://devstreaming.apple.com/videos/wwdc/2016/603oba298b1v4z54011/603/603_hd_adopting_metal_part_2.mp4
Platforms State of the Union
http://devstreaming.apple.com/videos/wwdc/2016/102w0bsn0ge83qfv7za/102/102_hd_platforms_state_of_the_union.mp4
What's New in Cocoa
http://devstreaming.apple.com/videos/wwdc/2016/203x2w42att1kdzg1ce/203/203_hd_whats_new_in_cocoa.mp4
Inclusive App Design
http://devstreaming.apple.com/videos/wwdc/2016/801y753jw8vxmjblocq/801/801_hd_inclusive_app_design.mp4
What's New in Metal, Part 1
http://devstreaming.apple.com/videos/wwdc/2016/604oezpg3wmqrkxl0t7/604/604_hd_whats_new_in_metal_part_1.mp4
Getting Published in Apple News
http://devstreaming.apple.com/videos/wwdc/2016/502lezynlddsti4drbq/502/502_hd_getting_published_in_apple_news.mp4
What's New in Swift
http://devstreaming.apple.com/videos/wwdc/2016/402h429l9d0hy98c9m6/402/402_hd_whats_new_in_swift.mp4
Adopting Metal, Part 1
http://devstreaming.apple.com/videos/wwdc/2016/602o05a86ysk0ngvlgj/602/602_hd_adopting_metal_part_1.mp4
What's New in Xcode App Signing
http://devstreaming.apple.com/videos/wwdc/2016/401hmew12wifry4svvi/401/401_hd_whats_new_in_xcode_app_signing.mp4
How iOS Security Really Works
http://devstreaming.apple.com/videos/wwdc/2016/705s57mrvm8so193i8c/705/705_hd_how_ios_security_really_works.mp4
Introducing Search Ads
http://devstreaming.apple.com/videos/wwdc/2016/302f5hkfjyg13j84oda/302/302_hd_introducing_search_ads.mp4
Getting the Most Out of HealthKit
http://devstreaming.apple.com/videos/wwdc/2016/209e37d5ks3pfj21ij5/209/209_hd_getting_the_most_out_of_healthkit.mp4
What's New in Accessibility
http://devstreaming.apple.com/videos/wwdc/2016/202w2zhc4l8yomptqnt/202/202_hd_whats_new_in_accessibility.mp4