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