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