You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1567 lines
40 KiB

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