adobepass.py 39 KB

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