[cleanup] Make more playlist entries lazy (#11763)
[yt-dlp.git] / yt_dlp / extractor / adobepass.py
blobf1b87792713fc777949528ba82c39c77fc3da32d
1 import getpass
2 import json
3 import re
4 import time
5 import urllib.parse
6 import xml.etree.ElementTree as etree
8 from .common import InfoExtractor
9 from ..networking.exceptions import HTTPError
10 from ..utils import (
11 NO_DEFAULT,
12 ExtractorError,
13 unescapeHTML,
14 unified_timestamp,
15 urlencode_postdata,
18 MSO_INFO = {
19 'DTV': {
20 'name': 'DIRECTV',
21 'username_field': 'username',
22 'password_field': 'password',
24 'ATT': {
25 'name': 'AT&T U-verse',
26 'username_field': 'userid',
27 'password_field': 'password',
29 'ATTOTT': {
30 'name': 'DIRECTV NOW',
31 'username_field': 'email',
32 'password_field': 'loginpassword',
34 'RCN': {
35 'name': 'RCN',
36 'username_field': 'username',
37 'password_field': 'password',
39 'Rogers': {
40 'name': 'Rogers',
41 'username_field': 'UserName',
42 'password_field': 'UserPassword',
44 'Comcast_SSO': {
45 'name': 'Comcast XFINITY',
46 'username_field': 'user',
47 'password_field': 'passwd',
49 'TWC': {
50 'name': 'Time Warner Cable | Spectrum',
51 'username_field': 'Ecom_User_ID',
52 'password_field': 'Ecom_Password',
54 'Brighthouse': {
55 'name': 'Bright House Networks | Spectrum',
56 'username_field': 'j_username',
57 'password_field': 'j_password',
59 'Charter_Direct': {
60 'name': 'Charter Spectrum',
61 'username_field': 'IDToken1',
62 'password_field': 'IDToken2',
64 'Spectrum': {
65 'name': 'Spectrum',
66 'username_field': 'IDToken1',
67 'password_field': 'IDToken2',
69 'Philo': {
70 'name': 'Philo',
71 'username_field': 'ident',
73 'Verizon': {
74 'name': 'Verizon FiOS',
75 'username_field': 'IDToken1',
76 'password_field': 'IDToken2',
78 'Cablevision': {
79 'name': 'Optimum/Cablevision',
80 'username_field': 'j_username',
81 'password_field': 'j_password',
83 'thr030': {
84 'name': '3 Rivers Communications',
86 'com140': {
87 'name': 'Access Montana',
89 'acecommunications': {
90 'name': 'AcenTek',
92 'acm010': {
93 'name': 'Acme Communications',
95 'ada020': {
96 'name': 'Adams Cable Service',
98 'alb020': {
99 'name': 'Albany Mutual Telephone',
101 'algona': {
102 'name': 'Algona Municipal Utilities',
104 'allwest': {
105 'name': 'All West Communications',
107 'all025': {
108 'name': 'Allen\'s Communications',
110 'spl010': {
111 'name': 'Alliance Communications',
113 'all070': {
114 'name': 'ALLO Communications',
116 'alpine': {
117 'name': 'Alpine Communications',
119 'hun015': {
120 'name': 'American Broadband',
122 'nwc010': {
123 'name': 'American Broadband Missouri',
125 'com130-02': {
126 'name': 'American Community Networks',
128 'com130-01': {
129 'name': 'American Warrior Networks',
131 'tom020': {
132 'name': 'Amherst Telephone/Tomorrow Valley',
134 'tvc020': {
135 'name': 'Andycable',
137 'arkwest': {
138 'name': 'Arkwest Communications',
140 'art030': {
141 'name': 'Arthur Mutual Telephone Company',
143 'arvig': {
144 'name': 'Arvig',
146 'nttcash010': {
147 'name': 'Ashland Home Net',
149 'astound': {
150 'name': 'Astound (now Wave)',
152 'dix030': {
153 'name': 'ATC Broadband',
155 'ara010': {
156 'name': 'ATC Communications',
158 'she030-02': {
159 'name': 'Ayersville Communications',
161 'baldwin': {
162 'name': 'Baldwin Lightstream',
164 'bal040': {
165 'name': 'Ballard TV',
167 'cit025': {
168 'name': 'Bardstown Cable TV',
170 'bay030': {
171 'name': 'Bay Country Communications',
173 'tel095': {
174 'name': 'Beaver Creek Cooperative Telephone',
176 'bea020': {
177 'name': 'Beaver Valley Cable',
179 'bee010': {
180 'name': 'Bee Line Cable',
182 'wir030': {
183 'name': 'Beehive Broadband',
185 'bra020': {
186 'name': 'BELD',
188 'bel020': {
189 'name': 'Bellevue Municipal Cable',
191 'vol040-01': {
192 'name': 'Ben Lomand Connect / BLTV',
194 'bev010': {
195 'name': 'BEVCOMM',
197 'big020': {
198 'name': 'Big Sandy Broadband',
200 'ble020': {
201 'name': 'Bledsoe Telephone Cooperative',
203 'bvt010': {
204 'name': 'Blue Valley Tele-Communications',
206 'bra050': {
207 'name': 'Brandenburg Telephone Co.',
209 'bte010': {
210 'name': 'Bristol Tennessee Essential Services',
212 'annearundel': {
213 'name': 'Broadstripe',
215 'btc010': {
216 'name': 'BTC Communications',
218 'btc040': {
219 'name': 'BTC Vision - Nahunta',
221 'bul010': {
222 'name': 'Bulloch Telephone Cooperative',
224 'but010': {
225 'name': 'Butler-Bremer Communications',
227 'tel160-csp': {
228 'name': 'C Spire SNAP',
230 'csicable': {
231 'name': 'Cable Services Inc.',
233 'cableamerica': {
234 'name': 'CableAmerica',
236 'cab038': {
237 'name': 'CableSouth Media 3',
239 'weh010-camtel': {
240 'name': 'Cam-Tel Company',
242 'car030': {
243 'name': 'Cameron Communications',
245 'canbytel': {
246 'name': 'Canby Telcom',
248 'crt020': {
249 'name': 'CapRock Tv',
251 'car050': {
252 'name': 'Carnegie Cable',
254 'cas': {
255 'name': 'CAS Cable',
257 'casscomm': {
258 'name': 'CASSCOMM',
260 'mid180-02': {
261 'name': 'Catalina Broadband Solutions',
263 'cccomm': {
264 'name': 'CC Communications',
266 'nttccde010': {
267 'name': 'CDE Lightband',
269 'cfunet': {
270 'name': 'Cedar Falls Utilities',
272 'dem010-01': {
273 'name': 'Celect-Bloomer Telephone Area',
275 'dem010-02': {
276 'name': 'Celect-Bruce Telephone Area',
278 'dem010-03': {
279 'name': 'Celect-Citizens Connected Area',
281 'dem010-04': {
282 'name': 'Celect-Elmwood/Spring Valley Area',
284 'dem010-06': {
285 'name': 'Celect-Mosaic Telecom',
287 'dem010-05': {
288 'name': 'Celect-West WI Telephone Area',
290 'net010-02': {
291 'name': 'Cellcom/Nsight Telservices',
293 'cen100': {
294 'name': 'CentraCom',
296 'nttccst010': {
297 'name': 'Central Scott / CSTV',
299 'cha035': {
300 'name': 'Chaparral CableVision',
302 'cha050': {
303 'name': 'Chariton Valley Communication Corporation, Inc.',
305 'cha060': {
306 'name': 'Chatmoss Cablevision',
308 'nttcche010': {
309 'name': 'Cherokee Communications',
311 'che050': {
312 'name': 'Chesapeake Bay Communications',
314 'cimtel': {
315 'name': 'Cim-Tel Cable, LLC.',
317 'cit180': {
318 'name': 'Citizens Cablevision - Floyd, VA',
320 'cit210': {
321 'name': 'Citizens Cablevision, Inc.',
323 'cit040': {
324 'name': 'Citizens Fiber',
326 'cit250': {
327 'name': 'Citizens Mutual',
329 'war040': {
330 'name': 'Citizens Telephone Corporation',
332 'wat025': {
333 'name': 'City Of Monroe',
335 'wadsworth': {
336 'name': 'CityLink',
338 'nor100': {
339 'name': 'CL Tel',
341 'cla010': {
342 'name': 'Clarence Telephone and Cedar Communications',
344 'ser060': {
345 'name': 'Clear Choice Communications',
347 'tac020': {
348 'name': 'Click! Cable TV',
350 'war020': {
351 'name': 'CLICK1.NET',
353 'cml010': {
354 'name': 'CML Telephone Cooperative Association',
356 'cns': {
357 'name': 'CNS',
359 'com160': {
360 'name': 'Co-Mo Connect',
362 'coa020': {
363 'name': 'Coast Communications',
365 'coa030': {
366 'name': 'Coaxial Cable TV',
368 'mid055': {
369 'name': 'Cobalt TV (Mid-State Community TV)',
371 'col070': {
372 'name': 'Columbia Power & Water Systems',
374 'col080': {
375 'name': 'Columbus Telephone',
377 'nor105': {
378 'name': 'Communications 1 Cablevision, Inc.',
380 'com150': {
381 'name': 'Community Cable & Broadband',
383 'com020': {
384 'name': 'Community Communications Company',
386 'coy010': {
387 'name': 'commZoom',
389 'com025': {
390 'name': 'Complete Communication Services',
392 'cat020': {
393 'name': 'Comporium',
395 'com071': {
396 'name': 'ComSouth Telesys',
398 'consolidatedcable': {
399 'name': 'Consolidated',
401 'conwaycorp': {
402 'name': 'Conway Corporation',
404 'coo050': {
405 'name': 'Coon Valley Telecommunications Inc',
407 'coo080': {
408 'name': 'Cooperative Telephone Company',
410 'cpt010': {
411 'name': 'CP-TEL',
413 'cra010': {
414 'name': 'Craw-Kan Telephone',
416 'crestview': {
417 'name': 'Crestview Cable Communications',
419 'cross': {
420 'name': 'Cross TV',
422 'cro030': {
423 'name': 'Crosslake Communications',
425 'ctc040': {
426 'name': 'CTC - Brainerd MN',
428 'phe030': {
429 'name': 'CTV-Beam - East Alabama',
431 'cun010': {
432 'name': 'Cunningham Telephone & Cable',
434 'dpc010': {
435 'name': 'D & P Communications',
437 'dak030': {
438 'name': 'Dakota Central Telecommunications',
440 'nttcdel010': {
441 'name': 'Delcambre Telephone LLC',
443 'tel160-del': {
444 'name': 'Delta Telephone Company',
446 'sal040': {
447 'name': 'DiamondNet',
449 'ind060-dc': {
450 'name': 'Direct Communications',
452 'doy010': {
453 'name': 'Doylestown Cable TV',
455 'dic010': {
456 'name': 'DRN',
458 'dtc020': {
459 'name': 'DTC',
461 'dtc010': {
462 'name': 'DTC Cable (Delhi)',
464 'dum010': {
465 'name': 'Dumont Telephone Company',
467 'dun010': {
468 'name': 'Dunkerton Telephone Cooperative',
470 'cci010': {
471 'name': 'Duo County Telecom',
473 'eagle': {
474 'name': 'Eagle Communications',
476 'weh010-east': {
477 'name': 'East Arkansas Cable TV',
479 'eatel': {
480 'name': 'EATEL Video, LLC',
482 'ell010': {
483 'name': 'ECTA',
485 'emerytelcom': {
486 'name': 'Emery Telcom Video LLC',
488 'nor200': {
489 'name': 'Empire Access',
491 'endeavor': {
492 'name': 'Endeavor Communications',
494 'sun045': {
495 'name': 'Enhanced Telecommunications Corporation',
497 'mid030': {
498 'name': 'enTouch',
500 'epb020': {
501 'name': 'EPB Smartnet',
503 'jea010': {
504 'name': 'EPlus Broadband',
506 'com065': {
507 'name': 'ETC',
509 'ete010': {
510 'name': 'Etex Communications',
512 'fbc-tele': {
513 'name': 'F&B Communications',
515 'fal010': {
516 'name': 'Falcon Broadband',
518 'fam010': {
519 'name': 'FamilyView CableVision',
521 'far020': {
522 'name': 'Farmers Mutual Telephone Company',
524 'fay010': {
525 'name': 'Fayetteville Public Utilities',
527 'sal060': {
528 'name': 'fibrant',
530 'fid010': {
531 'name': 'Fidelity Communications',
533 'for030': {
534 'name': 'FJ Communications',
536 'fli020': {
537 'name': 'Flint River Communications',
539 'far030': {
540 'name': 'FMT - Jesup',
542 'foo010': {
543 'name': 'Foothills Communications',
545 'for080': {
546 'name': 'Forsyth CableNet',
548 'fbcomm': {
549 'name': 'Frankfort Plant Board',
551 'tel160-fra': {
552 'name': 'Franklin Telephone Company',
554 'nttcftc010': {
555 'name': 'FTC',
557 'fullchannel': {
558 'name': 'Full Channel, Inc.',
560 'gar040': {
561 'name': 'Gardonville Cooperative Telephone Association',
563 'gbt010': {
564 'name': 'GBT Communications, Inc.',
566 'tec010': {
567 'name': 'Genuine Telecom',
569 'clr010': {
570 'name': 'Giant Communications',
572 'gla010': {
573 'name': 'Glasgow EPB',
575 'gle010': {
576 'name': 'Glenwood Telecommunications',
578 'gra060': {
579 'name': 'GLW Broadband Inc.',
581 'goldenwest': {
582 'name': 'Golden West Cablevision',
584 'vis030': {
585 'name': 'Grantsburg Telcom',
587 'gpcom': {
588 'name': 'Great Plains Communications',
590 'gri010': {
591 'name': 'Gridley Cable Inc',
593 'hbc010': {
594 'name': 'H&B Cable Services',
596 'hae010': {
597 'name': 'Haefele TV Inc.',
599 'htc010': {
600 'name': 'Halstad Telephone Company',
602 'har005': {
603 'name': 'Harlan Municipal Utilities',
605 'har020': {
606 'name': 'Hart Communications',
608 'ced010': {
609 'name': 'Hartelco TV',
611 'hea040': {
612 'name': 'Heart of Iowa Communications Cooperative',
614 'htc020': {
615 'name': 'Hickory Telephone Company',
617 'nttchig010': {
618 'name': 'Highland Communication Services',
620 'hig030': {
621 'name': 'Highland Media',
623 'spc010': {
624 'name': 'Hilliary Communications',
626 'hin020': {
627 'name': 'Hinton CATV Co.',
629 'hometel': {
630 'name': 'HomeTel Entertainment, Inc.',
632 'hoodcanal': {
633 'name': 'Hood Canal Communications',
635 'weh010-hope': {
636 'name': 'Hope - Prescott Cable TV',
638 'horizoncable': {
639 'name': 'Horizon Cable TV, Inc.',
641 'hor040': {
642 'name': 'Horizon Chillicothe Telephone',
644 'htc030': {
645 'name': 'HTC Communications Co. - IL',
647 'htccomm': {
648 'name': 'HTC Communications, Inc. - IA',
650 'wal005': {
651 'name': 'Huxley Communications',
653 'imon': {
654 'name': 'ImOn Communications',
656 'ind040': {
657 'name': 'Independence Telecommunications',
659 'rrc010': {
660 'name': 'Inland Networks',
662 'stc020': {
663 'name': 'Innovative Cable TV St Croix',
665 'car100': {
666 'name': 'Innovative Cable TV St Thomas-St John',
668 'icc010': {
669 'name': 'Inside Connect Cable',
671 'int100': {
672 'name': 'Integra Telecom',
674 'int050': {
675 'name': 'Interstate Telecommunications Coop',
677 'irv010': {
678 'name': 'Irvine Cable',
680 'k2c010': {
681 'name': 'K2 Communications',
683 'kal010': {
684 'name': 'Kalida Telephone Company, Inc.',
686 'kal030': {
687 'name': 'Kalona Cooperative Telephone Company',
689 'kmt010': {
690 'name': 'KMTelecom',
692 'kpu010': {
693 'name': 'KPU Telecommunications',
695 'kuh010': {
696 'name': 'Kuhn Communications, Inc.',
698 'lak130': {
699 'name': 'Lakeland Communications',
701 'lan010': {
702 'name': 'Langco',
704 'lau020': {
705 'name': 'Laurel Highland Total Communications, Inc.',
707 'leh010': {
708 'name': 'Lehigh Valley Cooperative Telephone',
710 'bra010': {
711 'name': 'Limestone Cable/Bracken Cable',
713 'loc020': {
714 'name': 'LISCO',
716 'lit020': {
717 'name': 'Litestream',
719 'tel140': {
720 'name': 'LivCom',
722 'loc010': {
723 'name': 'LocalTel Communications',
725 'weh010-longview': {
726 'name': 'Longview - Kilgore Cable TV',
728 'lon030': {
729 'name': 'Lonsdale Video Ventures, LLC',
731 'lns010': {
732 'name': 'Lost Nation-Elwood Telephone Co.',
734 'nttclpc010': {
735 'name': 'LPC Connect',
737 'lumos': {
738 'name': 'Lumos Networks',
740 'madison': {
741 'name': 'Madison Communications',
743 'mad030': {
744 'name': 'Madison County Cable Inc.',
746 'nttcmah010': {
747 'name': 'Mahaska Communication Group',
749 'mar010': {
750 'name': 'Marne & Elk Horn Telephone Company',
752 'mcc040': {
753 'name': 'McClure Telephone Co.',
755 'mctv': {
756 'name': 'MCTV',
758 'merrimac': {
759 'name': 'Merrimac Communications Ltd.',
761 'metronet': {
762 'name': 'Metronet',
764 'mhtc': {
765 'name': 'MHTC',
767 'midhudson': {
768 'name': 'Mid-Hudson Cable',
770 'midrivers': {
771 'name': 'Mid-Rivers Communications',
773 'mid045': {
774 'name': 'Midstate Communications',
776 'mil080': {
777 'name': 'Milford Communications',
779 'min030': {
780 'name': 'MINET',
782 'nttcmin010': {
783 'name': 'Minford TV',
785 'san040-02': {
786 'name': 'Mitchell Telecom',
788 'mlg010': {
789 'name': 'MLGC',
791 'mon060': {
792 'name': 'Mon-Cre TVE',
794 'mou110': {
795 'name': 'Mountain Telephone',
797 'mou050': {
798 'name': 'Mountain Village Cable',
800 'mtacomm': {
801 'name': 'MTA Communications, LLC',
803 'mtc010': {
804 'name': 'MTC Cable',
806 'med040': {
807 'name': 'MTC Technologies',
809 'man060': {
810 'name': 'MTCC',
812 'mtc030': {
813 'name': 'MTCO Communications',
815 'mul050': {
816 'name': 'Mulberry Telecommunications',
818 'mur010': {
819 'name': 'Murray Electric System',
821 'musfiber': {
822 'name': 'MUS FiberNET',
824 'mpw': {
825 'name': 'Muscatine Power & Water',
827 'nttcsli010': {
828 'name': 'myEVTV.com',
830 'nor115': {
831 'name': 'NCC',
833 'nor260': {
834 'name': 'NDTC',
836 'nctc': {
837 'name': 'Nebraska Central Telecom, Inc.',
839 'nel020': {
840 'name': 'Nelsonville TV Cable',
842 'nem010': {
843 'name': 'Nemont',
845 'new075': {
846 'name': 'New Hope Telephone Cooperative',
848 'nor240': {
849 'name': 'NICP',
851 'cic010': {
852 'name': 'NineStar Connect',
854 'nktelco': {
855 'name': 'NKTelco',
857 'nortex': {
858 'name': 'Nortex Communications',
860 'nor140': {
861 'name': 'North Central Telephone Cooperative',
863 'nor030': {
864 'name': 'Northland Communications',
866 'nor075': {
867 'name': 'Northwest Communications',
869 'nor125': {
870 'name': 'Norwood Light Broadband',
872 'net010': {
873 'name': 'Nsight Telservices',
875 'dur010': {
876 'name': 'Ntec',
878 'nts010': {
879 'name': 'NTS Communications',
881 'new045': {
882 'name': 'NU-Telecom',
884 'nulink': {
885 'name': 'NuLink',
887 'jam030': {
888 'name': 'NVC',
890 'far035': {
891 'name': 'OmniTel Communications',
893 'onesource': {
894 'name': 'OneSource Communications',
896 'cit230': {
897 'name': 'Opelika Power Services',
899 'daltonutilities': {
900 'name': 'OptiLink',
902 'mid140': {
903 'name': 'OPTURA',
905 'ote010': {
906 'name': 'OTEC Communication Company',
908 'cci020': {
909 'name': 'Packerland Broadband',
911 'pan010': {
912 'name': 'Panora Telco/Guthrie Center Communications',
914 'otter': {
915 'name': 'Park Region Telephone & Otter Tail Telcom',
917 'mid050': {
918 'name': 'Partner Communications Cooperative',
920 'fib010': {
921 'name': 'Pathway',
923 'paulbunyan': {
924 'name': 'Paul Bunyan Communications',
926 'pem020': {
927 'name': 'Pembroke Telephone Company',
929 'mck010': {
930 'name': 'Peoples Rural Telephone Cooperative',
932 'pul010': {
933 'name': 'PES Energize',
935 'phi010': {
936 'name': 'Philippi Communications System',
938 'phonoscope': {
939 'name': 'Phonoscope Cable',
941 'pin070': {
942 'name': 'Pine Belt Communications, Inc.',
944 'weh010-pine': {
945 'name': 'Pine Bluff Cable TV',
947 'pin060': {
948 'name': 'Pineland Telephone Cooperative',
950 'cam010': {
951 'name': 'Pinpoint Communications',
953 'pio060': {
954 'name': 'Pioneer Broadband',
956 'pioncomm': {
957 'name': 'Pioneer Communications',
959 'pioneer': {
960 'name': 'Pioneer DTV',
962 'pla020': {
963 'name': 'Plant TiftNet, Inc.',
965 'par010': {
966 'name': 'PLWC',
968 'pro035': {
969 'name': 'PMT',
971 'vik011': {
972 'name': 'Polar Cablevision',
974 'pottawatomie': {
975 'name': 'Pottawatomie Telephone Co.',
977 'premiercomm': {
978 'name': 'Premier Communications',
980 'psc010': {
981 'name': 'PSC',
983 'pan020': {
984 'name': 'PTCI',
986 'qco010': {
987 'name': 'QCOL',
989 'qua010': {
990 'name': 'Quality Cablevision',
992 'rad010': {
993 'name': 'Radcliffe Telephone Company',
995 'car040': {
996 'name': 'Rainbow Communications',
998 'rai030': {
999 'name': 'Rainier Connect',
1001 'ral010': {
1002 'name': 'Ralls Technologies',
1004 'rct010': {
1005 'name': 'RC Technologies',
1007 'red040': {
1008 'name': 'Red River Communications',
1010 'ree010': {
1011 'name': 'Reedsburg Utility Commission',
1013 'mol010': {
1014 'name': 'Reliance Connects- Oregon',
1016 'res020': {
1017 'name': 'Reserve Telecommunications',
1019 'weh010-resort': {
1020 'name': 'Resort TV Cable',
1022 'rld010': {
1023 'name': 'Richland Grant Telephone Cooperative, Inc.',
1025 'riv030': {
1026 'name': 'River Valley Telecommunications Coop',
1028 'rockportcable': {
1029 'name': 'Rock Port Cablevision',
1031 'rsf010': {
1032 'name': 'RS Fiber',
1034 'rtc': {
1035 'name': 'RTC Communication Corp',
1037 'res040': {
1038 'name': 'RTC-Reservation Telephone Coop.',
1040 'rte010': {
1041 'name': 'RTEC Communications',
1043 'stc010': {
1044 'name': 'S&T',
1046 'san020': {
1047 'name': 'San Bruno Cable TV',
1049 'san040-01': {
1050 'name': 'Santel',
1052 'sav010': {
1053 'name': 'SCI Broadband-Savage Communications Inc.',
1055 'sco050': {
1056 'name': 'Scottsboro Electric Power Board',
1058 'scr010': {
1059 'name': 'Scranton Telephone Company',
1061 'selco': {
1062 'name': 'SELCO',
1064 'she010': {
1065 'name': 'Shentel',
1067 'she030': {
1068 'name': 'Sherwood Mutual Telephone Association, Inc.',
1070 'ind060-ssc': {
1071 'name': 'Silver Star Communications',
1073 'sjoberg': {
1074 'name': 'Sjoberg\'s Inc.',
1076 'sou025': {
1077 'name': 'SKT',
1079 'sky050': {
1080 'name': 'SkyBest TV',
1082 'nttcsmi010': {
1083 'name': 'Smithville Communications',
1085 'woo010': {
1086 'name': 'Solarus',
1088 'sou075': {
1089 'name': 'South Central Rural Telephone Cooperative',
1091 'sou065': {
1092 'name': 'South Holt Cablevision, Inc.',
1094 'sou035': {
1095 'name': 'South Slope Cooperative Communications',
1097 'spa020': {
1098 'name': 'Spanish Fork Community Network',
1100 'spe010': {
1101 'name': 'Spencer Municipal Utilities',
1103 'spi005': {
1104 'name': 'Spillway Communications, Inc.',
1106 'srt010': {
1107 'name': 'SRT',
1109 'cccsmc010': {
1110 'name': 'St. Maarten Cable TV',
1112 'sta025': {
1113 'name': 'Star Communications',
1115 'sco020': {
1116 'name': 'STE',
1118 'uin010': {
1119 'name': 'STRATA Networks',
1121 'sum010': {
1122 'name': 'Sumner Cable TV',
1124 'pie010': {
1125 'name': 'Surry TV/PCSI TV',
1127 'swa010': {
1128 'name': 'Swayzee Communications',
1130 'sweetwater': {
1131 'name': 'Sweetwater Cable Television Co',
1133 'weh010-talequah': {
1134 'name': 'Tahlequah Cable TV',
1136 'tct': {
1137 'name': 'TCT',
1139 'tel050': {
1140 'name': 'Tele-Media Company',
1142 'com050': {
1143 'name': 'The Community Agency',
1145 'thr020': {
1146 'name': 'Three River',
1148 'cab140': {
1149 'name': 'Town & Country Technologies',
1151 'tra010': {
1152 'name': 'Trans-Video',
1154 'tre010': {
1155 'name': 'Trenton TV Cable Company',
1157 'tcc': {
1158 'name': 'Tri County Communications Cooperative',
1160 'tri025': {
1161 'name': 'TriCounty Telecom',
1163 'tri110': {
1164 'name': 'TrioTel Communications, Inc.',
1166 'tro010': {
1167 'name': 'Troy Cablevision, Inc.',
1169 'tsc': {
1170 'name': 'TSC',
1172 'cit220': {
1173 'name': 'Tullahoma Utilities Board',
1175 'tvc030': {
1176 'name': 'TV Cable of Rensselaer',
1178 'tvc015': {
1179 'name': 'TVC Cable',
1181 'cab180': {
1182 'name': 'TVision',
1184 'twi040': {
1185 'name': 'Twin Lakes',
1187 'tvtinc': {
1188 'name': 'Twin Valley',
1190 'uis010': {
1191 'name': 'Union Telephone Company',
1193 'uni110': {
1194 'name': 'United Communications - TN',
1196 'uni120': {
1197 'name': 'United Services',
1199 'uss020': {
1200 'name': 'US Sonet',
1202 'cab060': {
1203 'name': 'USA Communications',
1205 'she005': {
1206 'name': 'USA Communications/Shellsburg, IA',
1208 'val040': {
1209 'name': 'Valley TeleCom Group',
1211 'val025': {
1212 'name': 'Valley Telecommunications',
1214 'val030': {
1215 'name': 'Valparaiso Broadband',
1217 'cla050': {
1218 'name': 'Vast Broadband',
1220 'sul015': {
1221 'name': 'Venture Communications Cooperative, Inc.',
1223 'ver025': {
1224 'name': 'Vernon Communications Co-op',
1226 'weh010-vicksburg': {
1227 'name': 'Vicksburg Video',
1229 'vis070': {
1230 'name': 'Vision Communications',
1232 'volcanotel': {
1233 'name': 'Volcano Vision, Inc.',
1235 'vol040-02': {
1236 'name': 'VolFirst / BLTV',
1238 'ver070': {
1239 'name': 'VTel',
1241 'nttcvtx010': {
1242 'name': 'VTX1',
1244 'bci010-02': {
1245 'name': 'Vyve Broadband',
1247 'wab020': {
1248 'name': 'Wabash Mutual Telephone',
1250 'waitsfield': {
1251 'name': 'Waitsfield Cable',
1253 'wal010': {
1254 'name': 'Walnut Communications',
1256 'wavebroadband': {
1257 'name': 'Wave',
1259 'wav030': {
1260 'name': 'Waverly Communications Utility',
1262 'wbi010': {
1263 'name': 'WBI',
1265 'web020': {
1266 'name': 'Webster-Calhoun Cooperative Telephone Association',
1268 'wes005': {
1269 'name': 'West Alabama TV Cable',
1271 'carolinata': {
1272 'name': 'West Carolina Communications',
1274 'wct010': {
1275 'name': 'West Central Telephone Association',
1277 'wes110': {
1278 'name': 'West River Cooperative Telephone Company',
1280 'ani030': {
1281 'name': 'WesTel Systems',
1283 'westianet': {
1284 'name': 'Western Iowa Networks',
1286 'nttcwhi010': {
1287 'name': 'Whidbey Telecom',
1289 'weh010-white': {
1290 'name': 'White County Cable TV',
1292 'wes130': {
1293 'name': 'Wiatel',
1295 'wik010': {
1296 'name': 'Wiktel',
1298 'wil070': {
1299 'name': 'Wilkes Communications, Inc./RiverStreet Networks',
1301 'wil015': {
1302 'name': 'Wilson Communications',
1304 'win010': {
1305 'name': 'Windomnet/SMBS',
1307 'win090': {
1308 'name': 'Windstream Cable TV',
1310 'wcta': {
1311 'name': 'Winnebago Cooperative Telecom Association',
1313 'wtc010': {
1314 'name': 'WTC',
1316 'wil040': {
1317 'name': 'WTC Communications, Inc.',
1319 'wya010': {
1320 'name': 'Wyandotte Cable',
1322 'hin020-02': {
1323 'name': 'X-Stream Services',
1325 'xit010': {
1326 'name': 'XIT Communications',
1328 'yel010': {
1329 'name': 'Yelcot Communications',
1331 'mid180-01': {
1332 'name': 'yondoo',
1334 'cou060': {
1335 'name': 'Zito Media',
1337 'slingtv': {
1338 'name': 'Sling TV',
1339 'username_field': 'username',
1340 'password_field': 'password',
1342 'Suddenlink': {
1343 'name': 'Suddenlink',
1344 'username_field': 'username',
1345 'password_field': 'password',
1347 'AlticeOne': {
1348 'name': 'Optimum TV',
1349 'username_field': 'j_username',
1350 'password_field': 'j_password',
1355 class AdobePassIE(InfoExtractor): # XXX: Conventionally, base classes should end with BaseIE/InfoExtractor
1356 _SERVICE_PROVIDER_TEMPLATE = 'https://sp.auth.adobe.com/adobe-services/%s'
1357 _USER_AGENT = 'Mozilla/5.0 (X11; Linux i686; rv:47.0) Gecko/20100101 Firefox/47.0'
1358 _MODERN_USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; rv:131.0) Gecko/20100101 Firefox/131.0'
1359 _MVPD_CACHE = 'ap-mvpd'
1361 _DOWNLOADING_LOGIN_PAGE = 'Downloading Provider Login Page'
1363 def _download_webpage_handle(self, *args, **kwargs):
1364 headers = self.geo_verification_headers()
1365 headers.update(kwargs.get('headers') or {})
1366 kwargs['headers'] = headers
1367 return super()._download_webpage_handle(
1368 *args, **kwargs)
1370 @staticmethod
1371 def _get_mvpd_resource(provider_id, title, guid, rating):
1372 channel = etree.Element('channel')
1373 channel_title = etree.SubElement(channel, 'title')
1374 channel_title.text = provider_id
1375 item = etree.SubElement(channel, 'item')
1376 resource_title = etree.SubElement(item, 'title')
1377 resource_title.text = title
1378 resource_guid = etree.SubElement(item, 'guid')
1379 resource_guid.text = guid
1380 resource_rating = etree.SubElement(item, 'media:rating')
1381 resource_rating.attrib = {'scheme': 'urn:v-chip'}
1382 resource_rating.text = rating
1383 return '<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/">' + etree.tostring(channel).decode() + '</rss>'
1385 def _extract_mvpd_auth(self, url, video_id, requestor_id, resource):
1386 def xml_text(xml_str, tag):
1387 return self._search_regex(
1388 f'<{tag}>(.+?)</{tag}>', xml_str, tag)
1390 def is_expired(token, date_ele):
1391 token_expires = unified_timestamp(re.sub(r'[_ ]GMT', '', xml_text(token, date_ele)))
1392 return token_expires and token_expires <= int(time.time())
1394 def post_form(form_page_res, note, data={}):
1395 form_page, urlh = form_page_res
1396 post_url = self._html_search_regex(r'<form[^>]+action=(["\'])(?P<url>.+?)\1', form_page, 'post url', group='url')
1397 if not re.match(r'https?://', post_url):
1398 post_url = urllib.parse.urljoin(urlh.url, post_url)
1399 form_data = self._hidden_inputs(form_page)
1400 form_data.update(data)
1401 return self._download_webpage_handle(
1402 post_url, video_id, note, data=urlencode_postdata(form_data), headers={
1403 'Content-Type': 'application/x-www-form-urlencoded',
1406 def raise_mvpd_required():
1407 raise ExtractorError(
1408 'This video is only available for users of participating TV providers. '
1409 'Use --ap-mso to specify Adobe Pass Multiple-system operator Identifier '
1410 'and --ap-username and --ap-password or --netrc to provide account credentials.', expected=True)
1412 def extract_redirect_url(html, url=None, fatal=False):
1413 # TODO: eliminate code duplication with generic extractor and move
1414 # redirection code into _download_webpage_handle
1415 REDIRECT_REGEX = r'[0-9]{,2};\s*(?:URL|url)=\'?([^\'"]+)'
1416 redirect_url = self._search_regex(
1417 r'(?i)<meta\s+(?=(?:[a-z-]+="[^"]+"\s+)*http-equiv="refresh")'
1418 rf'(?:[a-z-]+="[^"]+"\s+)*?content="{REDIRECT_REGEX}',
1419 html, 'meta refresh redirect',
1420 default=NO_DEFAULT if fatal else None, fatal=fatal)
1421 if not redirect_url:
1422 return None
1423 if url:
1424 redirect_url = urllib.parse.urljoin(url, unescapeHTML(redirect_url))
1425 return redirect_url
1427 mvpd_headers = {
1428 'ap_42': 'anonymous',
1429 'ap_11': 'Linux i686',
1430 'ap_z': self._USER_AGENT,
1431 'User-Agent': self._USER_AGENT,
1434 guid = xml_text(resource, 'guid') if '<' in resource else resource
1435 count = 0
1436 while count < 2:
1437 requestor_info = self.cache.load(self._MVPD_CACHE, requestor_id) or {}
1438 authn_token = requestor_info.get('authn_token')
1439 if authn_token and is_expired(authn_token, 'simpleTokenExpires'):
1440 authn_token = None
1441 if not authn_token:
1442 mso_id = self.get_param('ap_mso')
1443 if mso_id:
1444 username, password = self._get_login_info('ap_username', 'ap_password', mso_id)
1445 if not username or not password:
1446 raise_mvpd_required()
1447 mso_info = MSO_INFO[mso_id]
1449 provider_redirect_page_res = self._download_webpage_handle(
1450 self._SERVICE_PROVIDER_TEMPLATE % 'authenticate/saml', video_id,
1451 'Downloading Provider Redirect Page', query={
1452 'noflash': 'true',
1453 'mso_id': mso_id,
1454 'requestor_id': requestor_id,
1455 'no_iframe': 'false',
1456 'domain_name': 'adobe.com',
1457 'redirect_url': url,
1458 }, headers={
1459 # yt-dlp's default user-agent is usually too old for Comcast_SSO
1460 # See: https://github.com/yt-dlp/yt-dlp/issues/10848
1461 'User-Agent': self._MODERN_USER_AGENT,
1462 } if mso_id == 'Comcast_SSO' else None)
1463 elif not self._cookies_passed:
1464 raise_mvpd_required()
1466 if not mso_id:
1467 pass
1468 elif mso_id == 'Comcast_SSO':
1469 # Comcast page flow varies by video site and whether you
1470 # are on Comcast's network.
1471 provider_redirect_page, urlh = provider_redirect_page_res
1472 if 'automatically signing you in' in provider_redirect_page:
1473 oauth_redirect_url = self._html_search_regex(
1474 r'window\.location\s*=\s*[\'"]([^\'"]+)',
1475 provider_redirect_page, 'oauth redirect')
1476 self._download_webpage(
1477 oauth_redirect_url, video_id, 'Confirming auto login')
1478 elif 'automatically signed in with' in provider_redirect_page:
1479 # Seems like comcast is rolling up new way of automatically signing customers
1480 oauth_redirect_url = self._html_search_regex(
1481 r'continue:\s*"(https://oauth\.xfinity\.com/oauth/authorize\?.+)"', provider_redirect_page,
1482 'oauth redirect (signed)')
1483 # Just need to process the request. No useful data comes back
1484 self._download_webpage(oauth_redirect_url, video_id, 'Confirming auto login')
1485 else:
1486 if '<form name="signin"' in provider_redirect_page:
1487 provider_login_page_res = provider_redirect_page_res
1488 elif 'http-equiv="refresh"' in provider_redirect_page:
1489 oauth_redirect_url = extract_redirect_url(
1490 provider_redirect_page, fatal=True)
1491 provider_login_page_res = self._download_webpage_handle(
1492 oauth_redirect_url, video_id,
1493 self._DOWNLOADING_LOGIN_PAGE)
1494 else:
1495 provider_login_page_res = post_form(
1496 provider_redirect_page_res,
1497 self._DOWNLOADING_LOGIN_PAGE)
1499 mvpd_confirm_page_res = post_form(
1500 provider_login_page_res, 'Logging in', {
1501 mso_info['username_field']: username,
1502 mso_info['password_field']: password,
1504 mvpd_confirm_page, urlh = mvpd_confirm_page_res
1505 if '<button class="submit" value="Resume">Resume</button>' in mvpd_confirm_page:
1506 post_form(mvpd_confirm_page_res, 'Confirming Login')
1507 elif mso_id == 'Philo':
1508 # Philo has very unique authentication method
1509 self._download_webpage(
1510 'https://idp.philo.com/auth/init/login_code', video_id, 'Requesting auth code', data=urlencode_postdata({
1511 'ident': username,
1512 'device': 'web',
1513 'send_confirm_link': False,
1514 'send_token': True,
1516 philo_code = getpass.getpass('Type auth code you have received [Return]: ')
1517 self._download_webpage(
1518 'https://idp.philo.com/auth/update/login_code', video_id, 'Submitting token', data=urlencode_postdata({
1519 'token': philo_code,
1521 mvpd_confirm_page_res = self._download_webpage_handle('https://idp.philo.com/idp/submit', video_id, 'Confirming Philo Login')
1522 post_form(mvpd_confirm_page_res, 'Confirming Login')
1523 elif mso_id == 'Verizon':
1524 # In general, if you're connecting from a Verizon-assigned IP,
1525 # you will not actually pass your credentials.
1526 provider_redirect_page, urlh = provider_redirect_page_res
1527 # From non-Verizon IP, still gave 'Please wait', but noticed N==Y; will need to try on Verizon IP
1528 if 'Please wait ...' in provider_redirect_page and '\'N\'== "Y"' not in provider_redirect_page:
1529 saml_redirect_url = self._html_search_regex(
1530 r'self\.parent\.location=(["\'])(?P<url>.+?)\1',
1531 provider_redirect_page,
1532 'SAML Redirect URL', group='url')
1533 saml_login_page = self._download_webpage(
1534 saml_redirect_url, video_id,
1535 'Downloading SAML Login Page')
1536 elif 'Verizon FiOS - sign in' in provider_redirect_page:
1537 # FXNetworks from non-Verizon IP
1538 saml_login_page_res = post_form(
1539 provider_redirect_page_res, 'Logging in', {
1540 mso_info['username_field']: username,
1541 mso_info['password_field']: password,
1543 saml_login_page, urlh = saml_login_page_res
1544 if 'Please try again.' in saml_login_page:
1545 raise ExtractorError(
1546 'We\'re sorry, but either the User ID or Password entered is not correct.')
1547 else:
1548 # ABC from non-Verizon IP
1549 saml_redirect_url = self._html_search_regex(
1550 r'var\surl\s*=\s*(["\'])(?P<url>.+?)\1',
1551 provider_redirect_page,
1552 'SAML Redirect URL', group='url')
1553 saml_redirect_url = saml_redirect_url.replace(r'\/', '/')
1554 saml_redirect_url = saml_redirect_url.replace(r'\-', '-')
1555 saml_redirect_url = saml_redirect_url.replace(r'\x26', '&')
1556 saml_login_page = self._download_webpage(
1557 saml_redirect_url, video_id,
1558 'Downloading SAML Login Page')
1559 saml_login_page, urlh = post_form(
1560 [saml_login_page, saml_redirect_url], 'Logging in', {
1561 mso_info['username_field']: username,
1562 mso_info['password_field']: password,
1564 if 'Please try again.' in saml_login_page:
1565 raise ExtractorError(
1566 'Failed to login, incorrect User ID or Password.')
1567 saml_login_url = self._search_regex(
1568 r'xmlHttp\.open\("POST"\s*,\s*(["\'])(?P<url>.+?)\1',
1569 saml_login_page, 'SAML Login URL', group='url')
1570 saml_response_json = self._download_json(
1571 saml_login_url, video_id, 'Downloading SAML Response',
1572 headers={'Content-Type': 'text/xml'})
1573 self._download_webpage(
1574 saml_response_json['targetValue'], video_id,
1575 'Confirming Login', data=urlencode_postdata({
1576 'SAMLResponse': saml_response_json['SAMLResponse'],
1577 'RelayState': saml_response_json['RelayState'],
1578 }), headers={
1579 'Content-Type': 'application/x-www-form-urlencoded',
1581 elif mso_id in ('Spectrum', 'Charter_Direct'):
1582 # Spectrum's login for is dynamically loaded via JS so we need to hardcode the flow
1583 # as a one-off implementation.
1584 provider_redirect_page, urlh = provider_redirect_page_res
1585 provider_login_page_res = post_form(
1586 provider_redirect_page_res, self._DOWNLOADING_LOGIN_PAGE)
1587 saml_login_page, urlh = provider_login_page_res
1588 relay_state = self._search_regex(
1589 r'RelayState\s*=\s*"(?P<relay>.+?)";',
1590 saml_login_page, 'RelayState', group='relay')
1591 saml_request = self._search_regex(
1592 r'SAMLRequest\s*=\s*"(?P<saml_request>.+?)";',
1593 saml_login_page, 'SAMLRequest', group='saml_request')
1594 login_json = {
1595 mso_info['username_field']: username,
1596 mso_info['password_field']: password,
1597 'RelayState': relay_state,
1598 'SAMLRequest': saml_request,
1600 saml_response_json = self._download_json(
1601 'https://tveauthn.spectrum.net/tveauthentication/api/v1/manualAuth', video_id,
1602 'Downloading SAML Response',
1603 data=json.dumps(login_json).encode(),
1604 headers={
1605 'Content-Type': 'application/json',
1606 'Accept': 'application/json',
1608 self._download_webpage(
1609 saml_response_json['SAMLRedirectUri'], video_id,
1610 'Confirming Login', data=urlencode_postdata({
1611 'SAMLResponse': saml_response_json['SAMLResponse'],
1612 'RelayState': relay_state,
1613 }), headers={
1614 'Content-Type': 'application/x-www-form-urlencoded',
1616 elif mso_id == 'slingtv':
1617 # SlingTV has a meta-refresh based authentication, but also
1618 # looks at the tab history to count the number of times the
1619 # browser has been on a page
1621 first_bookend_page, urlh = provider_redirect_page_res
1623 hidden_data = self._hidden_inputs(first_bookend_page)
1624 hidden_data['history'] = 1
1626 provider_login_page_res = self._download_webpage_handle(
1627 urlh.url, video_id, 'Sending first bookend',
1628 query=hidden_data)
1630 provider_association_redirect, urlh = post_form(
1631 provider_login_page_res, 'Logging in', {
1632 mso_info['username_field']: username,
1633 mso_info['password_field']: password,
1636 provider_refresh_redirect_url = extract_redirect_url(
1637 provider_association_redirect, url=urlh.url)
1639 last_bookend_page, urlh = self._download_webpage_handle(
1640 provider_refresh_redirect_url, video_id,
1641 'Downloading Auth Association Redirect Page')
1642 hidden_data = self._hidden_inputs(last_bookend_page)
1643 hidden_data['history'] = 3
1645 mvpd_confirm_page_res = self._download_webpage_handle(
1646 urlh.url, video_id, 'Sending final bookend',
1647 query=hidden_data)
1649 post_form(mvpd_confirm_page_res, 'Confirming Login')
1650 elif mso_id == 'Suddenlink':
1651 # Suddenlink is similar to SlingTV in using a tab history count and a meta refresh,
1652 # but they also do a dynmaic redirect using javascript that has to be followed as well
1653 first_bookend_page, urlh = post_form(
1654 provider_redirect_page_res, 'Pressing Continue...')
1656 hidden_data = self._hidden_inputs(first_bookend_page)
1657 hidden_data['history_val'] = 1
1659 provider_login_redirect_page_res = self._download_webpage_handle(
1660 urlh.url, video_id, 'Sending First Bookend',
1661 query=hidden_data)
1663 provider_login_redirect_page, urlh = provider_login_redirect_page_res
1665 # Some website partners seem to not have the extra ajaxurl redirect step, so we check if we already
1666 # have the login prompt or not
1667 if 'id="password" type="password" name="password"' in provider_login_redirect_page:
1668 provider_login_page_res = provider_login_redirect_page_res
1669 else:
1670 provider_tryauth_url = self._html_search_regex(
1671 r'url:\s*[\'"]([^\'"]+)', provider_login_redirect_page, 'ajaxurl')
1672 provider_tryauth_page = self._download_webpage(
1673 provider_tryauth_url, video_id, 'Submitting TryAuth',
1674 query=hidden_data)
1676 provider_login_page_res = self._download_webpage_handle(
1677 f'https://authorize.suddenlink.net/saml/module.php/authSynacor/login.php?AuthState={provider_tryauth_page}',
1678 video_id, 'Getting Login Page',
1679 query=hidden_data)
1681 provider_association_redirect, urlh = post_form(
1682 provider_login_page_res, 'Logging in', {
1683 mso_info['username_field']: username,
1684 mso_info['password_field']: password,
1687 provider_refresh_redirect_url = extract_redirect_url(
1688 provider_association_redirect, url=urlh.url)
1690 last_bookend_page, urlh = self._download_webpage_handle(
1691 provider_refresh_redirect_url, video_id,
1692 'Downloading Auth Association Redirect Page')
1694 hidden_data = self._hidden_inputs(last_bookend_page)
1695 hidden_data['history_val'] = 3
1697 mvpd_confirm_page_res = self._download_webpage_handle(
1698 urlh.url, video_id, 'Sending Final Bookend',
1699 query=hidden_data)
1701 post_form(mvpd_confirm_page_res, 'Confirming Login')
1702 else:
1703 # Some providers (e.g. DIRECTV NOW) have another meta refresh
1704 # based redirect that should be followed.
1705 provider_redirect_page, urlh = provider_redirect_page_res
1706 provider_refresh_redirect_url = extract_redirect_url(
1707 provider_redirect_page, url=urlh.url)
1708 if provider_refresh_redirect_url:
1709 provider_redirect_page_res = self._download_webpage_handle(
1710 provider_refresh_redirect_url, video_id,
1711 'Downloading Provider Redirect Page (meta refresh)')
1712 provider_login_page_res = post_form(
1713 provider_redirect_page_res, self._DOWNLOADING_LOGIN_PAGE)
1714 form_data = {
1715 mso_info.get('username_field', 'username'): username,
1716 mso_info.get('password_field', 'password'): password,
1718 if mso_id in ('Cablevision', 'AlticeOne'):
1719 form_data['_eventId_proceed'] = ''
1720 mvpd_confirm_page_res = post_form(provider_login_page_res, 'Logging in', form_data)
1721 if mso_id != 'Rogers':
1722 post_form(mvpd_confirm_page_res, 'Confirming Login')
1724 try:
1725 session = self._download_webpage(
1726 self._SERVICE_PROVIDER_TEMPLATE % 'session', video_id,
1727 'Retrieving Session', data=urlencode_postdata({
1728 '_method': 'GET',
1729 'requestor_id': requestor_id,
1730 }), headers=mvpd_headers)
1731 except ExtractorError as e:
1732 if not mso_id and isinstance(e.cause, HTTPError) and e.cause.status == 401:
1733 raise_mvpd_required()
1734 raise
1735 if '<pendingLogout' in session:
1736 self.cache.store(self._MVPD_CACHE, requestor_id, {})
1737 count += 1
1738 continue
1739 authn_token = unescapeHTML(xml_text(session, 'authnToken'))
1740 requestor_info['authn_token'] = authn_token
1741 self.cache.store(self._MVPD_CACHE, requestor_id, requestor_info)
1743 authz_token = requestor_info.get(guid)
1744 if authz_token and is_expired(authz_token, 'simpleTokenTTL'):
1745 authz_token = None
1746 if not authz_token:
1747 authorize = self._download_webpage(
1748 self._SERVICE_PROVIDER_TEMPLATE % 'authorize', video_id,
1749 'Retrieving Authorization Token', data=urlencode_postdata({
1750 'resource_id': resource,
1751 'requestor_id': requestor_id,
1752 'authentication_token': authn_token,
1753 'mso_id': xml_text(authn_token, 'simpleTokenMsoID'),
1754 'userMeta': '1',
1755 }), headers=mvpd_headers)
1756 if '<pendingLogout' in authorize:
1757 self.cache.store(self._MVPD_CACHE, requestor_id, {})
1758 count += 1
1759 continue
1760 if '<error' in authorize:
1761 raise ExtractorError(xml_text(authorize, 'details'), expected=True)
1762 authz_token = unescapeHTML(xml_text(authorize, 'authzToken'))
1763 requestor_info[guid] = authz_token
1764 self.cache.store(self._MVPD_CACHE, requestor_id, requestor_info)
1766 mvpd_headers.update({
1767 'ap_19': xml_text(authn_token, 'simpleSamlNameID'),
1768 'ap_23': xml_text(authn_token, 'simpleSamlSessionIndex'),
1771 short_authorize = self._download_webpage(
1772 self._SERVICE_PROVIDER_TEMPLATE % 'shortAuthorize',
1773 video_id, 'Retrieving Media Token', data=urlencode_postdata({
1774 'authz_token': authz_token,
1775 'requestor_id': requestor_id,
1776 'session_guid': xml_text(authn_token, 'simpleTokenAuthenticationGuid'),
1777 'hashed_guid': 'false',
1778 }), headers=mvpd_headers)
1779 if '<pendingLogout' in short_authorize:
1780 self.cache.store(self._MVPD_CACHE, requestor_id, {})
1781 count += 1
1782 continue
1783 return short_authorize