Created
December 16, 2016 19:42
-
-
Save imjasonh/d98aca7004d6a9efe8c557f98baec946 to your computer and use it in GitHub Desktop.
Fetch tvOS Screensaver videos
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
[ | |
{ | |
"id" : "73F3F654-9EC5-4876-8BF6-474E22029A49", | |
"assets" : [ | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/comp_GL_G004_C010_v03_6Mbps.mov", | |
"accessibilityLabel" : "Greenland", | |
"type" : "video", | |
"id" : "D388F00A-5A32-4431-A95C-38BF7FF7268D", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/comp_DB_D011_D009_SIGNCMP_v15_6Mbps.mov", | |
"accessibilityLabel" : "Dubai", | |
"type" : "video", | |
"id" : "2F11E857-4F77-4476-8033-4A1E4610AFCC", | |
"timeOfDay" : "night" | |
} | |
] | |
}, | |
{ | |
"id" : "465A051C-3DDE-4C87-B0A4-846AF5422FE1", | |
"assets" : [ | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/comp_HK_H004_C008_v10_6Mbps.mov", | |
"accessibilityLabel" : "Hong Kong", | |
"type" : "video", | |
"id" : "102C19D1-9D9F-48EC-B492-074C985C4D9F", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/comp_LA_A009_C009_t9_6M_tag0.mov", | |
"accessibilityLabel" : "Los Angeles", | |
"type" : "video", | |
"id" : "B813A62B-F910-4C86-B2B4-51C7FCB73314", | |
"timeOfDay" : "night" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/comp_C002_C005_0818SC_001_v01_6M_HB_tag0.mov", | |
"accessibilityLabel" : "China", | |
"type" : "video", | |
"id" : "9CCB8297-E9F5-4699-AE1F-890CFBD5E29C", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/comp_GL_G010_C006_v08_6Mbps.mov", | |
"accessibilityLabel" : "Greenland", | |
"type" : "video", | |
"id" : "7D4710EB-5BA4-42E6-AA60-68D77F67D9B9", | |
"timeOfDay" : "night" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/comp_LW_L001_C006_t9_6M_tag0.mov", | |
"accessibilityLabel" : "Liwa", | |
"type" : "video", | |
"id" : "88025454-6D58-48E8-A2DB-924988FAD7AC", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/comp_DB_D011_C010_v10_6Mbps.mov", | |
"accessibilityLabel" : "Dubai", | |
"type" : "video", | |
"id" : "B3BDC635-756D-4B82-B01A-A2620D1DBF10", | |
"timeOfDay" : "night" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/comp_LA_A005_C009_v05_t9_6M.mov", | |
"accessibilityLabel" : "Los Angeles", | |
"type" : "video", | |
"id" : "687B36CB-BA5D-4434-BA99-2F2B8B6EC163", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/comp_HK_B005_C011_t9_6M_tag0.mov", | |
"accessibilityLabel" : "Hong Kong", | |
"type" : "video", | |
"id" : "2A57BB93-1825-484C-9609-FF8580CAE77B", | |
"timeOfDay" : "night" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/plate_G002_C002_BG_t9_6M_HB_tag0.mov", | |
"accessibilityLabel" : "Greenland", | |
"type" : "video", | |
"id" : "30047FDA-3AE3-4E74-9575-3520AD77865B", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/comp_C007_C011_08244D_001_v01_6M_HB_tag0.mov", | |
"accessibilityLabel" : "China", | |
"type" : "video", | |
"id" : "B876B645-3955-420E-99DF-60139E451CF3", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/comp_LA_A006_C008_t9_6M_HB_tag0.mov", | |
"accessibilityLabel" : "Los Angeles", | |
"type" : "video", | |
"id" : "BEED64EC-2DB7-47E1-A67E-59C101E73C04", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/comp_DB_D001_C001_v03_6Mbps.mov", | |
"accessibilityLabel" : "Dubai", | |
"type" : "video", | |
"id" : "15F9B681-9EA8-4DD1-AD26-F111BC5CF64B", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/comp_HK_H004_C010_4k_v01_6Mbps.mov", | |
"accessibilityLabel" : "Hong Kong", | |
"type" : "video", | |
"id" : "560E09E8-E89D-4ADB-8EEA-4754415383D4", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/comp_LA_A008_C004_ALT_v33_6Mbps.mov", | |
"accessibilityLabel" : "Los Angeles", | |
"type" : "video", | |
"id" : "60CD8E2E-35CD-4192-A5A4-D5E10BFE158B", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/comp_DB_D002_C003_t9_6M_HB_tag0.mov", | |
"accessibilityLabel" : "Dubai", | |
"type" : "video", | |
"id" : "02EA5DBE-3A67-4DFA-8528-12901DFD6CC1", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/comp_C007_C004_0824AJ_001_v01_6M_HB_tag0.mov", | |
"accessibilityLabel" : "China", | |
"type" : "video", | |
"id" : "D5E76230-81A3-4F65-A1BA-51B8CADED625", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/comp_DB_D001_C005_t9_6M_HB_tag0.mov", | |
"accessibilityLabel" : "Dubai", | |
"type" : "video", | |
"id" : "D34A7B19-EC33-4300-B4ED-0C8BC494C035", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/comp_HK_H004_C013_t9_6M_HB_tag0.mov", | |
"accessibilityLabel" : "Hong Kong", | |
"type" : "video", | |
"id" : "4B16F739-372D-400D-B7F9-1327EF58CFDC", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/comp_DB_D008_C010_v04_6Mbps.mov", | |
"accessibilityLabel" : "Dubai", | |
"type" : "video", | |
"id" : "DFA399FA-620A-4517-94D6-BF78BF8C5E5A", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/b1-1.mov", | |
"accessibilityLabel" : "Hawaii", | |
"type" : "video", | |
"id" : "B6E6CCEA-B257-41F7-9150-F965F467E22C", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/b1-2.mov", | |
"accessibilityLabel" : "London", | |
"type" : "video", | |
"id" : "02B7535C-E162-4F2E-B775-85D258272E94", | |
"timeOfDay" : "night" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/b1-3.mov", | |
"accessibilityLabel" : "New York City", | |
"type" : "video", | |
"id" : "5DAA9696-79B3-4F13-96A0-8D11540EE2CA", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/b1-4.mov", | |
"accessibilityLabel" : "San Francisco", | |
"type" : "video", | |
"id" : "475E3400-7139-46D3-B2C6-B1D2BED3F495", | |
"timeOfDay" : "night" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/b2-1.mov", | |
"accessibilityLabel" : "China", | |
"type" : "video", | |
"id" : "FB494AD5-F028-4EB7-A374-4DEA0D9A26B6", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/b2-2.mov", | |
"accessibilityLabel" : "Hawaii", | |
"type" : "video", | |
"id" : "2BAB3BD0-49D4-447E-9FB6-5C4B92FB9F5B", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/b2-3.mov", | |
"accessibilityLabel" : "New York City", | |
"type" : "video", | |
"id" : "0A755954-5E5A-4609-9B6A-0DBD13D62D2F", | |
"timeOfDay" : "night" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/b2-4.mov", | |
"accessibilityLabel" : "San Francisco", | |
"type" : "video", | |
"id" : "97C90D2E-C5F5-48E0-A6F2-AE02C1F95640", | |
"timeOfDay" : "night" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/b3-1.mov", | |
"accessibilityLabel" : "London", | |
"type" : "video", | |
"id" : "89F08B3F-ECCD-467C-B14C-F3189989D939", | |
"timeOfDay" : "night" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/b3-2.mov", | |
"accessibilityLabel" : "New York City", | |
"type" : "video", | |
"id" : "B1D0EBA2-7690-4DA0-B04C-2CFB13440A16", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/b3-3.mov", | |
"accessibilityLabel" : "San Francisco", | |
"type" : "video", | |
"id" : "05589E8C-13B5-4A21-BC88-6497E7FD8F52", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/b4-1.mov", | |
"accessibilityLabel" : "Hawaii", | |
"type" : "video", | |
"id" : "23751FF5-8C3C-45D3-891E-6855140740C7", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/b4-2.mov", | |
"accessibilityLabel" : "New York City", | |
"type" : "video", | |
"id" : "E7C04343-D8D0-410B-9F6B-DDBF7259F21A", | |
"timeOfDay" : "night" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/b4-3.mov", | |
"accessibilityLabel" : "San Francisco", | |
"type" : "video", | |
"id" : "20824BA6-BDB1-4EA9-BBF6-6DBC0F1ADAC0", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/b5-1.mov", | |
"accessibilityLabel" : "China", | |
"type" : "video", | |
"id" : "964CBBC7-1352-4A33-BEBD-532FA17DD509", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/b5-2.mov", | |
"accessibilityLabel" : "London", | |
"type" : "video", | |
"id" : "48FFE630-338E-49AC-BC60-3FAFD3B78112", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/b5-3.mov", | |
"accessibilityLabel" : "San Francisco", | |
"type" : "video", | |
"id" : "2216406F-3DD7-44B5-B930-53E147A1D524", | |
"timeOfDay" : "night" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/b6-1.mov", | |
"accessibilityLabel" : "China", | |
"type" : "video", | |
"id" : "C844BACD-7032-44D0-8F8D-6E44B4A9CDA5", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/b6-2.mov", | |
"accessibilityLabel" : "Hawaii", | |
"type" : "video", | |
"id" : "B9FF9C13-0C83-4510-BA0B-B5CCF6E66718", | |
"timeOfDay" : "night" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/b6-3.mov", | |
"accessibilityLabel" : "London", | |
"type" : "video", | |
"id" : "B1C9845B-C0FE-4AA2-ACEE-0174D024A417", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/b6-4.mov", | |
"accessibilityLabel" : "San Francisco", | |
"type" : "video", | |
"id" : "6C0A96DF-EEE8-4361-A690-7B6E6754DB2A", | |
"timeOfDay" : "night" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/b7-1.mov", | |
"accessibilityLabel" : "Hawaii", | |
"type" : "video", | |
"id" : "7D25A008-F7C5-4FED-B41C-883D1C4CBC67", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/b7-2.mov", | |
"accessibilityLabel" : "New York City", | |
"type" : "video", | |
"id" : "ED779524-940D-4353-A47D-63C97A79E660", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/b7-3.mov", | |
"accessibilityLabel" : "San Francisco", | |
"type" : "video", | |
"id" : "6DFF7E95-CF92-4A50-A5B4-A036FDA29175", | |
"timeOfDay" : "night" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/b8-2.mov", | |
"accessibilityLabel" : "San Francisco", | |
"type" : "video", | |
"id" : "0A9E193F-E59D-459A-8708-7E24BB1E6B6D", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/b8-3.mov", | |
"accessibilityLabel" : "San Francisco", | |
"type" : "video", | |
"id" : "669D4666-0FB0-4C69-96CA-9A6CEC565C0C", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/b9-3.mov", | |
"accessibilityLabel" : "San Francisco", | |
"type" : "video", | |
"id" : "7AB5F324-7D42-4218-8193-A3DC070CA570", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/b10-3.mov", | |
"accessibilityLabel" : "San Francisco", | |
"type" : "video", | |
"id" : "3973A78A-D3CF-41E2-8E7B-23DC08C7F780", | |
"timeOfDay" : "day" | |
}, | |
{ | |
"url" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/b8-1.mov", | |
"accessibilityLabel" : "Hawaii", | |
"type" : "video", | |
"id" : "81427464-B284-4EEC-BF08-BE106C99B4E2", | |
"timeOfDay" : "night" | |
} | |
] | |
} | |
] |
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
// This script fetches all the .mov files on tvOS | |
// entries.json downloaded from http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/entries.json | |
// From http://benjaminmayo.co.uk/watch-all-the-apple-tv-aerial-video-screensavers | |
// Run with: | |
// go run main.go entries.json | |
package main | |
import ( | |
"encoding/json" | |
"flag" | |
"fmt" | |
"io" | |
"log" | |
"net/http" | |
"os" | |
"strings" | |
) | |
type entries []struct { | |
ID string `json:"id"` | |
Assets []struct { | |
URL string `json:"url"` | |
Label string `json:"accessibilityLabel"` | |
Type string `json:"type"` | |
ID string `json:"id"` | |
TimeOfDay string `json:"timeOfDay"` | |
} `json:"assets"` | |
} | |
func main() { | |
flag.Parse() | |
if len(flag.Args()) == 0 { | |
exit("Must specify json file") | |
} | |
fn := flag.Arg(0) | |
f, err := os.Open(fn) | |
if err != nil { | |
exit(fmt.Sprintf("Failed to open %s: %v", fn, err)) | |
} | |
defer f.Close() | |
var es entries | |
if err := json.NewDecoder(f).Decode(&es); err != nil { | |
exit(fmt.Sprintf("Failed to decode JSON: %v", err)) | |
} | |
seen := map[string]int{} // keys are value+timeofday | |
for _, e := range es { | |
for _, a := range e.Assets { | |
if a.Type != "video" { | |
log.Printf("Skipping %s (type=%s)", a.URL, a.Type) | |
continue | |
} | |
log.Printf("Fetching %s...", a.URL) | |
resp, err := http.Get(a.URL) | |
if err != nil { | |
exit(fmt.Sprintf("Failed to fetch %s: %v", a.URL, err)) | |
} | |
defer resp.Body.Close() | |
k := fmt.Sprintf("%s-%s", strings.Replace(a.Label, " ", "_", -1), a.TimeOfDay) | |
seen[k] += 1 | |
outfn := fmt.Sprintf("%s-%d.mov", k, seen[k]) | |
out, err := os.Create(outfn) | |
if err != nil { | |
exit(fmt.Sprintf("Failed to create %s: %v", outfn, err)) | |
} | |
defer out.Close() | |
if _, err := io.Copy(out, resp.Body); err != nil { | |
exit(fmt.Sprintf("Failed to copy %s to %s", a.URL, outfn)) | |
} | |
log.Printf("Wrote %s", outfn) | |
} | |
} | |
} | |
func exit(msg string) { | |
fmt.Println(msg) | |
os.Exit(1) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment