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