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