]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/adobepass.py
Prepare for upload.
[youtubedl] / youtube_dl / extractor / adobepass.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 import re
5 import time
6 import xml.etree.ElementTree as etree
7
8 from .common import InfoExtractor
9 from ..compat import compat_urlparse
10 from ..utils import (
11 unescapeHTML,
12 urlencode_postdata,
13 unified_timestamp,
14 ExtractorError,
15 )
16
17
18 MSO_INFO = {
19 'DTV': {
20 'name': 'DIRECTV',
21 'username_field': 'username',
22 'password_field': 'password',
23 },
24 'Rogers': {
25 'name': 'Rogers',
26 'username_field': 'UserName',
27 'password_field': 'UserPassword',
28 },
29 'Comcast_SSO': {
30 'name': 'Comcast XFINITY',
31 'username_field': 'user',
32 'password_field': 'passwd',
33 },
34 'TWC': {
35 'name': 'Time Warner Cable | Spectrum',
36 'username_field': 'Ecom_User_ID',
37 'password_field': 'Ecom_Password',
38 },
39 'thr030': {
40 'name': '3 Rivers Communications'
41 },
42 'com140': {
43 'name': 'Access Montana'
44 },
45 'acecommunications': {
46 'name': 'AcenTek'
47 },
48 'acm010': {
49 'name': 'Acme Communications'
50 },
51 'ada020': {
52 'name': 'Adams Cable Service'
53 },
54 'alb020': {
55 'name': 'Albany Mutual Telephone'
56 },
57 'algona': {
58 'name': 'Algona Municipal Utilities'
59 },
60 'allwest': {
61 'name': 'All West Communications'
62 },
63 'all025': {
64 'name': 'Allen\'s Communications'
65 },
66 'spl010': {
67 'name': 'Alliance Communications'
68 },
69 'all070': {
70 'name': 'ALLO Communications'
71 },
72 'alpine': {
73 'name': 'Alpine Communications'
74 },
75 'hun015': {
76 'name': 'American Broadband'
77 },
78 'nwc010': {
79 'name': 'American Broadband Missouri'
80 },
81 'com130-02': {
82 'name': 'American Community Networks'
83 },
84 'com130-01': {
85 'name': 'American Warrior Networks'
86 },
87 'tom020': {
88 'name': 'Amherst Telephone/Tomorrow Valley'
89 },
90 'tvc020': {
91 'name': 'Andycable'
92 },
93 'arkwest': {
94 'name': 'Arkwest Communications'
95 },
96 'art030': {
97 'name': 'Arthur Mutual Telephone Company'
98 },
99 'arvig': {
100 'name': 'Arvig'
101 },
102 'nttcash010': {
103 'name': 'Ashland Home Net'
104 },
105 'astound': {
106 'name': 'Astound (now Wave)'
107 },
108 'dix030': {
109 'name': 'ATC Broadband'
110 },
111 'ara010': {
112 'name': 'ATC Communications'
113 },
114 'she030-02': {
115 'name': 'Ayersville Communications'
116 },
117 'baldwin': {
118 'name': 'Baldwin Lightstream'
119 },
120 'bal040': {
121 'name': 'Ballard TV'
122 },
123 'cit025': {
124 'name': 'Bardstown Cable TV'
125 },
126 'bay030': {
127 'name': 'Bay Country Communications'
128 },
129 'tel095': {
130 'name': 'Beaver Creek Cooperative Telephone'
131 },
132 'bea020': {
133 'name': 'Beaver Valley Cable'
134 },
135 'bee010': {
136 'name': 'Bee Line Cable'
137 },
138 'wir030': {
139 'name': 'Beehive Broadband'
140 },
141 'bra020': {
142 'name': 'BELD'
143 },
144 'bel020': {
145 'name': 'Bellevue Municipal Cable'
146 },
147 'vol040-01': {
148 'name': 'Ben Lomand Connect / BLTV'
149 },
150 'bev010': {
151 'name': 'BEVCOMM'
152 },
153 'big020': {
154 'name': 'Big Sandy Broadband'
155 },
156 'ble020': {
157 'name': 'Bledsoe Telephone Cooperative'
158 },
159 'bvt010': {
160 'name': 'Blue Valley Tele-Communications'
161 },
162 'bra050': {
163 'name': 'Brandenburg Telephone Co.'
164 },
165 'bte010': {
166 'name': 'Bristol Tennessee Essential Services'
167 },
168 'annearundel': {
169 'name': 'Broadstripe'
170 },
171 'btc010': {
172 'name': 'BTC Communications'
173 },
174 'btc040': {
175 'name': 'BTC Vision - Nahunta'
176 },
177 'bul010': {
178 'name': 'Bulloch Telephone Cooperative'
179 },
180 'but010': {
181 'name': 'Butler-Bremer Communications'
182 },
183 'tel160-csp': {
184 'name': 'C Spire SNAP'
185 },
186 'csicable': {
187 'name': 'Cable Services Inc.'
188 },
189 'cableamerica': {
190 'name': 'CableAmerica'
191 },
192 'cab038': {
193 'name': 'CableSouth Media 3'
194 },
195 'weh010-camtel': {
196 'name': 'Cam-Tel Company'
197 },
198 'car030': {
199 'name': 'Cameron Communications'
200 },
201 'canbytel': {
202 'name': 'Canby Telcom'
203 },
204 'crt020': {
205 'name': 'CapRock Tv'
206 },
207 'car050': {
208 'name': 'Carnegie Cable'
209 },
210 'cas': {
211 'name': 'CAS Cable'
212 },
213 'casscomm': {
214 'name': 'CASSCOMM'
215 },
216 'mid180-02': {
217 'name': 'Catalina Broadband Solutions'
218 },
219 'cccomm': {
220 'name': 'CC Communications'
221 },
222 'nttccde010': {
223 'name': 'CDE Lightband'
224 },
225 'cfunet': {
226 'name': 'Cedar Falls Utilities'
227 },
228 'dem010-01': {
229 'name': 'Celect-Bloomer Telephone Area'
230 },
231 'dem010-02': {
232 'name': 'Celect-Bruce Telephone Area'
233 },
234 'dem010-03': {
235 'name': 'Celect-Citizens Connected Area'
236 },
237 'dem010-04': {
238 'name': 'Celect-Elmwood/Spring Valley Area'
239 },
240 'dem010-06': {
241 'name': 'Celect-Mosaic Telecom'
242 },
243 'dem010-05': {
244 'name': 'Celect-West WI Telephone Area'
245 },
246 'net010-02': {
247 'name': 'Cellcom/Nsight Telservices'
248 },
249 'cen100': {
250 'name': 'CentraCom'
251 },
252 'nttccst010': {
253 'name': 'Central Scott / CSTV'
254 },
255 'cha035': {
256 'name': 'Chaparral CableVision'
257 },
258 'cha050': {
259 'name': 'Chariton Valley Communication Corporation, Inc.'
260 },
261 'cha060': {
262 'name': 'Chatmoss Cablevision'
263 },
264 'nttcche010': {
265 'name': 'Cherokee Communications'
266 },
267 'che050': {
268 'name': 'Chesapeake Bay Communications'
269 },
270 'cimtel': {
271 'name': 'Cim-Tel Cable, LLC.'
272 },
273 'cit180': {
274 'name': 'Citizens Cablevision - Floyd, VA'
275 },
276 'cit210': {
277 'name': 'Citizens Cablevision, Inc.'
278 },
279 'cit040': {
280 'name': 'Citizens Fiber'
281 },
282 'cit250': {
283 'name': 'Citizens Mutual'
284 },
285 'war040': {
286 'name': 'Citizens Telephone Corporation'
287 },
288 'wat025': {
289 'name': 'City Of Monroe'
290 },
291 'wadsworth': {
292 'name': 'CityLink'
293 },
294 'nor100': {
295 'name': 'CL Tel'
296 },
297 'cla010': {
298 'name': 'Clarence Telephone and Cedar Communications'
299 },
300 'ser060': {
301 'name': 'Clear Choice Communications'
302 },
303 'tac020': {
304 'name': 'Click! Cable TV'
305 },
306 'war020': {
307 'name': 'CLICK1.NET'
308 },
309 'cml010': {
310 'name': 'CML Telephone Cooperative Association'
311 },
312 'cns': {
313 'name': 'CNS'
314 },
315 'com160': {
316 'name': 'Co-Mo Connect'
317 },
318 'coa020': {
319 'name': 'Coast Communications'
320 },
321 'coa030': {
322 'name': 'Coaxial Cable TV'
323 },
324 'mid055': {
325 'name': 'Cobalt TV (Mid-State Community TV)'
326 },
327 'col070': {
328 'name': 'Columbia Power & Water Systems'
329 },
330 'col080': {
331 'name': 'Columbus Telephone'
332 },
333 'nor105': {
334 'name': 'Communications 1 Cablevision, Inc.'
335 },
336 'com150': {
337 'name': 'Community Cable & Broadband'
338 },
339 'com020': {
340 'name': 'Community Communications Company'
341 },
342 'coy010': {
343 'name': 'commZoom'
344 },
345 'com025': {
346 'name': 'Complete Communication Services'
347 },
348 'cat020': {
349 'name': 'Comporium'
350 },
351 'com071': {
352 'name': 'ComSouth Telesys'
353 },
354 'consolidatedcable': {
355 'name': 'Consolidated'
356 },
357 'conwaycorp': {
358 'name': 'Conway Corporation'
359 },
360 'coo050': {
361 'name': 'Coon Valley Telecommunications Inc'
362 },
363 'coo080': {
364 'name': 'Cooperative Telephone Company'
365 },
366 'cpt010': {
367 'name': 'CP-TEL'
368 },
369 'cra010': {
370 'name': 'Craw-Kan Telephone'
371 },
372 'crestview': {
373 'name': 'Crestview Cable Communications'
374 },
375 'cross': {
376 'name': 'Cross TV'
377 },
378 'cro030': {
379 'name': 'Crosslake Communications'
380 },
381 'ctc040': {
382 'name': 'CTC - Brainerd MN'
383 },
384 'phe030': {
385 'name': 'CTV-Beam - East Alabama'
386 },
387 'cun010': {
388 'name': 'Cunningham Telephone & Cable'
389 },
390 'dpc010': {
391 'name': 'D & P Communications'
392 },
393 'dak030': {
394 'name': 'Dakota Central Telecommunications'
395 },
396 'nttcdel010': {
397 'name': 'Delcambre Telephone LLC'
398 },
399 'tel160-del': {
400 'name': 'Delta Telephone Company'
401 },
402 'sal040': {
403 'name': 'DiamondNet'
404 },
405 'ind060-dc': {
406 'name': 'Direct Communications'
407 },
408 'doy010': {
409 'name': 'Doylestown Cable TV'
410 },
411 'dic010': {
412 'name': 'DRN'
413 },
414 'dtc020': {
415 'name': 'DTC'
416 },
417 'dtc010': {
418 'name': 'DTC Cable (Delhi)'
419 },
420 'dum010': {
421 'name': 'Dumont Telephone Company'
422 },
423 'dun010': {
424 'name': 'Dunkerton Telephone Cooperative'
425 },
426 'cci010': {
427 'name': 'Duo County Telecom'
428 },
429 'eagle': {
430 'name': 'Eagle Communications'
431 },
432 'weh010-east': {
433 'name': 'East Arkansas Cable TV'
434 },
435 'eatel': {
436 'name': 'EATEL Video, LLC'
437 },
438 'ell010': {
439 'name': 'ECTA'
440 },
441 'emerytelcom': {
442 'name': 'Emery Telcom Video LLC'
443 },
444 'nor200': {
445 'name': 'Empire Access'
446 },
447 'endeavor': {
448 'name': 'Endeavor Communications'
449 },
450 'sun045': {
451 'name': 'Enhanced Telecommunications Corporation'
452 },
453 'mid030': {
454 'name': 'enTouch'
455 },
456 'epb020': {
457 'name': 'EPB Smartnet'
458 },
459 'jea010': {
460 'name': 'EPlus Broadband'
461 },
462 'com065': {
463 'name': 'ETC'
464 },
465 'ete010': {
466 'name': 'Etex Communications'
467 },
468 'fbc-tele': {
469 'name': 'F&B Communications'
470 },
471 'fal010': {
472 'name': 'Falcon Broadband'
473 },
474 'fam010': {
475 'name': 'FamilyView CableVision'
476 },
477 'far020': {
478 'name': 'Farmers Mutual Telephone Company'
479 },
480 'fay010': {
481 'name': 'Fayetteville Public Utilities'
482 },
483 'sal060': {
484 'name': 'fibrant'
485 },
486 'fid010': {
487 'name': 'Fidelity Communications'
488 },
489 'for030': {
490 'name': 'FJ Communications'
491 },
492 'fli020': {
493 'name': 'Flint River Communications'
494 },
495 'far030': {
496 'name': 'FMT - Jesup'
497 },
498 'foo010': {
499 'name': 'Foothills Communications'
500 },
501 'for080': {
502 'name': 'Forsyth CableNet'
503 },
504 'fbcomm': {
505 'name': 'Frankfort Plant Board'
506 },
507 'tel160-fra': {
508 'name': 'Franklin Telephone Company'
509 },
510 'nttcftc010': {
511 'name': 'FTC'
512 },
513 'fullchannel': {
514 'name': 'Full Channel, Inc.'
515 },
516 'gar040': {
517 'name': 'Gardonville Cooperative Telephone Association'
518 },
519 'gbt010': {
520 'name': 'GBT Communications, Inc.'
521 },
522 'tec010': {
523 'name': 'Genuine Telecom'
524 },
525 'clr010': {
526 'name': 'Giant Communications'
527 },
528 'gla010': {
529 'name': 'Glasgow EPB'
530 },
531 'gle010': {
532 'name': 'Glenwood Telecommunications'
533 },
534 'gra060': {
535 'name': 'GLW Broadband Inc.'
536 },
537 'goldenwest': {
538 'name': 'Golden West Cablevision'
539 },
540 'vis030': {
541 'name': 'Grantsburg Telcom'
542 },
543 'gpcom': {
544 'name': 'Great Plains Communications'
545 },
546 'gri010': {
547 'name': 'Gridley Cable Inc'
548 },
549 'hbc010': {
550 'name': 'H&B Cable Services'
551 },
552 'hae010': {
553 'name': 'Haefele TV Inc.'
554 },
555 'htc010': {
556 'name': 'Halstad Telephone Company'
557 },
558 'har005': {
559 'name': 'Harlan Municipal Utilities'
560 },
561 'har020': {
562 'name': 'Hart Communications'
563 },
564 'ced010': {
565 'name': 'Hartelco TV'
566 },
567 'hea040': {
568 'name': 'Heart of Iowa Communications Cooperative'
569 },
570 'htc020': {
571 'name': 'Hickory Telephone Company'
572 },
573 'nttchig010': {
574 'name': 'Highland Communication Services'
575 },
576 'hig030': {
577 'name': 'Highland Media'
578 },
579 'spc010': {
580 'name': 'Hilliary Communications'
581 },
582 'hin020': {
583 'name': 'Hinton CATV Co.'
584 },
585 'hometel': {
586 'name': 'HomeTel Entertainment, Inc.'
587 },
588 'hoodcanal': {
589 'name': 'Hood Canal Communications'
590 },
591 'weh010-hope': {
592 'name': 'Hope - Prescott Cable TV'
593 },
594 'horizoncable': {
595 'name': 'Horizon Cable TV, Inc.'
596 },
597 'hor040': {
598 'name': 'Horizon Chillicothe Telephone'
599 },
600 'htc030': {
601 'name': 'HTC Communications Co. - IL'
602 },
603 'htccomm': {
604 'name': 'HTC Communications, Inc. - IA'
605 },
606 'wal005': {
607 'name': 'Huxley Communications'
608 },
609 'imon': {
610 'name': 'ImOn Communications'
611 },
612 'ind040': {
613 'name': 'Independence Telecommunications'
614 },
615 'rrc010': {
616 'name': 'Inland Networks'
617 },
618 'stc020': {
619 'name': 'Innovative Cable TV St Croix'
620 },
621 'car100': {
622 'name': 'Innovative Cable TV St Thomas-St John'
623 },
624 'icc010': {
625 'name': 'Inside Connect Cable'
626 },
627 'int100': {
628 'name': 'Integra Telecom'
629 },
630 'int050': {
631 'name': 'Interstate Telecommunications Coop'
632 },
633 'irv010': {
634 'name': 'Irvine Cable'
635 },
636 'k2c010': {
637 'name': 'K2 Communications'
638 },
639 'kal010': {
640 'name': 'Kalida Telephone Company, Inc.'
641 },
642 'kal030': {
643 'name': 'Kalona Cooperative Telephone Company'
644 },
645 'kmt010': {
646 'name': 'KMTelecom'
647 },
648 'kpu010': {
649 'name': 'KPU Telecommunications'
650 },
651 'kuh010': {
652 'name': 'Kuhn Communications, Inc.'
653 },
654 'lak130': {
655 'name': 'Lakeland Communications'
656 },
657 'lan010': {
658 'name': 'Langco'
659 },
660 'lau020': {
661 'name': 'Laurel Highland Total Communications, Inc.'
662 },
663 'leh010': {
664 'name': 'Lehigh Valley Cooperative Telephone'
665 },
666 'bra010': {
667 'name': 'Limestone Cable/Bracken Cable'
668 },
669 'loc020': {
670 'name': 'LISCO'
671 },
672 'lit020': {
673 'name': 'Litestream'
674 },
675 'tel140': {
676 'name': 'LivCom'
677 },
678 'loc010': {
679 'name': 'LocalTel Communications'
680 },
681 'weh010-longview': {
682 'name': 'Longview - Kilgore Cable TV'
683 },
684 'lon030': {
685 'name': 'Lonsdale Video Ventures, LLC'
686 },
687 'lns010': {
688 'name': 'Lost Nation-Elwood Telephone Co.'
689 },
690 'nttclpc010': {
691 'name': 'LPC Connect'
692 },
693 'lumos': {
694 'name': 'Lumos Networks'
695 },
696 'madison': {
697 'name': 'Madison Communications'
698 },
699 'mad030': {
700 'name': 'Madison County Cable Inc.'
701 },
702 'nttcmah010': {
703 'name': 'Mahaska Communication Group'
704 },
705 'mar010': {
706 'name': 'Marne & Elk Horn Telephone Company'
707 },
708 'mcc040': {
709 'name': 'McClure Telephone Co.'
710 },
711 'mctv': {
712 'name': 'MCTV'
713 },
714 'merrimac': {
715 'name': 'Merrimac Communications Ltd.'
716 },
717 'metronet': {
718 'name': 'Metronet'
719 },
720 'mhtc': {
721 'name': 'MHTC'
722 },
723 'midhudson': {
724 'name': 'Mid-Hudson Cable'
725 },
726 'midrivers': {
727 'name': 'Mid-Rivers Communications'
728 },
729 'mid045': {
730 'name': 'Midstate Communications'
731 },
732 'mil080': {
733 'name': 'Milford Communications'
734 },
735 'min030': {
736 'name': 'MINET'
737 },
738 'nttcmin010': {
739 'name': 'Minford TV'
740 },
741 'san040-02': {
742 'name': 'Mitchell Telecom'
743 },
744 'mlg010': {
745 'name': 'MLGC'
746 },
747 'mon060': {
748 'name': 'Mon-Cre TVE'
749 },
750 'mou110': {
751 'name': 'Mountain Telephone'
752 },
753 'mou050': {
754 'name': 'Mountain Village Cable'
755 },
756 'mtacomm': {
757 'name': 'MTA Communications, LLC'
758 },
759 'mtc010': {
760 'name': 'MTC Cable'
761 },
762 'med040': {
763 'name': 'MTC Technologies'
764 },
765 'man060': {
766 'name': 'MTCC'
767 },
768 'mtc030': {
769 'name': 'MTCO Communications'
770 },
771 'mul050': {
772 'name': 'Mulberry Telecommunications'
773 },
774 'mur010': {
775 'name': 'Murray Electric System'
776 },
777 'musfiber': {
778 'name': 'MUS FiberNET'
779 },
780 'mpw': {
781 'name': 'Muscatine Power & Water'
782 },
783 'nttcsli010': {
784 'name': 'myEVTV.com'
785 },
786 'nor115': {
787 'name': 'NCC'
788 },
789 'nor260': {
790 'name': 'NDTC'
791 },
792 'nctc': {
793 'name': 'Nebraska Central Telecom, Inc.'
794 },
795 'nel020': {
796 'name': 'Nelsonville TV Cable'
797 },
798 'nem010': {
799 'name': 'Nemont'
800 },
801 'new075': {
802 'name': 'New Hope Telephone Cooperative'
803 },
804 'nor240': {
805 'name': 'NICP'
806 },
807 'cic010': {
808 'name': 'NineStar Connect'
809 },
810 'nktelco': {
811 'name': 'NKTelco'
812 },
813 'nortex': {
814 'name': 'Nortex Communications'
815 },
816 'nor140': {
817 'name': 'North Central Telephone Cooperative'
818 },
819 'nor030': {
820 'name': 'Northland Communications'
821 },
822 'nor075': {
823 'name': 'Northwest Communications'
824 },
825 'nor125': {
826 'name': 'Norwood Light Broadband'
827 },
828 'net010': {
829 'name': 'Nsight Telservices'
830 },
831 'dur010': {
832 'name': 'Ntec'
833 },
834 'nts010': {
835 'name': 'NTS Communications'
836 },
837 'new045': {
838 'name': 'NU-Telecom'
839 },
840 'nulink': {
841 'name': 'NuLink'
842 },
843 'jam030': {
844 'name': 'NVC'
845 },
846 'far035': {
847 'name': 'OmniTel Communications'
848 },
849 'onesource': {
850 'name': 'OneSource Communications'
851 },
852 'cit230': {
853 'name': 'Opelika Power Services'
854 },
855 'daltonutilities': {
856 'name': 'OptiLink'
857 },
858 'mid140': {
859 'name': 'OPTURA'
860 },
861 'ote010': {
862 'name': 'OTEC Communication Company'
863 },
864 'cci020': {
865 'name': 'Packerland Broadband'
866 },
867 'pan010': {
868 'name': 'Panora Telco/Guthrie Center Communications'
869 },
870 'otter': {
871 'name': 'Park Region Telephone & Otter Tail Telcom'
872 },
873 'mid050': {
874 'name': 'Partner Communications Cooperative'
875 },
876 'fib010': {
877 'name': 'Pathway'
878 },
879 'paulbunyan': {
880 'name': 'Paul Bunyan Communications'
881 },
882 'pem020': {
883 'name': 'Pembroke Telephone Company'
884 },
885 'mck010': {
886 'name': 'Peoples Rural Telephone Cooperative'
887 },
888 'pul010': {
889 'name': 'PES Energize'
890 },
891 'phi010': {
892 'name': 'Philippi Communications System'
893 },
894 'phonoscope': {
895 'name': 'Phonoscope Cable'
896 },
897 'pin070': {
898 'name': 'Pine Belt Communications, Inc.'
899 },
900 'weh010-pine': {
901 'name': 'Pine Bluff Cable TV'
902 },
903 'pin060': {
904 'name': 'Pineland Telephone Cooperative'
905 },
906 'cam010': {
907 'name': 'Pinpoint Communications'
908 },
909 'pio060': {
910 'name': 'Pioneer Broadband'
911 },
912 'pioncomm': {
913 'name': 'Pioneer Communications'
914 },
915 'pioneer': {
916 'name': 'Pioneer DTV'
917 },
918 'pla020': {
919 'name': 'Plant TiftNet, Inc.'
920 },
921 'par010': {
922 'name': 'PLWC'
923 },
924 'pro035': {
925 'name': 'PMT'
926 },
927 'vik011': {
928 'name': 'Polar Cablevision'
929 },
930 'pottawatomie': {
931 'name': 'Pottawatomie Telephone Co.'
932 },
933 'premiercomm': {
934 'name': 'Premier Communications'
935 },
936 'psc010': {
937 'name': 'PSC'
938 },
939 'pan020': {
940 'name': 'PTCI'
941 },
942 'qco010': {
943 'name': 'QCOL'
944 },
945 'qua010': {
946 'name': 'Quality Cablevision'
947 },
948 'rad010': {
949 'name': 'Radcliffe Telephone Company'
950 },
951 'car040': {
952 'name': 'Rainbow Communications'
953 },
954 'rai030': {
955 'name': 'Rainier Connect'
956 },
957 'ral010': {
958 'name': 'Ralls Technologies'
959 },
960 'rct010': {
961 'name': 'RC Technologies'
962 },
963 'red040': {
964 'name': 'Red River Communications'
965 },
966 'ree010': {
967 'name': 'Reedsburg Utility Commission'
968 },
969 'mol010': {
970 'name': 'Reliance Connects- Oregon'
971 },
972 'res020': {
973 'name': 'Reserve Telecommunications'
974 },
975 'weh010-resort': {
976 'name': 'Resort TV Cable'
977 },
978 'rld010': {
979 'name': 'Richland Grant Telephone Cooperative, Inc.'
980 },
981 'riv030': {
982 'name': 'River Valley Telecommunications Coop'
983 },
984 'rockportcable': {
985 'name': 'Rock Port Cablevision'
986 },
987 'rsf010': {
988 'name': 'RS Fiber'
989 },
990 'rtc': {
991 'name': 'RTC Communication Corp'
992 },
993 'res040': {
994 'name': 'RTC-Reservation Telephone Coop.'
995 },
996 'rte010': {
997 'name': 'RTEC Communications'
998 },
999 'stc010': {
1000 'name': 'S&T'
1001 },
1002 'san020': {
1003 'name': 'San Bruno Cable TV'
1004 },
1005 'san040-01': {
1006 'name': 'Santel'
1007 },
1008 'sav010': {
1009 'name': 'SCI Broadband-Savage Communications Inc.'
1010 },
1011 'sco050': {
1012 'name': 'Scottsboro Electric Power Board'
1013 },
1014 'scr010': {
1015 'name': 'Scranton Telephone Company'
1016 },
1017 'selco': {
1018 'name': 'SELCO'
1019 },
1020 'she010': {
1021 'name': 'Shentel'
1022 },
1023 'she030': {
1024 'name': 'Sherwood Mutual Telephone Association, Inc.'
1025 },
1026 'ind060-ssc': {
1027 'name': 'Silver Star Communications'
1028 },
1029 'sjoberg': {
1030 'name': 'Sjoberg\'s Inc.'
1031 },
1032 'sou025': {
1033 'name': 'SKT'
1034 },
1035 'sky050': {
1036 'name': 'SkyBest TV'
1037 },
1038 'nttcsmi010': {
1039 'name': 'Smithville Communications'
1040 },
1041 'woo010': {
1042 'name': 'Solarus'
1043 },
1044 'sou075': {
1045 'name': 'South Central Rural Telephone Cooperative'
1046 },
1047 'sou065': {
1048 'name': 'South Holt Cablevision, Inc.'
1049 },
1050 'sou035': {
1051 'name': 'South Slope Cooperative Communications'
1052 },
1053 'spa020': {
1054 'name': 'Spanish Fork Community Network'
1055 },
1056 'spe010': {
1057 'name': 'Spencer Municipal Utilities'
1058 },
1059 'spi005': {
1060 'name': 'Spillway Communications, Inc.'
1061 },
1062 'srt010': {
1063 'name': 'SRT'
1064 },
1065 'cccsmc010': {
1066 'name': 'St. Maarten Cable TV'
1067 },
1068 'sta025': {
1069 'name': 'Star Communications'
1070 },
1071 'sco020': {
1072 'name': 'STE'
1073 },
1074 'uin010': {
1075 'name': 'STRATA Networks'
1076 },
1077 'sum010': {
1078 'name': 'Sumner Cable TV'
1079 },
1080 'pie010': {
1081 'name': 'Surry TV/PCSI TV'
1082 },
1083 'swa010': {
1084 'name': 'Swayzee Communications'
1085 },
1086 'sweetwater': {
1087 'name': 'Sweetwater Cable Television Co'
1088 },
1089 'weh010-talequah': {
1090 'name': 'Tahlequah Cable TV'
1091 },
1092 'tct': {
1093 'name': 'TCT'
1094 },
1095 'tel050': {
1096 'name': 'Tele-Media Company'
1097 },
1098 'com050': {
1099 'name': 'The Community Agency'
1100 },
1101 'thr020': {
1102 'name': 'Three River'
1103 },
1104 'cab140': {
1105 'name': 'Town & Country Technologies'
1106 },
1107 'tra010': {
1108 'name': 'Trans-Video'
1109 },
1110 'tre010': {
1111 'name': 'Trenton TV Cable Company'
1112 },
1113 'tcc': {
1114 'name': 'Tri County Communications Cooperative'
1115 },
1116 'tri025': {
1117 'name': 'TriCounty Telecom'
1118 },
1119 'tri110': {
1120 'name': 'TrioTel Communications, Inc.'
1121 },
1122 'tro010': {
1123 'name': 'Troy Cablevision, Inc.'
1124 },
1125 'tsc': {
1126 'name': 'TSC'
1127 },
1128 'cit220': {
1129 'name': 'Tullahoma Utilities Board'
1130 },
1131 'tvc030': {
1132 'name': 'TV Cable of Rensselaer'
1133 },
1134 'tvc015': {
1135 'name': 'TVC Cable'
1136 },
1137 'cab180': {
1138 'name': 'TVision'
1139 },
1140 'twi040': {
1141 'name': 'Twin Lakes'
1142 },
1143 'tvtinc': {
1144 'name': 'Twin Valley'
1145 },
1146 'uis010': {
1147 'name': 'Union Telephone Company'
1148 },
1149 'uni110': {
1150 'name': 'United Communications - TN'
1151 },
1152 'uni120': {
1153 'name': 'United Services'
1154 },
1155 'uss020': {
1156 'name': 'US Sonet'
1157 },
1158 'cab060': {
1159 'name': 'USA Communications'
1160 },
1161 'she005': {
1162 'name': 'USA Communications/Shellsburg, IA'
1163 },
1164 'val040': {
1165 'name': 'Valley TeleCom Group'
1166 },
1167 'val025': {
1168 'name': 'Valley Telecommunications'
1169 },
1170 'val030': {
1171 'name': 'Valparaiso Broadband'
1172 },
1173 'cla050': {
1174 'name': 'Vast Broadband'
1175 },
1176 'sul015': {
1177 'name': 'Venture Communications Cooperative, Inc.'
1178 },
1179 'ver025': {
1180 'name': 'Vernon Communications Co-op'
1181 },
1182 'weh010-vicksburg': {
1183 'name': 'Vicksburg Video'
1184 },
1185 'vis070': {
1186 'name': 'Vision Communications'
1187 },
1188 'volcanotel': {
1189 'name': 'Volcano Vision, Inc.'
1190 },
1191 'vol040-02': {
1192 'name': 'VolFirst / BLTV'
1193 },
1194 'ver070': {
1195 'name': 'VTel'
1196 },
1197 'nttcvtx010': {
1198 'name': 'VTX1'
1199 },
1200 'bci010-02': {
1201 'name': 'Vyve Broadband'
1202 },
1203 'wab020': {
1204 'name': 'Wabash Mutual Telephone'
1205 },
1206 'waitsfield': {
1207 'name': 'Waitsfield Cable'
1208 },
1209 'wal010': {
1210 'name': 'Walnut Communications'
1211 },
1212 'wavebroadband': {
1213 'name': 'Wave'
1214 },
1215 'wav030': {
1216 'name': 'Waverly Communications Utility'
1217 },
1218 'wbi010': {
1219 'name': 'WBI'
1220 },
1221 'web020': {
1222 'name': 'Webster-Calhoun Cooperative Telephone Association'
1223 },
1224 'wes005': {
1225 'name': 'West Alabama TV Cable'
1226 },
1227 'carolinata': {
1228 'name': 'West Carolina Communications'
1229 },
1230 'wct010': {
1231 'name': 'West Central Telephone Association'
1232 },
1233 'wes110': {
1234 'name': 'West River Cooperative Telephone Company'
1235 },
1236 'ani030': {
1237 'name': 'WesTel Systems'
1238 },
1239 'westianet': {
1240 'name': 'Western Iowa Networks'
1241 },
1242 'nttcwhi010': {
1243 'name': 'Whidbey Telecom'
1244 },
1245 'weh010-white': {
1246 'name': 'White County Cable TV'
1247 },
1248 'wes130': {
1249 'name': 'Wiatel'
1250 },
1251 'wik010': {
1252 'name': 'Wiktel'
1253 },
1254 'wil070': {
1255 'name': 'Wilkes Communications, Inc./RiverStreet Networks'
1256 },
1257 'wil015': {
1258 'name': 'Wilson Communications'
1259 },
1260 'win010': {
1261 'name': 'Windomnet/SMBS'
1262 },
1263 'win090': {
1264 'name': 'Windstream Cable TV'
1265 },
1266 'wcta': {
1267 'name': 'Winnebago Cooperative Telecom Association'
1268 },
1269 'wtc010': {
1270 'name': 'WTC'
1271 },
1272 'wil040': {
1273 'name': 'WTC Communications, Inc.'
1274 },
1275 'wya010': {
1276 'name': 'Wyandotte Cable'
1277 },
1278 'hin020-02': {
1279 'name': 'X-Stream Services'
1280 },
1281 'xit010': {
1282 'name': 'XIT Communications'
1283 },
1284 'yel010': {
1285 'name': 'Yelcot Communications'
1286 },
1287 'mid180-01': {
1288 'name': 'yondoo'
1289 },
1290 'cou060': {
1291 'name': 'Zito Media'
1292 },
1293 }
1294
1295
1296 class AdobePassIE(InfoExtractor):
1297 _SERVICE_PROVIDER_TEMPLATE = 'https://sp.auth.adobe.com/adobe-services/%s'
1298 _USER_AGENT = 'Mozilla/5.0 (X11; Linux i686; rv:47.0) Gecko/20100101 Firefox/47.0'
1299 _MVPD_CACHE = 'ap-mvpd'
1300
1301 @staticmethod
1302 def _get_mvpd_resource(provider_id, title, guid, rating):
1303 channel = etree.Element('channel')
1304 channel_title = etree.SubElement(channel, 'title')
1305 channel_title.text = provider_id
1306 item = etree.SubElement(channel, 'item')
1307 resource_title = etree.SubElement(item, 'title')
1308 resource_title.text = title
1309 resource_guid = etree.SubElement(item, 'guid')
1310 resource_guid.text = guid
1311 resource_rating = etree.SubElement(item, 'media:rating')
1312 resource_rating.attrib = {'scheme': 'urn:v-chip'}
1313 resource_rating.text = rating
1314 return '<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/">' + etree.tostring(channel).decode() + '</rss>'
1315
1316 def _extract_mvpd_auth(self, url, video_id, requestor_id, resource):
1317 def xml_text(xml_str, tag):
1318 return self._search_regex(
1319 '<%s>(.+?)</%s>' % (tag, tag), xml_str, tag)
1320
1321 def is_expired(token, date_ele):
1322 token_expires = unified_timestamp(re.sub(r'[_ ]GMT', '', xml_text(token, date_ele)))
1323 return token_expires and token_expires <= int(time.time())
1324
1325 def post_form(form_page_res, note, data={}):
1326 form_page, urlh = form_page_res
1327 post_url = self._html_search_regex(r'<form[^>]+action=(["\'])(?P<url>.+?)\1', form_page, 'post url', group='url')
1328 if not re.match(r'https?://', post_url):
1329 post_url = compat_urlparse.urljoin(urlh.geturl(), post_url)
1330 form_data = self._hidden_inputs(form_page)
1331 form_data.update(data)
1332 return self._download_webpage_handle(
1333 post_url, video_id, note, data=urlencode_postdata(form_data), headers={
1334 'Content-Type': 'application/x-www-form-urlencoded',
1335 })
1336
1337 def raise_mvpd_required():
1338 raise ExtractorError(
1339 'This video is only available for users of participating TV providers. '
1340 'Use --ap-mso to specify Adobe Pass Multiple-system operator Identifier '
1341 'and --ap-username and --ap-password or --netrc to provide account credentials.', expected=True)
1342
1343 mvpd_headers = {
1344 'ap_42': 'anonymous',
1345 'ap_11': 'Linux i686',
1346 'ap_z': self._USER_AGENT,
1347 'User-Agent': self._USER_AGENT,
1348 }
1349
1350 guid = xml_text(resource, 'guid') if '<' in resource else resource
1351 count = 0
1352 while count < 2:
1353 requestor_info = self._downloader.cache.load(self._MVPD_CACHE, requestor_id) or {}
1354 authn_token = requestor_info.get('authn_token')
1355 if authn_token and is_expired(authn_token, 'simpleTokenExpires'):
1356 authn_token = None
1357 if not authn_token:
1358 # TODO add support for other TV Providers
1359 mso_id = self._downloader.params.get('ap_mso')
1360 if not mso_id:
1361 raise_mvpd_required()
1362 username, password = self._get_login_info('ap_username', 'ap_password', mso_id)
1363 if not username or not password:
1364 raise_mvpd_required()
1365 mso_info = MSO_INFO[mso_id]
1366
1367 provider_redirect_page_res = self._download_webpage_handle(
1368 self._SERVICE_PROVIDER_TEMPLATE % 'authenticate/saml', video_id,
1369 'Downloading Provider Redirect Page', query={
1370 'noflash': 'true',
1371 'mso_id': mso_id,
1372 'requestor_id': requestor_id,
1373 'no_iframe': 'false',
1374 'domain_name': 'adobe.com',
1375 'redirect_url': url,
1376 })
1377
1378 if mso_id == 'Comcast_SSO':
1379 # Comcast page flow varies by video site and whether you
1380 # are on Comcast's network.
1381 provider_redirect_page, urlh = provider_redirect_page_res
1382 # Check for Comcast auto login
1383 if 'automatically signing you in' in provider_redirect_page:
1384 oauth_redirect_url = self._html_search_regex(
1385 r'window\.location\s*=\s*[\'"]([^\'"]+)',
1386 provider_redirect_page, 'oauth redirect')
1387 # Just need to process the request. No useful data comes back
1388 self._download_webpage(
1389 oauth_redirect_url, video_id, 'Confirming auto login')
1390 else:
1391 if '<form name="signin"' in provider_redirect_page:
1392 # already have the form, just fill it
1393 provider_login_page_res = provider_redirect_page_res
1394 elif 'http-equiv="refresh"' in provider_redirect_page:
1395 # redirects to the login page
1396 oauth_redirect_url = self._html_search_regex(
1397 r'content="0;\s*url=([^\'"]+)',
1398 provider_redirect_page, 'meta refresh redirect')
1399 provider_login_page_res = self._download_webpage_handle(
1400 oauth_redirect_url,
1401 video_id, 'Downloading Provider Login Page')
1402 else:
1403 provider_login_page_res = post_form(
1404 provider_redirect_page_res, 'Downloading Provider Login Page')
1405
1406 mvpd_confirm_page_res = post_form(provider_login_page_res, 'Logging in', {
1407 mso_info.get('username_field', 'username'): username,
1408 mso_info.get('password_field', 'password'): password,
1409 })
1410 mvpd_confirm_page, urlh = mvpd_confirm_page_res
1411 if '<button class="submit" value="Resume">Resume</button>' in mvpd_confirm_page:
1412 post_form(mvpd_confirm_page_res, 'Confirming Login')
1413
1414 else:
1415 # Normal, non-Comcast flow
1416 provider_login_page_res = post_form(
1417 provider_redirect_page_res, 'Downloading Provider Login Page')
1418 mvpd_confirm_page_res = post_form(provider_login_page_res, 'Logging in', {
1419 mso_info.get('username_field', 'username'): username,
1420 mso_info.get('password_field', 'password'): password,
1421 })
1422 if mso_id != 'Rogers':
1423 post_form(mvpd_confirm_page_res, 'Confirming Login')
1424
1425 session = self._download_webpage(
1426 self._SERVICE_PROVIDER_TEMPLATE % 'session', video_id,
1427 'Retrieving Session', data=urlencode_postdata({
1428 '_method': 'GET',
1429 'requestor_id': requestor_id,
1430 }), headers=mvpd_headers)
1431 if '<pendingLogout' in session:
1432 self._downloader.cache.store(self._MVPD_CACHE, requestor_id, {})
1433 count += 1
1434 continue
1435 authn_token = unescapeHTML(xml_text(session, 'authnToken'))
1436 requestor_info['authn_token'] = authn_token
1437 self._downloader.cache.store(self._MVPD_CACHE, requestor_id, requestor_info)
1438
1439 authz_token = requestor_info.get(guid)
1440 if authz_token and is_expired(authz_token, 'simpleTokenTTL'):
1441 authz_token = None
1442 if not authz_token:
1443 authorize = self._download_webpage(
1444 self._SERVICE_PROVIDER_TEMPLATE % 'authorize', video_id,
1445 'Retrieving Authorization Token', data=urlencode_postdata({
1446 'resource_id': resource,
1447 'requestor_id': requestor_id,
1448 'authentication_token': authn_token,
1449 'mso_id': xml_text(authn_token, 'simpleTokenMsoID'),
1450 'userMeta': '1',
1451 }), headers=mvpd_headers)
1452 if '<pendingLogout' in authorize:
1453 self._downloader.cache.store(self._MVPD_CACHE, requestor_id, {})
1454 count += 1
1455 continue
1456 authz_token = unescapeHTML(xml_text(authorize, 'authzToken'))
1457 requestor_info[guid] = authz_token
1458 self._downloader.cache.store(self._MVPD_CACHE, requestor_id, requestor_info)
1459
1460 mvpd_headers.update({
1461 'ap_19': xml_text(authn_token, 'simpleSamlNameID'),
1462 'ap_23': xml_text(authn_token, 'simpleSamlSessionIndex'),
1463 })
1464
1465 short_authorize = self._download_webpage(
1466 self._SERVICE_PROVIDER_TEMPLATE % 'shortAuthorize',
1467 video_id, 'Retrieving Media Token', data=urlencode_postdata({
1468 'authz_token': authz_token,
1469 'requestor_id': requestor_id,
1470 'session_guid': xml_text(authn_token, 'simpleTokenAuthenticationGuid'),
1471 'hashed_guid': 'false',
1472 }), headers=mvpd_headers)
1473 if '<pendingLogout' in short_authorize:
1474 self._downloader.cache.store(self._MVPD_CACHE, requestor_id, {})
1475 count += 1
1476 continue
1477 return short_authorize