adobepass.py 52 KB

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