-
Notifications
You must be signed in to change notification settings - Fork 142
/
wwdcDownloader-deprecated.sh
1025 lines (896 loc) · 39.6 KB
/
wwdcDownloader-deprecated.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/sh
# Author: Olivier HO-A-CHUCK
# Date: June 27th 2013 (update June 12th 2015)
# Last update:
# - fixing duplicated download of source code (creating sim link instead)
# - fixing pdf regression bug while using -f HD option. Thanx to Richard Watt (botsmack) for pointing this out
# - fixing download of pdfs that does not exist in real life (Apple award and Keynote)
# - fixing bug that get corrupted PDFs while using -f SD mode (default mode ;( ).
# - adding PDFs download (wasn't there first then I forget !)
# - fixed -L for years earlier than 2015
# - "/Users/${USER}" changed for "${HOME}" for better compliancy with home directory differents than /Users
# - Add wwdc 2015 video download (+ fixed issue with "Managing 3D Assets with Model I/O" session label).
# - fixed issue with names like I/O
# - adding download of ALL sample code (including those to grab on Apple documentation web site)
# - adding check for network connectivity (bash does not handle connectivity error for you)
# - fixing issue with name using comma in title (like ", part 1") - some might download them twice if using an early script - sorry ;(
#
#
# License: Do what you want with it. But notice that this script comes with no warranty and will not be maintained.
# Usage: wwdcVideoGet-curlVersion.sh
# To get 2013 tech-talks content: ./wwdcVideoGet-curlVersion.sh -e tech-talks
#
# TODO:
# - make 2012 videos download possible (it's feasible but more painful than for 2013 and 2014, so time consuming...)
# - wrong password does not give proper error message!
# - display some statistics: total time of download (+ begin and end), total downloaded size of content
# - check available disk space for possible alert (in particular if HD video are getting donwloaded with less than 60 GB of disk space)
VERSION="1.8.9"
DEFAULT_FORMAT="SD"
DEFAULT_YEAR="2015"
DEFAULT_EVENT="wwdc"
SELECTIVE_SESSION_MODE=false
LIST_MODE=false
VERBOSE=false
LOGIN=false
ITUNES_LOGIN=""
UNIQID=`uuidgen`
TMP_DIR="/tmp/wwdc-session-$UNIQID.tmp"
VIDEO_URL_WWDC="https://developer.apple.com/videos/wwdc"
VIDEO_URL_TECHTALK="https://developer.apple.com/tech-talks/videos/"
SAMPLE_CODE_ROOT_URL="https://developer.apple.com/"
MINIMUM_SIZE_TO_DETECT_CORRUPTED_PDF=20
doGetWWDCPost2012 () {
ituneslogin=$1
itunespassword=$2
FORMAT=$3
if [ ${VERBOSE} == true ];
then
echo "Sessions to be downloaded: ${SESSION_WANTED}"
echo "Output directory: ${WWDC_DIRNAME}"
fi
mkdir -p $TMP_DIR
# Processing Authentifcation - depreciated now (but kept for copy/pasters like me that might need to use this as a snippet for other uses)
if [ -z "${ituneslogin}" ];
then
# Dynamically get the key value as this can change (it did change for instance when Apple had to turn down their developer Portal for a week)
if [ ${VERBOSE} == true ];
then
echo "Getting appIDKey..."
fi
key=$(curl -s -L https://developer.apple.com/iphone | grep 'login?&appIdKey=' | sed -e 's/\(.*login?&appIdKey=\)\(.*\)\(&.*\)/\2/' | awk 'NR==1 {print $1}')
if [ ${VERBOSE} == true ];
then
echo "appIDKey: ${key}"
fi
cookies=(--cookies=on --keep-session-cookies)
action=$(curl -s 'https://daw.apple.com/cgi-bin/WebObjects/DSAuthWeb.woa/wa/login?appIdKey='"${key}" | grep '\ action=' | awk '{ print $4 }' | cut -f2 -d"=" | sed -e "s/^.*\"\(.*\)\".*$/\1/")
curl -s --cookie-jar $TMP_DIR/cookies.txt "https://daw.apple.com${action}" -d theAccountName="${ituneslogin}" -d theAccountPW="${itunespassword}" > /dev/null
curl -s --cookie $TMP_DIR/cookies.txt \
--cookie-jar $TMP_DIR/cookies.txt \
${VIDEO_URL} > $TMP_DIR/video.html
else
curl -silent ${VIDEO_URL} > $TMP_DIR/video.html
fi
cat ${TMP_DIR}/video.html | sed -e '/class="thumbnail-title/,/<div class="error">/!d' > $TMP_DIR/video-cleaned.html
if [ -f ${TMP_DIR}/titles.txt ] ; then
rm ${TMP_DIR}/titles.txt
fi
cat ${TMP_DIR}/video-cleaned.html | while read line; do
sessionNum=`echo $line | grep -o -E '<li class="thumbnail-title">(.*)</li><li class="thumbnail-(id|play)">(.*)</li>' | grep -o -E 'Session [0-9]*' | cut -d' ' -f2`
title_array[$sessionNum]=`echo $line | grep -o -E '<li class="thumbnail-title">(.*)</li><li class="thumbnail-(id|play)">(.*)</li>' | cut -d'>' -f2 | sed 's/<\/li$//g'`
echo "$sessionNum,${title_array[$sessionNum]}" >> $TMP_DIR/titles.txt
done
`sed -n '/^,/!p' $TMP_DIR/titles.txt > $TMP_DIR/titles.txt.tmp && mv $TMP_DIR/titles.txt.tmp $TMP_DIR/titles.txt`
while read line
do
sessionNum=`echo $line | cut -d',' -f1`
sessionTitle=`echo $line | cut -d',' -f2`
title_array[$sessionNum]=${sessionTitle}
done < ${TMP_DIR}/titles.txt
if [ ${LIST_MODE} == true ];
then
echo "Available videos:"
echo "-----------------"
cat ${TMP_DIR}/titles.txt | cut -d',' -f1 | while read line; do
echo "${line}: ${title_array[$line]}"
#printf '%s\n' "${title_array[@]}"
done;
exit
fi
echo "******* DOWNLOADING PDF FILES ********"
# PDF
mkdir -p "${WWDC_DIRNAME}"/PDFs
# do the rm *.download only if files exist
FILES_LIST="$(ls "${WWDC_DIRNAME}"/PDFs/*.download 2>/dev/null)"
if [ -z "$FILES_LIST" ]; then
# echo "Hello, de Lu!"
:
else
echo "Some download was aborted last time you ran this script."
rm "${WWDC_DIRNAME}"/PDFs/*.download
echo "Cleaning non fully downloaded files: OK."
fi
# cleaning possible corrupted pdf (downloaded with wrong path then with size of 16 octets)
find "${WWDC_DIRNAME}"/PDFs/ -name "*.pdf" -size -2 -delete
i=0
# cat ${TMP_DIR}/video.html | grep -o -E 'href="(http:\/\/devstreaming.apple.com\/videos\/wwdc\/'${YEAR}'\/[0-9a-zA-Z]*\/[0-9]{1,5}\/([0-9]{1,5}|[0-9]{1,5}_.*)\.pdf\?dl=1+)"' | cut -d'"' -f2 | sed -e 's/_sd_/_/g' -e 's/.mov/.pdf/g' | while read line; do
cat ${TMP_DIR}/video.html | grep -o -E 'href="(http:\/\/devstreaming.apple.com\/videos\/wwdc\/'${YEAR}'\/[0-9a-zA-Z]*\/[0-9]{1,5}\/([0-9]{1,5}|[0-9]{1,5}_.*)\.pdf\?dl=1+)"' | cut -d'"' -f2 | sed -e 's/_sd_/_/g' -e 's/_hd_/_/g' -e 's/.mov/.pdf/g' | while read line; do
filename=`echo ${line} | cut -d'/' -f9 | cut -d'?' -f1`
session_number=`echo $line | grep -o -E '\/([0-9]+|[0-9]+_.*)\.pdf' | grep -o -E "[0-9]{3,4}"`
if [ ${SELECTIVE_SESSION_MODE} == true ];
then
if `echo ${SESSION_WANTED} | grep "${session_number}" 1>/dev/null 2>&1`
then
dest_path="${WWDC_DIRNAME}/PDFs/${session_number} - ${title_array[$session_number]}.pdf"
old_dest_path="${WWDC_DIRNAME}/PDFs/${filename}"
if [ -f "${dest_path}" ];
then
echo "${dest_path} already downloaded (nothing to do!)"
elif [ -f "${old_dest_path}" ];
then
echo "Rename existing file: ${old_dest_path} => ${dest_path}"
mv "${old_dest_path}" "${dest_path}"
else
echo "downloading PDF for session ${session_number}: $line"
curl $line > "${dest_path}.download"
mv "${dest_path}.download" "${dest_path}"
fi
fi
else
dest_path="${WWDC_DIRNAME}/PDFs/${session_number} - ${title_array[$session_number]}.pdf"
old_dest_path="${WWDC_DIRNAME}/PDFs/${filename}"
if [ -f "${dest_path}" ];
then
echo "${dest_path} already downloaded (nothing to do!)"
elif [ -f "${old_dest_path}" ];
then
echo "Rename existing file: ${old_dest_path} => ${dest_path}"
mv "${old_dest_path}" "${dest_path}"
else
echo "downloading PDF for session ${session_number}: $line"
curl $line > "${dest_path}.download"
mv "${dest_path}.download" "${dest_path}"
fi
fi
((i+=1))
done
echo "******* DOWNLOADING ${FORMAT} VIDEOS ********"
# Videos ${FORMAT}
mkdir -p "${WWDC_DIRNAME}"/${FORMAT}-VIDEOs
# do the rm *.download only if files exist
FILES_LIST="$(ls "${WWDC_DIRNAME}"/${FORMAT}-VIDEOs/*.download 2>/dev/null)"
if [ -z "$FILES_LIST" ]; then
#echo "All downloads will go to your Desktop/WWDC-2013 folder!"
:
else
echo "Some download was aborted last time you ran this script."
rm "${WWDC_DIRNAME}"/${FORMAT}-VIDEOs/*.download
echo "Cleaning non fully downloaded files: OK"
fi
i=0
# TODO: / WARNING (for possible future function merge): note that devstreaming url does use hard coded "wwdc" in it, were tech-talks function url is "techtalks" (whithout dash)
if [ ${YEAR} = "2013" ];
then
REGEXFILE="[0-9a-zA-Z]*\/[0-9]{1,5}\/[0-9]{1,5}-${FORMAT}\.mov"
elif [ ${YEAR} = "2014" ];
then
if [ "${FORMAT}" = "HD" ];
then
LC_FORMAT="hd"
else
LC_FORMAT="sd"
fi
REGEXFILE="[0-9a-zA-Z]*\/[0-9]{1,5}\/[0-9]{1,5}_${LC_FORMAT}_.*\.mov"
else
echo "coucou"
fi
cat ${TMP_DIR}/video.html | grep -o -E 'href="(http:\/\/devstreaming.apple.com\/videos\/wwdc\/'${YEAR}'/'${REGEXFILE}'\?dl=1+)"' | cut -d'"' -f2 | while read line; do
#echo $line
filename=`echo ${line} | cut -d'/' -f9 | cut -d'?' -f1`
session_number=`echo $line | grep -o -i -E '/[0-9]+[_-]'${FORMAT}'[^/]*.mov' | grep -o -E '[0-9]+' | head -1`
if [ ${SELECTIVE_SESSION_MODE} == true ];
then
if `echo ${SESSION_WANTED} | grep "${session_number}" 1>/dev/null 2>&1`
then
dest_path="${WWDC_DIRNAME}/${FORMAT}-VIDEOs/${session_number} - ${title_array[$session_number]}-${FORMAT}.mov"
old_dest_path="${WWDC_DIRNAME}/${FORMAT}-VIDEOs/${filename}"
if [ -f "${dest_path}" ]
then
echo "${dest_path} already downloaded (nothing to do!)"
elif [ -f "${old_dest_path}" ];
then
echo "Rename existing file: ${old_dest_path} => ${dest_path}"
mv "${old_dest_path}" "${dest_path}"
else
echo "downloading ${FORMAT} Video for session ${session_number}: $line"
curl $line > "${dest_path}.download"
mv "${dest_path}.download" "${dest_path}"
fi
fi
else
dest_path="${WWDC_DIRNAME}/${FORMAT}-VIDEOs/${session_number} - ${title_array[$session_number]}-${FORMAT}.mov"
old_dest_path="${WWDC_DIRNAME}/${FORMAT}-VIDEOs/${filename}"
if [ -f "${dest_path}" ]
then
echo "${dest_path} already downloaded (nothing to do!)"
elif [ -f "${old_dest_path}" ];
then
echo "Rename existing file: ${old_dest_path} => ${dest_path}"
mv "${old_dest_path}" "${dest_path}"
else
echo "downloading ${FORMAT} Video for session ${session_number}: $line"
curl $line > "${dest_path}.download"
mv "${dest_path}.download" "${dest_path}"
fi
fi
((i+=1))
done
rm -Rf ${TMP_DIR}
}
#**************************************************************************************#
# TECH TALK #
#**************************************************************************************#
doGetTT2013 () {
ituneslogin=$1
itunespassword=$2
FORMAT=$3
if [ ${VERBOSE} == true ];
then
echo "Sessions to be downloaded: ${SESSION_WANTED}"
echo "Output directory: ${WWDC_DIRNAME}"
fi
mkdir -p $TMP_DIR
# Dynamically get the key value as this can change (it did change for instance when Apple had to turn down their developer Portal for a week)
if [ ${VERBOSE} == true ];
then
echo "Getting appIDKey..."
fi
key=$(curl -s -L https://developer.apple.com/iphone | grep 'login?&appIdKey=' | sed -e 's/\(.*login?&appIdKey=\)\(.*\)\(&.*\)/\2/' | awk 'NR==1 {print $1}')
if [ ${VERBOSE} == true ];
then
echo "appIDKey: ${key}"
fi
cookies=(--cookies=on --keep-session-cookies)
action=$(curl -s 'https://daw.apple.com/cgi-bin/WebObjects/DSAuthWeb.woa/wa/login?appIdKey='"${key}" | grep '\ action=' | awk '{ print $4 }' | cut -f2 -d"=" | sed -e "s/^.*\"\(.*\)\".*$/\1/")
curl -s --cookie-jar $TMP_DIR/cookies.txt "https://daw.apple.com${action}" -d theAccountName="${ituneslogin}" -d theAccountPW="${itunespassword}" > /dev/null
curl -s --cookie $TMP_DIR/cookies.txt \
--cookie-jar $TMP_DIR/cookies.txt \
${VIDEO_URL} > $TMP_DIR/video.html
cat ${TMP_DIR}/video.html | sed -e '/class="thumbnail-title/,/<div class="error">/!d' > $TMP_DIR/video-cleaned.html
if [ -f ${TMP_DIR}/titles.txt ] ; then
rm ${TMP_DIR}/titles.txt
fi
cat ${TMP_DIR}/video-cleaned.html | while read line; do
echo $line | grep -o -E '<li class="thumbnail-title">(.*)</li><li class="thumbnail-(id|play)">(.*)</li>' | cut -d'>' -f2 | sed 's/\<\/li$//g' >> $TMP_DIR/titles.txt
done
while read line
do
title_array+=("$line")
done < ${TMP_DIR}/titles.txt
if [ ${LIST_MODE} == true ];
then
echo "Available videos:"
echo "-----------------"
cat ${TMP_DIR}/titles.txt | cut -d';' -f1 | while read line; do
echo "$line: ${title_array[$line]}"
#printf '%s\n' "${title_array[@]}"
done;
exit
fi
echo "******* DOWNLOADING PDF FILES ********"
# PDF
mkdir -p "${WWDC_DIRNAME}"/PDFs
# do the rm *.download only if files exist
FILES_LIST="$(ls "${WWDC_DIRNAME}"/PDFs/*.download 2>/dev/null)"
if [ -z "$FILES_LIST" ]; then
#echo "All downloads will go to your Desktop/WWDC-2013 folder!"
:
else
echo "Some download was aborted last time you ran this script."
rm "${WWDC_DIRNAME}"/PDFs/*.download
echo "Cleaning non fully downloaded files: OK."
fi
i=0
cat ${TMP_DIR}/video.html | grep -o -E 'href="(http:\/\/devstreaming.apple.com\/videos\/techtalks\/2013/[0-9a-zA-Z_\-]*\/[0-9a-zA-Z_\-]*\.pdf\?dl=1+)"' | cut -d'"' -f2 | while read line; do
session_number=`echo $line | grep -o -E '/[0-9]+_' | grep -o -E [0-9]+`
if [ ${SELECTIVE_SESSION_MODE} == true ];
then
if `echo ${SESSION_WANTED} | grep "${session_number}" 1>/dev/null 2>&1`
then
dest_path="${WWDC_DIRNAME}/PDFs/${session_number} - ${title_array[$i]}.pdf"
if [ -f "${dest_path}" ]
then
echo "${dest_path} already downloaded (nothing to do!)"
else
echo "downloading PDF for session ${session_number}: $line"
curl $line > "${dest_path}.download"
mv "${dest_path}.download" "${dest_path}"
fi
fi
else
dest_path="${WWDC_DIRNAME}/PDFs/${session_number} - ${title_array[$i]}.pdf"
if [ -f "${dest_path}" ]
then
echo "${dest_path} already downloaded (nothing to do!)"
else
echo "downloading PDF for session ${session_number}: $line"
curl $line > "${dest_path}.download"
mv "${dest_path}.download" "${dest_path}"
fi
fi
((i+=1))
done
echo "******* DOWNLOADING ${FORMAT} VIDEOS ********"
# Videos ${FORMAT}
mkdir -p "${WWDC_DIRNAME}"/${FORMAT}-VIDEOs
# do the rm *.download only if files exist
FILES_LIST="$(ls "${WWDC_DIRNAME}"/${FORMAT}-VIDEOs/*.download 2>/dev/null)"
if [ -z "$FILES_LIST" ]; then
#echo "All downloads will go to your Desktop/WWDC-2013 folder!"
:
else
echo "Some download was aborted last time you ran this script."
rm "${WWDC_DIRNAME}"/${FORMAT}-VIDEOs/*.download
echo "Cleaning non fully downloaded files: OK."
fi
i=0
# TODO: This extra if then elif test should not be there (duplicated code), but I don't know so far how to use $FORMAT in the grep -o -E regex! :(
# Word boundaries should help like \<$FORMAT\>, but I'm not sure this is compliant with all grep versions. And I don't want to use egrep (non standard).
# I know even with if then, this can be improved in terms or number of code lines. But hey, I'm a Marketing guys. Sorry for the very quick and dirty bit :(((
if [ ${FORMAT} = "HD" ];
then
cat ${TMP_DIR}/video.html | grep -o -E 'href="(http:\/\/devstreaming.apple.com\/videos\/techtalks\/2013/[0-9a-zA-Z_]*\/[0-9a-zA-Z_]*-hd\.mov\?dl=1+)"' | cut -d'"' -f2 | while read line; do
session_number=`echo $line | grep -o -E '/[0-9]+_' | grep -o -E [0-9]+`
if [ ${SELECTIVE_SESSION_MODE} == true ];
then
if `echo ${SESSION_WANTED} | grep "${session_number}" 1>/dev/null 2>&1`
then
dest_path="${WWDC_DIRNAME}/${FORMAT}-VIDEOs/${session_number} - ${title_array[$i]}-${FORMAT}.mov"
if [ -f "${dest_path}" ]
then
echo "${dest_path} already downloaded (nothing to do!)"
else
echo "downloading ${FORMAT} Video for session ${session_number}: $line"
# little trick to be consistant with upercase HD of wwdc file name types
lineWithUperCaseHD="${line/-HD/-hd}"
curl $lineWithUperCaseHD > "${dest_path}.download"
mv "${dest_path}.download" "${dest_path}"
fi
fi
else
dest_path="${WWDC_DIRNAME}/${FORMAT}-VIDEOs/${session_number} - ${title_array[$i]}-${FORMAT}.mov"
if [ -f "${dest_path}" ]
then
echo "${dest_path} already downloaded (nothing to do!)"
else
echo "downloading ${FORMAT} Video for session ${session_number}: $line"
# little trick to be consistant with upercase HD of wwdc file name types
lineWithUperCaseHD="${line/-HD/-hd}"
curl $lineWithUperCaseHD > "${dest_path}.download"
mv "${dest_path}.download" "${dest_path}"
fi
fi
((i+=1))
done
elif [ ${FORMAT} = "SD" ];
then
cat ${TMP_DIR}/video.html | grep -o -E 'href="(http:\/\/devstreaming.apple.com\/videos\/techtalks\/2013/[0-9a-zA-Z_]*\/[0-9a-zA-Z_]*-sd\.mov\?dl=1+)"' | cut -d'"' -f2 | while read line; do
session_number=`echo $line | grep -o -E '/[0-9]+_' | grep -o -E [0-9]+`
if [ ${SELECTIVE_SESSION_MODE} == true ];
then
if `echo ${SESSION_WANTED} | grep "${session_number}" 1>/dev/null 2>&1`
then
dest_path="${WWDC_DIRNAME}/${FORMAT}-VIDEOs/${session_number} - ${title_array[$i]}-${FORMAT}.mov"
if [ -f "${dest_path}" ]
then
echo "${dest_path} already downloaded (nothing to do!)"
else
echo "downloading ${FORMAT} Video for session ${session_number}: $line"
# little trick to be consistant with upercase SD of wwdc file name types
lineWithUperCaseSD="${line/-SD/-sd}"
curl $lineWithUperCaseSD > "${dest_path}.download"
mv "${dest_path}.download" "${dest_path}"
fi
fi
else
dest_path="${WWDC_DIRNAME}/${FORMAT}-VIDEOs/${session_number} - ${title_array[$i]}-${FORMAT}.mov"
if [ -f "${dest_path}" ]
then
echo "${dest_path} already downloaded (nothing to do!)"
else
echo "downloading ${FORMAT} Video for session ${session_number}: $line"
# little trick to be consistant with upercase SD of wwdc file name types
lineWithUperCaseSD="${line/-SD/-sd}"
curl $lineWithUperCaseSD > "${dest_path}.download"
mv "${dest_path}.download" "${dest_path}"
fi
fi
((i+=1))
done
fi
rm -Rf ${TMP_DIR}
}
doGet2012 () {
ituneslogin=$1
itunespassword=$2
FORMAT=$3
#echo "DEBUG: do 2012 (login=${ituneslogin} - password=${itunespassword} - format=${FORMAT})"
TMP_DIR="/tmp/wwdc2012-$UNIQID.tmp"
mkdir -p $TMP_DIR
echo ""
echo "======> SORRY: 2012 VIDEO DOWNLOAD NOT YET IMPLEMENTED! <======="
echo ""
rm -Rf ${TMP_DIR}
}
#**************************************************************************************#
# WWDC 2015 #
#**************************************************************************************#
doGetWWDC2015 () {
ituneslogin=$1
itunespassword=$2
FORMAT=$3
if [ ${VERBOSE} == true ];
then
echo "Sessions to be downloaded: ${SESSION_WANTED}"
echo "Output directory: ${WWDC_DIRNAME}"
fi
mkdir -p $TMP_DIR
# Processing Authentifcation - depreciated now (but kept for copy/pasters like me that might need to use this as a snippet for other uses)
if [ -z "${ituneslogin}" ];
then
# Dynamically get the key value as this can change (it did change for instance when Apple had to turn down their developer Portal for a week)
if [ ${VERBOSE} == true ];
then
echo "Getting appIDKey..."
fi
key=$(curl -s -L https://developer.apple.com/iphone | grep 'login?&appIdKey=' | sed -e 's/\(.*login?&appIdKey=\)\(.*\)\(&.*\)/\2/' | awk 'NR==1 {print $1}')
if [ ${VERBOSE} == true ];
then
echo "appIDKey: ${key}"
fi
cookies=(--cookies=on --keep-session-cookies)
action=$(curl -s 'https://daw.apple.com/cgi-bin/WebObjects/DSAuthWeb.woa/wa/login?appIdKey='"${key}" | grep '\ action=' | awk '{ print $4 }' | cut -f2 -d"=" | sed -e "s/^.*\"\(.*\)\".*$/\1/")
curl -s --cookie-jar $TMP_DIR/cookies.txt "https://daw.apple.com${action}" -d theAccountName="${ituneslogin}" -d theAccountPW="${itunespassword}" > /dev/null
curl -s --cookie $TMP_DIR/cookies.txt \
--cookie-jar $TMP_DIR/cookies.txt \
${VIDEO_URL} > $TMP_DIR/video.html
else
curl -silent ${VIDEO_URL} > $TMP_DIR/video.html
fi
cat ${TMP_DIR}/video.html | sed -e '/class="inner_v_section"/,/<\/section>/!d' > $TMP_DIR/video-cleaned.html
if [ -f ${TMP_DIR}/titles.txt ] ; then
rm ${TMP_DIR}/titles.txt
fi
cat ${TMP_DIR}/video-cleaned.html | while read line; do
# domain if for future use ...
#domain=`echo $line | grep -o -E '<h6>(.*)</h6>' | cut -d'<' -f2 | cut -d'>' -f2`
sessionNum=`echo $line | grep -o -E '<a(.*)</a>' | cut -d'=' -f3 | cut -d'"' -f1`
title_array[$sessionNum]=`echo $line | grep -o -E '<a(.*)</a>' | cut -d'>' -f2 | cut -d'<' -f1`
echo "$sessionNum;${title_array[$sessionNum]}" >> $TMP_DIR/titles.txt
done
#`sed -n '/^,/!p' $TMP_DIR/titles.txt > $TMP_DIR/titles.txt.tmp && mv $TMP_DIR/titles.txt.tmp $TMP_DIR/titles.txt`
`sed '/^;/d' $TMP_DIR/titles.txt > $TMP_DIR/titles.txt.tmp && mv $TMP_DIR/titles.txt.tmp $TMP_DIR/titles.txt`
# escape special char for downloading issues (ex: I/O string)
# Ok this is dirty, but quick ! ;)
mv ${TMP_DIR}/titles.txt ${TMP_DIR}/titles-to-be-escaped.txt
sed -e 's/\//\-/g' ${TMP_DIR}/titles-to-be-escaped.txt > ${TMP_DIR}/titles.txt
mv ${TMP_DIR}/titles.txt ${TMP_DIR}/titles-to-be-escaped.txt
sed -e 's/&/AND/g' ${TMP_DIR}/titles-to-be-escaped.txt > ${TMP_DIR}/titles.txt
while read line
do
sessionNum=`echo $line | cut -d';' -f1`
sessionTitle=`echo $line | cut -d';' -f2`
title_array[$sessionNum]=${sessionTitle}
done < ${TMP_DIR}/titles.txt
if [ ${LIST_MODE} == true ];
then
echo "Available videos:"
echo "-----------------"
cat ${TMP_DIR}/titles.txt | cut -d';' -f1 | while read line; do
echo "$line: ${title_array[$line]}"
#printf '%s\n' "${title_array[@]}"
done;
exit
fi
echo "########## DOWNLOADING ${FORMAT} VIDEOS and PDFs files ##########"
# PDFs
mkdir -p "${WWDC_DIRNAME}/PDFs"
# do the rm *.download only if files exist
FILES_LIST="$(ls "${WWDC_DIRNAME}"/PDFs/*.download 2>/dev/null)"
if [ -z "$FILES_LIST" ]; then
# echo "Hello, de Lu!"
:
else
echo "Some download was aborted last time you ran this script."
rm "${WWDC_DIRNAME}"/PDFs/*.download
echo "Cleaning non fully downloaded files: OK."
fi
# cleaning possible corrupted pdf (downloaded with wrong path then with size of 16 octets)
find "${WWDC_DIRNAME}"/PDFs/ -name "*.pdf" -size -2 -delete
# Videos ${FORMAT}
mkdir -p "${WWDC_DIRNAME}/${FORMAT}-VIDEOs"
# do the rm *.download only if files exist
FILES_LIST="$(ls "${WWDC_DIRNAME}"/${FORMAT}-VIDEOs/*.download 2>/dev/null)"
if [ -z "$FILES_LIST" ]; then
#echo "All downloads will go to your Desktop/WWDC-2013 folder!"
:
else
echo "Some download was aborted last time you ran this script."
rm "${WWDC_DIRNAME}"/${FORMAT}-VIDEOs/*.download
echo "Cleaning non fully downloaded files: OK"
fi
# Prepare for SAMPLE-CODE
mkdir -p "${WWDC_DIRNAME}/SAMPLE-CODE"
# do the rm *.download only if files exist
FILES_LIST="$(ls "${WWDC_DIRNAME}"/SAMPLE-CODE/*.download 2>/dev/null)"
if [ -z "$FILES_LIST" ]; then
#echo "Hope you like my code? I know there are lot's of improvment I could make. In particular split in functions ..."
:
else
echo "Some sample code files download was aborted last time you ran this script."
rm "${WWDC_DIRNAME}"/SAMPLE-CODE/*.download
echo "Cleaning non fully downloaded sample code zip files: OK"
fi
i=0
if [ "${FORMAT}" = "HD" ];
then
LC_FORMAT="hd"
else
LC_FORMAT="sd"
fi
REGEXFILE="[0-9a-zA-Z]*\/[0-9]{1,5}\/[0-9]{1,5}_${LC_FORMAT}_.*\.mp4"
REGEXPDFFILE="[0-9a-zA-Z]*\/[0-9]{1,5}\/[0-9]{1,5}_.*\.pdf"
# get individuals video pages
cat ${TMP_DIR}/titles.txt | cut -d';' -f1 | while read line; do
curl -silent "${VIDEO_URL}?id=$line" > "${TMP_DIR}/$line-video.html";
videoURL=`cat ${TMP_DIR}/$line-video.html | grep -o -E 'href="(http:\/\/devstreaming.apple.com\/videos\/wwdc\/'${YEAR}'/'${REGEXFILE}'\?dl=1+)"'| cut -d'"' -f2`
pdfURL=`echo ${videoURL} | sed 's/_'${LC_FORMAT}'_/_/g' | sed 's/\.mp4/\.pdf/g'`
#echo ${line}: ${pdfURL}
# Get sample codes
cat ${TMP_DIR}/$line-video.html | grep -o -E '(class="sample-code"|class="playground")(.*)</a>' | cut -d'"' -f4 > "${TMP_DIR}/${line}-sampleCodeURL.txt"
cat ${TMP_DIR}/$line-video.html | grep -o -E '(class="sample-code"|class="playground")(.*)</a>' | cut -d'>' -f3 | cut -d'<' -f1 > "${TMP_DIR}/${line}-sampleCodeName.txt"
paste -d';' "${TMP_DIR}/${line}-sampleCodeName.txt" "${TMP_DIR}/${line}-sampleCodeURL.txt" > "${TMP_DIR}/${line}-sampleCode.txt"
# escape special char for downloading issues (ex: I/O string)
# Ok this is dirty, but it need to be quick ! ;)
mv ${TMP_DIR}/${line}-sampleCode.txt ${TMP_DIR}/${line}-sampleCode-to-be-escaped.txt
sed -e 's/I\/O/I\-O/g' ${TMP_DIR}/${line}-sampleCode-to-be-escaped.txt > ${TMP_DIR}/${line}-sampleCode.txt
mv ${TMP_DIR}/${line}-sampleCode.txt ${TMP_DIR}/${line}-sampleCode-to-be-escaped.txt
sed -e 's/&/AND/g' ${TMP_DIR}/${line}-sampleCode-to-be-escaped.txt > ${TMP_DIR}/${line}-sampleCode.txt
sampleCodeURL=()
sampleCodeName=()
nb_lines=0
while read lineURL; do
sampleCodePATHOnLine=`echo ${lineURL} | cut -d';' -f2`
sampleCodeNameOnLine=`echo ${lineURL} | cut -d';' -f1`
replacement=" -"
sampleCodeNameOnLine="${sampleCodeNameOnLine/:/${replacement}}"
if [[ ! ${lineURL} =~ \.zip$ ]];
then
curl -silent -L "${SAMPLE_CODE_ROOT_URL}/${sampleCodePATHOnLine}/book.json" > "${TMP_DIR}/$line-book.json";
sampleCodeURL[nb_lines]=`cat "${TMP_DIR}/$line-book.json" | grep -o -E '"sampleCode":".*\.zip"' | cut -d'"' -f4`
sampleCodeName[nb_lines]=${sampleCodeNameOnLine}
sampleCodePATH=${sampleCodePATHOnLine}
#echo " (${nb_lines})${sampleCodeName[nb_lines]}: ${SAMPLE_CODE_ROOT_URL}/${sampleCodePATHOnLine}/${sampleCodeURL[nb_lines]}"
else
sampleCodeURL[nb_lines]=${sampleCodePATHOnLine}
#sampleCodeName[nb_lines]=${lineURL%.*}
sampleCodeName[nb_lines]=${sampleCodeNameOnLine}
sampleCodePATH=${sampleCodeURL[nb_lines]}
#echo "==> Direct zip: ${sampleCodeName[nb_lines]}: ${SAMPLE_CODE_ROOT_URL}/${sampleCodeURL[nb_lines]}/${sampleCodeURL[nb_lines]}"
fi
((nb_lines+=1))
done < "${TMP_DIR}/${line}-sampleCode.txt"
if [ ${SELECTIVE_SESSION_MODE} == true ];
then
if `echo ${SESSION_WANTED} | grep "${line}" 1>/dev/null 2>&1`
then
# downloading PDF file
dest_path="${WWDC_DIRNAME}/PDFs/${line} - ${title_array[$line]}.pdf"
if [ -f "${dest_path}" ]
then
echo "${dest_path} already downloaded (nothing to do!)"
else
echo "downloading PDF doc for session ${line}: ${title_array[$line]}"
curl "${pdfURL}" > "${dest_path}.download" && mv "${dest_path}.download" "${dest_path}"
fi
# downloading video files
dest_path="${WWDC_DIRNAME}/${FORMAT}-VIDEOs/${line} - ${title_array[$line]}-${FORMAT}.mov"
if [ -f "${dest_path}" ]
then
echo "${dest_path} already downloaded (nothing to do!)"
else
echo "downloading ${FORMAT} Video for session ${line}: ${title_array[$line]}"
curl "${videoURL}" > "${dest_path}.download" && mv "${dest_path}.download" "${dest_path}"
fi
# downloading sample codes files
for i in "${!sampleCodeURL[@]}"; do
#if [ -n "${sampleCodeURL[$i]}" ]; then
dest_path="${WWDC_DIRNAME}/SAMPLE-CODE/${line} - ${sampleCodeName[$i]}.zip"
if [ -f "${dest_path}" ]
then
echo "${dest_path} already downloaded (nothing to do!)"
else
fileToLink=`find "${WWDC_DIRNAME}/SAMPLE-CODE/" -name "* ${sampleCodeName[$i]}.zip" | sed -n 1p`
echo "fileToLink=${fileToLink}"
if [[ -z "${fileToLink}" ]]; then
echo "downloading sample code for session ${line}: ${sampleCodeName[$i]}"
echo "${SAMPLE_CODE_ROOT_URL}/${sampleCodePATH}/${sampleCodeURL[$i]}"
curl -L "${SAMPLE_CODE_ROOT_URL}/${sampleCodePATH}/${sampleCodeURL[$i]}" > "${dest_path}.download" && mv "${dest_path}.download" "${dest_path}"
else
echo "==> package already exist: creating simlink for (${line}: ${sampleCodeName[$i]})"
ln -s "${fileToLink}" "${WWDC_DIRNAME}/SAMPLE-CODE/${line} - ${sampleCodeName[$i]}.zip"
fi
fi
#fi
done
fi
else
# downloading PDF file
dest_path="${WWDC_DIRNAME}/PDFs/${line} - ${title_array[$line]}.pdf"
if [ -f "${dest_path}" ]
then
echo "${dest_path} already downloaded (nothing to do!)"
else
if [[ ${line} != "103" && ${line} != "101" ]] #there is no point having pdf for Apple design Award or the Keynote
then
echo "downloading PDF doc for session ${line}: ${title_array[$line]}"
curl -L "${pdfURL}" > "${dest_path}.download" && mv "${dest_path}.download" "${dest_path}"
fi
fi
# downloading videos
dest_path="${WWDC_DIRNAME}/${FORMAT}-VIDEOs/${line} - ${title_array[$line]}-${FORMAT}.mov"
if [ -f "${dest_path}" ]
then
echo "${dest_path} already downloaded (nothing to do!)"
else
echo "downloading ${FORMAT} Video for session ${line}: ${title_array[$line]}"
curl -L "${videoURL}" > "${dest_path}.download" && mv "${dest_path}.download" "${dest_path}"
fi
# downloading sample codes files
for i in "${!sampleCodeURL[@]}"; do
#if [ -n "${sampleCodeName[$i]}" ]; then
dest_path="${WWDC_DIRNAME}/SAMPLE-CODE/${line} - ${sampleCodeName[$i]}.zip"
if [ -f "${dest_path}" ]
then
echo "${dest_path} already downloaded (nothing to do!)"
else
fileToLink=`find "${WWDC_DIRNAME}/SAMPLE-CODE/" -name "* ${sampleCodeName[$i]}.zip" | sed -n 1p`
if [[ -z "${fileToLink}" ]]; then
echo "downloading sample code for session ${line}: ${sampleCodeName[$i]}"
curl -L "${SAMPLE_CODE_ROOT_URL}/${sampleCodePATH}/${sampleCodeURL[$i]}" > "${dest_path}.download" && mv "${dest_path}.download" "${dest_path}"
else
echo "==> package already exist: creating simlink for (${line}: ${sampleCodeName[$i]})"
ln -s "${fileToLink}" "${WWDC_DIRNAME}/SAMPLE-CODE/${line} - ${sampleCodeName[$i]}.zip"
fi
fi
#fi
done
fi
((i+=1))
done;
rm -Rf ${TMP_DIR}
}
checkNetwork () {
curl -silent -D- -o /dev/null -s http://www.google.com 1>/dev/null 2>&1
if [[ $? == 0 ]]; then
:
#echo "there is netxork"
else
echo "No network connexion! Man, you're here for a long walk!"
exit 1
fi
}
##########################################################################################
####### MAIN ##########
##########################################################################################
#if [ $# -eq "0" ]
#then
# echo "WWDC videos and PDFs downloader (version ${VERSION})" >&2
# echo "Usage: `basename $0` [options] <Apple dev login>"
# echo "Please use -h for more options"
# exit 1
#fi
ituneslogin=${@: -1}
FORMAT=${DEFAULT_FORMAT}
YEAR=${DEFAULT_YEAR}
EVENT=${DEFAULT_EVENT}
while getopts ":hl:y:f:s:vLo:e:" opt; do
case $opt in
h)
echo "WWDC Videos and PDFs downloader (version ${VERSION})" >&2
echo "Author: Olivier HO-A-CHUCK (http://blog.hoachuck.biz)"
echo ""
echo "Usage: `basename $0` [options]"
echo "Try -L option for list of available videos"
echo ""
echo "Options:"
echo " -y <year>: select year (ex: -y 2013). Default year is 2015" >&2
echo " Possible values for year: 2013, 2014 and 2014" >&2
echo " For info: year 2012 videos download is not yet available - to be honest, I'm too lazy to do it!" >&2
echo " -e <event>: select event type between \"wwdc\" and \"tech-talks\"" >&2
echo " default value is \"wwdc\"" >&2
echo " -f <format>: select video format type (SD or HD). Default video format is SD" >&2
echo " -s <comma separated session numbers>: select which sessions you want to download (try -L option for list of avialable videos)" >&2
echo " -v : verbose mode" >&2
echo " -o <output path>: path where to download content (default is /Users/${USER}/Documents/WWDC-<selected year|default=2015>)" >&2
echo " -l [Not needed anymore] <iTunes login>: Give your Developer portal login (so far you don't need to login anymore. If this does change, please use -l option)." >&2
echo " -L : List available video sessions" >&2
echo "" >&2
echo ""
echo "Most common usage:" >&2
echo " - Download all available SD videos for wwdc 2015:" >&2
echo " `basename $0`" >&2
echo ""
echo "Other examples:" >&2
echo " - Download all PDFs and SD videos for wwdc 2014 if Apple change his mind and ask for login:" >&2
echo " `basename $0` -y 2014" >&2
echo " - Download all PDFs and SD videos for tech-talks 2013:" >&2
echo " `basename $0` -y 2013 -e tech-talks" >&2
echo " - Download all HD videos for wwdc 2015:" >&2
echo " `basename $0` -f HD" >&2
echo " - Download only session 201, 400 and 401 with SD videos for wwdc 2015:" >&2
echo " `basename $0` -s 201,400,401" >&2
echo " - Download only session 201 and 400 with HD video for wwdc 2015:" >&2
echo " `basename $0` -s 201,400 -f HD" >&2
echo " - Download all HD videos for wwdc 2015 in /Users/${USER}/Desktop/WWDC-2014 using verbose mode:" >&2
echo " `basename $0` -v -f HD -o /Users/${USER}/Desktop/WWDC-2014" >&2
echo ""
exit 0;
;;
l)
ITUNES_LOGIN=${OPTARG}
LOGIN=true
;;
y)
if [ $OPTARG = "2012" ] || [ $OPTARG = "2013" ] || [ $OPTARG = "2014" ] || [ $OPTARG = "2015" ];
then
YEAR=$OPTARG
else
echo "Unknown specified year. Using default (${YEAR})!"
fi
;;
f)
if [ $OPTARG = "SD" ] || [ $OPTARG = "HD" ];
then
FORMAT=$OPTARG
else
echo "Unknown specified format. Using ${FORMAT} video format!"
fi
;;
s)
if [ $OPTARG > 0 ];
then
SESSION_WANTED=$OPTARG
SELECTIVE_SESSION_MODE=true
else
echo "Session number does not look good!"
fi
;;
v)
echo "Verbose mode on"
VERBOSE=true
;;
L)
LIST_MODE=true
;;
o)
WWDC_DIRNAME=${OPTARG}
;;
e)
if [ $OPTARG = "tech-talks" ] || [ $OPTARG = "wwdc" ] ;
then
EVENT=$OPTARG
else
echo "Unknown event type. Using default (${EVENT})!"
fi
;;
\?)
echo "Invalid option: -$OPTARG" >&2
echo "For help, please use: $0 -h"
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
WWDC_DIRNAME=${WWDC_DIRNAME:-"${HOME}/Documents/WWDC-${YEAR}"}
case "${YEAR}" in
"2012")
if [ -z ${ITUNES_LOGIN} ];
then
read -r -p Login: ituneslogin ; echo
fi
if $LOGIN
then
read -r -s -p Password: itunespassword ; echo
else
echo ""
echo "Using 'no password' mode (this is possible since WWDC 2014 sessions addition => Apple bug ?)!"
echo "try using -l option if download does not work."
echo ""
ituneslogin="<no-login>"
itunespassword="<no-password>"
fi
checkNetwork
doGet2012 ${ituneslogin} ${itunespassword} ${FORMAT}
;;
"2013")
#if [ -z ${ITUNES_LOGIN} ];
#then
# read -r -p Login: ituneslogin ; echo
#fi
checkNetwork
if $LOGIN ;
then
read -r -s -p Password: itunespassword ; echo
else
echo ""
echo "Using 'no password' mode (this is possible since WWDC 2014 sessions addition => Apple bug ?)!"
echo "try using -l option if download does not work."
echo ""
ituneslogin="<no-login>"
itunespassword="<no-password>"
fi
if [ ${EVENT} == "wwdc" ];
then
VIDEO_URL=${VIDEO_URL_WWDC}/2013/
doGetWWDCPost2012 ${ituneslogin} ${itunespassword} ${FORMAT}
elif [ ${EVENT} == "tech-talks" ];
then
VIDEO_URL=${VIDEO_URL_TECHTALK}
doGetTT2013 ${ituneslogin} ${itunespassword} ${FORMAT}
fi
;;
"2014")
if $LOGIN ;
then
read -r -s -p Password: itunespassword ; echo
else
echo ""
echo "Using 'no password' mode (this is possible since WWDC 2014 sessions addition => Apple bug ?)!"
echo "try using -l option if download does not work."
echo ""
ituneslogin="<no-login>"
itunespassword="<no-password>"
fi
if [ ${EVENT} == "wwdc" ];
then
VIDEO_URL=${VIDEO_URL_WWDC}/2014/
doGetWWDCPost2012 ${ituneslogin} ${itunespassword} ${FORMAT}
elif [ ${EVENT} == "tech-talks" ];
then
#VIDEO_URL=${VIDEO_URL_TECHTALK}
#doGetTT2013 ${ituneslogin} ${itunespassword} ${FORMAT}
echo "No yet available session download other than 'wwdc' for 2014! Sorry man."
fi
;;
"2015")
checkNetwork
if $LOGIN ;
then