adobepass.py 36 KB

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