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.

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