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.

1705 lines
68 KiB

10 years ago
11 years ago
11 years ago
11 years ago
10 years ago
10 years ago
  1. # encoding: utf-8
  2. from __future__ import unicode_literals
  3. import os
  4. import re
  5. from .common import InfoExtractor
  6. from .youtube import YoutubeIE
  7. from ..compat import (
  8. compat_urllib_parse,
  9. compat_urllib_parse_unquote,
  10. compat_urllib_request,
  11. compat_urlparse,
  12. compat_xml_parse_error,
  13. )
  14. from ..utils import (
  15. determine_ext,
  16. ExtractorError,
  17. float_or_none,
  18. HEADRequest,
  19. is_html,
  20. orderedSet,
  21. parse_xml,
  22. smuggle_url,
  23. unescapeHTML,
  24. unified_strdate,
  25. unsmuggle_url,
  26. UnsupportedError,
  27. url_basename,
  28. xpath_text,
  29. )
  30. from .brightcove import BrightcoveIE
  31. from .nbc import NBCSportsVPlayerIE
  32. from .ooyala import OoyalaIE
  33. from .rutv import RUTVIE
  34. from .tvc import TVCIE
  35. from .sportbox import SportBoxEmbedIE
  36. from .smotri import SmotriIE
  37. from .condenast import CondeNastIE
  38. from .udn import UDNEmbedIE
  39. from .senateisvp import SenateISVPIE
  40. from .bliptv import BlipTVIE
  41. from .svt import SVTIE
  42. from .pornhub import PornHubIE
  43. from .xhamster import XHamsterEmbedIE
  44. from .vimeo import VimeoIE
  45. from .dailymotion import DailymotionCloudIE
  46. from .onionstudios import OnionStudiosIE
  47. from .snagfilms import SnagFilmsEmbedIE
  48. class GenericIE(InfoExtractor):
  49. IE_DESC = 'Generic downloader that works on some sites'
  50. _VALID_URL = r'.*'
  51. IE_NAME = 'generic'
  52. _TESTS = [
  53. # Direct link to a video
  54. {
  55. 'url': 'http://media.w3.org/2010/05/sintel/trailer.mp4',
  56. 'md5': '67d406c2bcb6af27fa886f31aa934bbe',
  57. 'info_dict': {
  58. 'id': 'trailer',
  59. 'ext': 'mp4',
  60. 'title': 'trailer',
  61. 'upload_date': '20100513',
  62. }
  63. },
  64. # Direct link to media delivered compressed (until Accept-Encoding is *)
  65. {
  66. 'url': 'http://calimero.tk/muzik/FictionJunction-Parallel_Hearts.flac',
  67. 'md5': '128c42e68b13950268b648275386fc74',
  68. 'info_dict': {
  69. 'id': 'FictionJunction-Parallel_Hearts',
  70. 'ext': 'flac',
  71. 'title': 'FictionJunction-Parallel_Hearts',
  72. 'upload_date': '20140522',
  73. },
  74. 'expected_warnings': [
  75. 'URL could be a direct video link, returning it as such.'
  76. ]
  77. },
  78. # Direct download with broken HEAD
  79. {
  80. 'url': 'http://ai-radio.org:8000/radio.opus',
  81. 'info_dict': {
  82. 'id': 'radio',
  83. 'ext': 'opus',
  84. 'title': 'radio',
  85. },
  86. 'params': {
  87. 'skip_download': True, # infinite live stream
  88. },
  89. 'expected_warnings': [
  90. r'501.*Not Implemented'
  91. ],
  92. },
  93. # Direct link with incorrect MIME type
  94. {
  95. 'url': 'http://ftp.nluug.nl/video/nluug/2014-11-20_nj14/zaal-2/5_Lennart_Poettering_-_Systemd.webm',
  96. 'md5': '4ccbebe5f36706d85221f204d7eb5913',
  97. 'info_dict': {
  98. 'url': 'http://ftp.nluug.nl/video/nluug/2014-11-20_nj14/zaal-2/5_Lennart_Poettering_-_Systemd.webm',
  99. 'id': '5_Lennart_Poettering_-_Systemd',
  100. 'ext': 'webm',
  101. 'title': '5_Lennart_Poettering_-_Systemd',
  102. 'upload_date': '20141120',
  103. },
  104. 'expected_warnings': [
  105. 'URL could be a direct video link, returning it as such.'
  106. ]
  107. },
  108. # RSS feed
  109. {
  110. 'url': 'http://phihag.de/2014/youtube-dl/rss2.xml',
  111. 'info_dict': {
  112. 'id': 'http://phihag.de/2014/youtube-dl/rss2.xml',
  113. 'title': 'Zero Punctuation',
  114. 'description': 're:.*groundbreaking video review series.*'
  115. },
  116. 'playlist_mincount': 11,
  117. },
  118. # RSS feed with enclosure
  119. {
  120. 'url': 'http://podcastfeeds.nbcnews.com/audio/podcast/MSNBC-MADDOW-NETCAST-M4V.xml',
  121. 'info_dict': {
  122. 'id': 'pdv_maddow_netcast_m4v-02-27-2015-201624',
  123. 'ext': 'm4v',
  124. 'upload_date': '20150228',
  125. 'title': 'pdv_maddow_netcast_m4v-02-27-2015-201624',
  126. }
  127. },
  128. # google redirect
  129. {
  130. 'url': 'http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CCUQtwIwAA&url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DcmQHVoWB5FY&ei=F-sNU-LLCaXk4QT52ICQBQ&usg=AFQjCNEw4hL29zgOohLXvpJ-Bdh2bils1Q&bvm=bv.61965928,d.bGE',
  131. 'info_dict': {
  132. 'id': 'cmQHVoWB5FY',
  133. 'ext': 'mp4',
  134. 'upload_date': '20130224',
  135. 'uploader_id': 'TheVerge',
  136. 'description': 're:^Chris Ziegler takes a look at the\.*',
  137. 'uploader': 'The Verge',
  138. 'title': 'First Firefox OS phones side-by-side',
  139. },
  140. 'params': {
  141. 'skip_download': False,
  142. }
  143. },
  144. {
  145. 'url': 'http://www.hodiho.fr/2013/02/regis-plante-sa-jeep.html',
  146. 'md5': '85b90ccc9d73b4acd9138d3af4c27f89',
  147. 'info_dict': {
  148. 'id': '13601338388002',
  149. 'ext': 'mp4',
  150. 'uploader': 'www.hodiho.fr',
  151. 'title': 'R\u00e9gis plante sa Jeep',
  152. }
  153. },
  154. # bandcamp page with custom domain
  155. {
  156. 'add_ie': ['Bandcamp'],
  157. 'url': 'http://bronyrock.com/track/the-pony-mash',
  158. 'info_dict': {
  159. 'id': '3235767654',
  160. 'ext': 'mp3',
  161. 'title': 'The Pony Mash',
  162. 'uploader': 'M_Pallante',
  163. },
  164. 'skip': 'There is a limit of 200 free downloads / month for the test song',
  165. },
  166. # embedded brightcove video
  167. # it also tests brightcove videos that need to set the 'Referer' in the
  168. # http requests
  169. {
  170. 'add_ie': ['Brightcove'],
  171. 'url': 'http://www.bfmtv.com/video/bfmbusiness/cours-bourse/cours-bourse-l-analyse-technique-154522/',
  172. 'info_dict': {
  173. 'id': '2765128793001',
  174. 'ext': 'mp4',
  175. 'title': 'Le cours de bourse : l’analyse technique',
  176. 'description': 'md5:7e9ad046e968cb2d1114004aba466fd9',
  177. 'uploader': 'BFM BUSINESS',
  178. },
  179. 'params': {
  180. 'skip_download': True,
  181. },
  182. },
  183. {
  184. # https://github.com/rg3/youtube-dl/issues/2253
  185. 'url': 'http://bcove.me/i6nfkrc3',
  186. 'md5': '0ba9446db037002366bab3b3eb30c88c',
  187. 'info_dict': {
  188. 'id': '3101154703001',
  189. 'ext': 'mp4',
  190. 'title': 'Still no power',
  191. 'uploader': 'thestar.com',
  192. 'description': 'Mississauga resident David Farmer is still out of power as a result of the ice storm a month ago. To keep the house warm, Farmer cuts wood from his property for a wood burning stove downstairs.',
  193. },
  194. 'add_ie': ['Brightcove'],
  195. },
  196. {
  197. 'url': 'http://www.championat.com/video/football/v/87/87499.html',
  198. 'md5': 'fb973ecf6e4a78a67453647444222983',
  199. 'info_dict': {
  200. 'id': '3414141473001',
  201. 'ext': 'mp4',
  202. 'title': 'Видео. Удаление Дзагоева (ЦСКА)',
  203. 'description': 'Онлайн-трансляция матча ЦСКА - "Волга"',
  204. 'uploader': 'Championat',
  205. },
  206. },
  207. {
  208. # https://github.com/rg3/youtube-dl/issues/3541
  209. 'add_ie': ['Brightcove'],
  210. 'url': 'http://www.kijk.nl/sbs6/leermijvrouwenkennen/videos/jqMiXKAYan2S/aflevering-1',
  211. 'info_dict': {
  212. 'id': '3866516442001',
  213. 'ext': 'mp4',
  214. 'title': 'Leer mij vrouwen kennen: Aflevering 1',
  215. 'description': 'Leer mij vrouwen kennen: Aflevering 1',
  216. 'uploader': 'SBS Broadcasting',
  217. },
  218. 'skip': 'Restricted to Netherlands',
  219. 'params': {
  220. 'skip_download': True, # m3u8 download
  221. },
  222. },
  223. # ooyala video
  224. {
  225. 'url': 'http://www.rollingstone.com/music/videos/norwegian-dj-cashmere-cat-goes-spartan-on-with-me-premiere-20131219',
  226. 'md5': '166dd577b433b4d4ebfee10b0824d8ff',
  227. 'info_dict': {
  228. 'id': 'BwY2RxaTrTkslxOfcan0UCf0YqyvWysJ',
  229. 'ext': 'mp4',
  230. 'title': '2cc213299525360.mov', # that's what we get
  231. },
  232. 'add_ie': ['Ooyala'],
  233. },
  234. # multiple ooyala embeds on SBN network websites
  235. {
  236. 'url': 'http://www.sbnation.com/college-football-recruiting/2015/2/3/7970291/national-signing-day-rationalizations-itll-be-ok-itll-be-ok',
  237. 'info_dict': {
  238. 'id': 'national-signing-day-rationalizations-itll-be-ok-itll-be-ok',
  239. 'title': '25 lies you will tell yourself on National Signing Day - SBNation.com',
  240. },
  241. 'playlist_mincount': 3,
  242. 'params': {
  243. 'skip_download': True,
  244. },
  245. 'add_ie': ['Ooyala'],
  246. },
  247. # embed.ly video
  248. {
  249. 'url': 'http://www.tested.com/science/weird/460206-tested-grinding-coffee-2000-frames-second/',
  250. 'info_dict': {
  251. 'id': '9ODmcdjQcHQ',
  252. 'ext': 'mp4',
  253. 'title': 'Tested: Grinding Coffee at 2000 Frames Per Second',
  254. 'upload_date': '20140225',
  255. 'description': 'md5:06a40fbf30b220468f1e0957c0f558ff',
  256. 'uploader': 'Tested',
  257. 'uploader_id': 'testedcom',
  258. },
  259. # No need to test YoutubeIE here
  260. 'params': {
  261. 'skip_download': True,
  262. },
  263. },
  264. # funnyordie embed
  265. {
  266. 'url': 'http://www.theguardian.com/world/2014/mar/11/obama-zach-galifianakis-between-two-ferns',
  267. 'info_dict': {
  268. 'id': '18e820ec3f',
  269. 'ext': 'mp4',
  270. 'title': 'Between Two Ferns with Zach Galifianakis: President Barack Obama',
  271. 'description': 'Episode 18: President Barack Obama sits down with Zach Galifianakis for his most memorable interview yet.',
  272. },
  273. },
  274. # BBC iPlayer embeds
  275. {
  276. 'url': 'http://www.bbc.co.uk/blogs/adamcurtis/posts/BUGGER',
  277. 'info_dict': {
  278. 'title': 'BBC - Blogs - Adam Curtis - BUGGER',
  279. },
  280. 'playlist_mincount': 18,
  281. },
  282. # RUTV embed
  283. {
  284. 'url': 'http://www.rg.ru/2014/03/15/reg-dfo/anklav-anons.html',
  285. 'info_dict': {
  286. 'id': '776940',
  287. 'ext': 'mp4',
  288. 'title': 'Охотское море стало целиком российским',
  289. 'description': 'md5:5ed62483b14663e2a95ebbe115eb8f43',
  290. },
  291. 'params': {
  292. # m3u8 download
  293. 'skip_download': True,
  294. },
  295. },
  296. # TVC embed
  297. {
  298. 'url': 'http://sch1298sz.mskobr.ru/dou_edu/karamel_ki/filial_galleries/video/iframe_src_http_tvc_ru_video_iframe_id_55304_isplay_false_acc_video_id_channel_brand_id_11_show_episodes_episode_id_32307_frameb/',
  299. 'info_dict': {
  300. 'id': '55304',
  301. 'ext': 'mp4',
  302. 'title': 'Дошкольное воспитание',
  303. },
  304. },
  305. # SportBox embed
  306. {
  307. 'url': 'http://www.vestifinance.ru/articles/25753',
  308. 'info_dict': {
  309. 'id': '25753',
  310. 'title': 'Вести Экономика ― Прямые трансляции с Форума-выставки "Госзаказ-2013"',
  311. },
  312. 'playlist': [{
  313. 'info_dict': {
  314. 'id': '370908',
  315. 'title': 'Госзаказ. День 3',
  316. 'ext': 'mp4',
  317. }
  318. }, {
  319. 'info_dict': {
  320. 'id': '370905',
  321. 'title': 'Госзаказ. День 2',
  322. 'ext': 'mp4',
  323. }
  324. }, {
  325. 'info_dict': {
  326. 'id': '370902',
  327. 'title': 'Госзаказ. День 1',
  328. 'ext': 'mp4',
  329. }
  330. }],
  331. 'params': {
  332. # m3u8 download
  333. 'skip_download': True,
  334. },
  335. },
  336. # XHamster embed
  337. {
  338. 'url': 'http://www.numisc.com/forum/showthread.php?11696-FM15-which-pumiscer-was-this-%28-vid-%29-%28-alfa-as-fuck-srx-%29&s=711f5db534502e22260dec8c5e2d66d8',
  339. 'info_dict': {
  340. 'id': 'showthread',
  341. 'title': '[NSFL] [FM15] which pumiscer was this ( vid ) ( alfa as fuck srx )',
  342. },
  343. 'playlist_mincount': 7,
  344. },
  345. # Embedded TED video
  346. {
  347. 'url': 'http://en.support.wordpress.com/videos/ted-talks/',
  348. 'md5': '65fdff94098e4a607385a60c5177c638',
  349. 'info_dict': {
  350. 'id': '1969',
  351. 'ext': 'mp4',
  352. 'title': 'Hidden miracles of the natural world',
  353. 'uploader': 'Louie Schwartzberg',
  354. 'description': 'md5:8145d19d320ff3e52f28401f4c4283b9',
  355. }
  356. },
  357. # Embeded Ustream video
  358. {
  359. 'url': 'http://www.american.edu/spa/pti/nsa-privacy-janus-2014.cfm',
  360. 'md5': '27b99cdb639c9b12a79bca876a073417',
  361. 'info_dict': {
  362. 'id': '45734260',
  363. 'ext': 'flv',
  364. 'uploader': 'AU SPA: The NSA and Privacy',
  365. 'title': 'NSA and Privacy Forum Debate featuring General Hayden and Barton Gellman'
  366. }
  367. },
  368. # nowvideo embed hidden behind percent encoding
  369. {
  370. 'url': 'http://www.waoanime.tv/the-super-dimension-fortress-macross-episode-1/',
  371. 'md5': '2baf4ddd70f697d94b1c18cf796d5107',
  372. 'info_dict': {
  373. 'id': '06e53103ca9aa',
  374. 'ext': 'flv',
  375. 'title': 'Macross Episode 001 Watch Macross Episode 001 onl',
  376. 'description': 'No description',
  377. },
  378. },
  379. # arte embed
  380. {
  381. 'url': 'http://www.tv-replay.fr/redirection/20-03-14/x-enius-arte-10753389.html',
  382. 'md5': '7653032cbb25bf6c80d80f217055fa43',
  383. 'info_dict': {
  384. 'id': '048195-004_PLUS7-F',
  385. 'ext': 'flv',
  386. 'title': 'X:enius',
  387. 'description': 'md5:d5fdf32ef6613cdbfd516ae658abf168',
  388. 'upload_date': '20140320',
  389. },
  390. 'params': {
  391. 'skip_download': 'Requires rtmpdump'
  392. }
  393. },
  394. # Condé Nast embed
  395. {
  396. 'url': 'http://www.wired.com/2014/04/honda-asimo/',
  397. 'md5': 'ba0dfe966fa007657bd1443ee672db0f',
  398. 'info_dict': {
  399. 'id': '53501be369702d3275860000',
  400. 'ext': 'mp4',
  401. 'title': 'Honda’s New Asimo Robot Is More Human Than Ever',
  402. }
  403. },
  404. # Dailymotion embed
  405. {
  406. 'url': 'http://www.spi0n.com/zap-spi0n-com-n216/',
  407. 'md5': '441aeeb82eb72c422c7f14ec533999cd',
  408. 'info_dict': {
  409. 'id': 'k2mm4bCdJ6CQ2i7c8o2',
  410. 'ext': 'mp4',
  411. 'title': 'Le Zap de Spi0n n°216 - Zapping du Web',
  412. 'uploader': 'Spi0n',
  413. },
  414. 'add_ie': ['Dailymotion'],
  415. },
  416. # YouTube embed
  417. {
  418. 'url': 'http://www.badzine.de/ansicht/datum/2014/06/09/so-funktioniert-die-neue-englische-badminton-liga.html',
  419. 'info_dict': {
  420. 'id': 'FXRb4ykk4S0',
  421. 'ext': 'mp4',
  422. 'title': 'The NBL Auction 2014',
  423. 'uploader': 'BADMINTON England',
  424. 'uploader_id': 'BADMINTONEvents',
  425. 'upload_date': '20140603',
  426. 'description': 'md5:9ef128a69f1e262a700ed83edb163a73',
  427. },
  428. 'add_ie': ['Youtube'],
  429. 'params': {
  430. 'skip_download': True,
  431. }
  432. },
  433. # MTVSercices embed
  434. {
  435. 'url': 'http://www.gametrailers.com/news-post/76093/north-america-europe-is-getting-that-mario-kart-8-mercedes-dlc-too',
  436. 'md5': '35727f82f58c76d996fc188f9755b0d5',
  437. 'info_dict': {
  438. 'id': '0306a69b-8adf-4fb5-aace-75f8e8cbfca9',
  439. 'ext': 'mp4',
  440. 'title': 'Review',
  441. 'description': 'Mario\'s life in the fast lane has never looked so good.',
  442. },
  443. },
  444. # YouTube embed via <data-embed-url="">
  445. {
  446. 'url': 'https://play.google.com/store/apps/details?id=com.gameloft.android.ANMP.GloftA8HM',
  447. 'info_dict': {
  448. 'id': '4vAffPZIT44',
  449. 'ext': 'mp4',
  450. 'title': 'Asphalt 8: Airborne - Update - Welcome to Dubai!',
  451. 'uploader': 'Gameloft',
  452. 'uploader_id': 'gameloft',
  453. 'upload_date': '20140828',
  454. 'description': 'md5:c80da9ed3d83ae6d1876c834de03e1c4',
  455. },
  456. 'params': {
  457. 'skip_download': True,
  458. }
  459. },
  460. # Camtasia studio
  461. {
  462. 'url': 'http://www.ll.mit.edu/workshops/education/videocourses/antennas/lecture1/video/',
  463. 'playlist': [{
  464. 'md5': '0c5e352edabf715d762b0ad4e6d9ee67',
  465. 'info_dict': {
  466. 'id': 'Fenn-AA_PA_Radar_Course_Lecture_1c_Final',
  467. 'title': 'Fenn-AA_PA_Radar_Course_Lecture_1c_Final - video1',
  468. 'ext': 'flv',
  469. 'duration': 2235.90,
  470. }
  471. }, {
  472. 'md5': '10e4bb3aaca9fd630e273ff92d9f3c63',
  473. 'info_dict': {
  474. 'id': 'Fenn-AA_PA_Radar_Course_Lecture_1c_Final_PIP',
  475. 'title': 'Fenn-AA_PA_Radar_Course_Lecture_1c_Final - pip',
  476. 'ext': 'flv',
  477. 'duration': 2235.93,
  478. }
  479. }],
  480. 'info_dict': {
  481. 'title': 'Fenn-AA_PA_Radar_Course_Lecture_1c_Final',
  482. }
  483. },
  484. # Flowplayer
  485. {
  486. 'url': 'http://www.handjobhub.com/video/busty-blonde-siri-tit-fuck-while-wank-6313.html',
  487. 'md5': '9d65602bf31c6e20014319c7d07fba27',
  488. 'info_dict': {
  489. 'id': '5123ea6d5e5a7',
  490. 'ext': 'mp4',
  491. 'age_limit': 18,
  492. 'uploader': 'www.handjobhub.com',
  493. 'title': 'Busty Blonde Siri Tit Fuck While Wank at HandjobHub.com',
  494. }
  495. },
  496. # Multiple brightcove videos
  497. # https://github.com/rg3/youtube-dl/issues/2283
  498. {
  499. 'url': 'http://www.newyorker.com/online/blogs/newsdesk/2014/01/always-never-nuclear-command-and-control.html',
  500. 'info_dict': {
  501. 'id': 'always-never',
  502. 'title': 'Always / Never - The New Yorker',
  503. },
  504. 'playlist_count': 3,
  505. 'params': {
  506. 'extract_flat': False,
  507. 'skip_download': True,
  508. }
  509. },
  510. # MLB embed
  511. {
  512. 'url': 'http://umpire-empire.com/index.php/topic/58125-laz-decides-no-thats-low/',
  513. 'md5': '96f09a37e44da40dd083e12d9a683327',
  514. 'info_dict': {
  515. 'id': '33322633',
  516. 'ext': 'mp4',
  517. 'title': 'Ump changes call to ball',
  518. 'description': 'md5:71c11215384298a172a6dcb4c2e20685',
  519. 'duration': 48,
  520. 'timestamp': 1401537900,
  521. 'upload_date': '20140531',
  522. 'thumbnail': 're:^https?://.*\.jpg$',
  523. },
  524. },
  525. # Wistia embed
  526. {
  527. 'url': 'http://education-portal.com/academy/lesson/north-american-exploration-failed-colonies-of-spain-france-england.html#lesson',
  528. 'md5': '8788b683c777a5cf25621eaf286d0c23',
  529. 'info_dict': {
  530. 'id': '1cfaf6b7ea',
  531. 'ext': 'mov',
  532. 'title': 'md5:51364a8d3d009997ba99656004b5e20d',
  533. 'duration': 643.0,
  534. 'filesize': 182808282,
  535. 'uploader': 'education-portal.com',
  536. },
  537. },
  538. {
  539. 'url': 'http://thoughtworks.wistia.com/medias/uxjb0lwrcz',
  540. 'md5': 'baf49c2baa8a7de5f3fc145a8506dcd4',
  541. 'info_dict': {
  542. 'id': 'uxjb0lwrcz',
  543. 'ext': 'mp4',
  544. 'title': 'Conversation about Hexagonal Rails Part 1 - ThoughtWorks',
  545. 'duration': 1715.0,
  546. 'uploader': 'thoughtworks.wistia.com',
  547. },
  548. },
  549. # Soundcloud embed
  550. {
  551. 'url': 'http://nakedsecurity.sophos.com/2014/10/29/sscc-171-are-you-sure-that-1234-is-a-bad-password-podcast/',
  552. 'info_dict': {
  553. 'id': '174391317',
  554. 'ext': 'mp3',
  555. 'description': 'md5:ff867d6b555488ad3c52572bb33d432c',
  556. 'uploader': 'Sophos Security',
  557. 'title': 'Chet Chat 171 - Oct 29, 2014',
  558. 'upload_date': '20141029',
  559. }
  560. },
  561. # Livestream embed
  562. {
  563. 'url': 'http://www.esa.int/Our_Activities/Space_Science/Rosetta/Philae_comet_touch-down_webcast',
  564. 'info_dict': {
  565. 'id': '67864563',
  566. 'ext': 'flv',
  567. 'upload_date': '20141112',
  568. 'title': 'Rosetta #CometLanding webcast HL 10',
  569. }
  570. },
  571. # LazyYT
  572. {
  573. 'url': 'http://discourse.ubuntu.com/t/unity-8-desktop-mode-windows-on-mir/1986',
  574. 'info_dict': {
  575. 'id': '1986',
  576. 'title': 'Unity 8 desktop-mode windows on Mir! - Ubuntu Discourse',
  577. },
  578. 'playlist_mincount': 2,
  579. },
  580. # Cinchcast embed
  581. {
  582. 'url': 'http://undergroundwellness.com/podcasts/306-5-steps-to-permanent-gut-healing/',
  583. 'info_dict': {
  584. 'id': '7141703',
  585. 'ext': 'mp3',
  586. 'upload_date': '20141126',
  587. 'title': 'Jack Tips: 5 Steps to Permanent Gut Healing',
  588. }
  589. },
  590. # Cinerama player
  591. {
  592. 'url': 'http://www.abc.net.au/7.30/content/2015/s4164797.htm',
  593. 'info_dict': {
  594. 'id': '730m_DandD_1901_512k',
  595. 'ext': 'mp4',
  596. 'uploader': 'www.abc.net.au',
  597. 'title': 'Game of Thrones with dice - Dungeons and Dragons fantasy role-playing game gets new life - 19/01/2015',
  598. }
  599. },
  600. # embedded viddler video
  601. {
  602. 'url': 'http://deadspin.com/i-cant-stop-watching-john-wall-chop-the-nuggets-with-th-1681801597',
  603. 'info_dict': {
  604. 'id': '4d03aad9',
  605. 'ext': 'mp4',
  606. 'uploader': 'deadspin',
  607. 'title': 'WALL-TO-GORTAT',
  608. 'timestamp': 1422285291,
  609. 'upload_date': '20150126',
  610. },
  611. 'add_ie': ['Viddler'],
  612. },
  613. # Libsyn embed
  614. {
  615. 'url': 'http://thedailyshow.cc.com/podcast/episodetwelve',
  616. 'info_dict': {
  617. 'id': '3377616',
  618. 'ext': 'mp3',
  619. 'title': "The Daily Show Podcast without Jon Stewart - Episode 12: Bassem Youssef: Egypt's Jon Stewart",
  620. 'description': 'md5:601cb790edd05908957dae8aaa866465',
  621. 'upload_date': '20150220',
  622. },
  623. },
  624. # jwplayer YouTube
  625. {
  626. 'url': 'http://media.nationalarchives.gov.uk/index.php/webinar-using-discovery-national-archives-online-catalogue/',
  627. 'info_dict': {
  628. 'id': 'Mrj4DVp2zeA',
  629. 'ext': 'mp4',
  630. 'upload_date': '20150212',
  631. 'uploader': 'The National Archives UK',
  632. 'description': 'md5:a236581cd2449dd2df4f93412f3f01c6',
  633. 'uploader_id': 'NationalArchives08',
  634. 'title': 'Webinar: Using Discovery, The National Archives’ online catalogue',
  635. },
  636. },
  637. # rtl.nl embed
  638. {
  639. 'url': 'http://www.rtlnieuws.nl/nieuws/buitenland/aanslagen-kopenhagen',
  640. 'playlist_mincount': 5,
  641. 'info_dict': {
  642. 'id': 'aanslagen-kopenhagen',
  643. 'title': 'Aanslagen Kopenhagen | RTL Nieuws',
  644. }
  645. },
  646. # Zapiks embed
  647. {
  648. 'url': 'http://www.skipass.com/news/116090-bon-appetit-s5ep3-baqueira-mi-cor.html',
  649. 'info_dict': {
  650. 'id': '118046',
  651. 'ext': 'mp4',
  652. 'title': 'EP3S5 - Bon Appétit - Baqueira Mi Corazon !',
  653. }
  654. },
  655. # Kaltura embed
  656. {
  657. 'url': 'http://www.monumentalnetwork.com/videos/john-carlson-postgame-2-25-15',
  658. 'info_dict': {
  659. 'id': '1_eergr3h1',
  660. 'ext': 'mp4',
  661. 'upload_date': '20150226',
  662. 'uploader_id': 'MonumentalSports-Kaltura@perfectsensedigital.com',
  663. 'timestamp': int,
  664. 'title': 'John Carlson Postgame 2/25/15',
  665. },
  666. },
  667. # Kaltura embed (different embed code)
  668. {
  669. 'url': 'http://www.premierchristianradio.com/Shows/Saturday/Unbelievable/Conference-Videos/Os-Guinness-Is-It-Fools-Talk-Unbelievable-Conference-2014',
  670. 'info_dict': {
  671. 'id': '1_a52wc67y',
  672. 'ext': 'flv',
  673. 'upload_date': '20150127',
  674. 'uploader_id': 'PremierMedia',
  675. 'timestamp': int,
  676. 'title': 'Os Guinness // Is It Fools Talk? // Unbelievable? Conference 2014',
  677. },
  678. },
  679. # Eagle.Platform embed (generic URL)
  680. {
  681. 'url': 'http://lenta.ru/news/2015/03/06/navalny/',
  682. 'info_dict': {
  683. 'id': '227304',
  684. 'ext': 'mp4',
  685. 'title': 'Навальный вышел на свободу',
  686. 'description': 'md5:d97861ac9ae77377f3f20eaf9d04b4f5',
  687. 'thumbnail': 're:^https?://.*\.jpg$',
  688. 'duration': 87,
  689. 'view_count': int,
  690. 'age_limit': 0,
  691. },
  692. },
  693. # ClipYou (Eagle.Platform) embed (custom URL)
  694. {
  695. 'url': 'http://muz-tv.ru/play/7129/',
  696. 'info_dict': {
  697. 'id': '12820',
  698. 'ext': 'mp4',
  699. 'title': "'O Sole Mio",
  700. 'thumbnail': 're:^https?://.*\.jpg$',
  701. 'duration': 216,
  702. 'view_count': int,
  703. },
  704. },
  705. # Pladform embed
  706. {
  707. 'url': 'http://muz-tv.ru/kinozal/view/7400/',
  708. 'info_dict': {
  709. 'id': '100183293',
  710. 'ext': 'mp4',
  711. 'title': 'Тайны перевала Дятлова • 1 серия 2 часть',
  712. 'description': 'Документальный сериал-расследование одной из самых жутких тайн ХХ века',
  713. 'thumbnail': 're:^https?://.*\.jpg$',
  714. 'duration': 694,
  715. 'age_limit': 0,
  716. },
  717. },
  718. # Playwire embed
  719. {
  720. 'url': 'http://www.cinemablend.com/new/First-Joe-Dirt-2-Trailer-Teaser-Stupid-Greatness-70874.html',
  721. 'info_dict': {
  722. 'id': '3519514',
  723. 'ext': 'mp4',
  724. 'title': 'Joe Dirt 2 Beautiful Loser Teaser Trailer',
  725. 'thumbnail': 're:^https?://.*\.png$',
  726. 'duration': 45.115,
  727. },
  728. },
  729. # 5min embed
  730. {
  731. 'url': 'http://techcrunch.com/video/facebook-creates-on-this-day-crunch-report/518726732/',
  732. 'md5': '4c6f127a30736b59b3e2c19234ee2bf7',
  733. 'info_dict': {
  734. 'id': '518726732',
  735. 'ext': 'mp4',
  736. 'title': 'Facebook Creates "On This Day" | Crunch Report',
  737. },
  738. },
  739. # SVT embed
  740. {
  741. 'url': 'http://www.svt.se/sport/ishockey/jagr-tacklar-giroux-under-intervjun',
  742. 'info_dict': {
  743. 'id': '2900353',
  744. 'ext': 'flv',
  745. 'title': 'Här trycker Jagr till Giroux (under SVT-intervjun)',
  746. 'duration': 27,
  747. 'age_limit': 0,
  748. },
  749. },
  750. # Crooks and Liars embed
  751. {
  752. 'url': 'http://crooksandliars.com/2015/04/fox-friends-says-protecting-atheists',
  753. 'info_dict': {
  754. 'id': '8RUoRhRi',
  755. 'ext': 'mp4',
  756. 'title': "Fox & Friends Says Protecting Atheists From Discrimination Is Anti-Christian!",
  757. 'description': 'md5:e1a46ad1650e3a5ec7196d432799127f',
  758. 'timestamp': 1428207000,
  759. 'upload_date': '20150405',
  760. 'uploader': 'Heather',
  761. },
  762. },
  763. # Crooks and Liars external embed
  764. {
  765. 'url': 'http://theothermccain.com/2010/02/02/video-proves-that-bill-kristol-has-been-watching-glenn-beck/comment-page-1/',
  766. 'info_dict': {
  767. 'id': 'MTE3MjUtMzQ2MzA',
  768. 'ext': 'mp4',
  769. 'title': 'md5:5e3662a81a4014d24c250d76d41a08d5',
  770. 'description': 'md5:9b8e9542d6c3c5de42d6451b7d780cec',
  771. 'timestamp': 1265032391,
  772. 'upload_date': '20100201',
  773. 'uploader': 'Heather',
  774. },
  775. },
  776. # NBC Sports vplayer embed
  777. {
  778. 'url': 'http://www.riderfans.com/forum/showthread.php?121827-Freeman&s=e98fa1ea6dc08e886b1678d35212494a',
  779. 'info_dict': {
  780. 'id': 'ln7x1qSThw4k',
  781. 'ext': 'flv',
  782. 'title': "PFT Live: New leader in the 'new-look' defense",
  783. 'description': 'md5:65a19b4bbfb3b0c0c5768bed1dfad74e',
  784. },
  785. },
  786. # UDN embed
  787. {
  788. 'url': 'http://www.udn.com/news/story/7314/822787',
  789. 'md5': 'fd2060e988c326991037b9aff9df21a6',
  790. 'info_dict': {
  791. 'id': '300346',
  792. 'ext': 'mp4',
  793. 'title': '中一中男師變性 全校師生力挺',
  794. 'thumbnail': 're:^https?://.*\.jpg$',
  795. }
  796. },
  797. # Ooyala embed
  798. {
  799. 'url': 'http://www.businessinsider.com/excel-index-match-vlookup-video-how-to-2015-2?IR=T',
  800. 'info_dict': {
  801. 'id': '50YnY4czr4ms1vJ7yz3xzq0excz_pUMs',
  802. 'ext': 'mp4',
  803. 'description': 'VIDEO: Index/Match versus VLOOKUP.',
  804. 'title': 'This is what separates the Excel masters from the wannabes',
  805. },
  806. 'params': {
  807. # m3u8 downloads
  808. 'skip_download': True,
  809. }
  810. },
  811. # Contains a SMIL manifest
  812. {
  813. 'url': 'http://www.telewebion.com/fa/1263668/%D9%82%D8%B1%D8%B9%D9%87%E2%80%8C%DA%A9%D8%B4%DB%8C-%D9%84%DB%8C%DA%AF-%D9%82%D9%87%D8%B1%D9%85%D8%A7%D9%86%D8%A7%D9%86-%D8%A7%D8%B1%D9%88%D9%BE%D8%A7/%2B-%D9%81%D9%88%D8%AA%D8%A8%D8%A7%D9%84.html',
  814. 'info_dict': {
  815. 'id': 'file',
  816. 'ext': 'flv',
  817. 'title': '+ Football: Lottery Champions League Europe',
  818. 'uploader': 'www.telewebion.com',
  819. },
  820. 'params': {
  821. # rtmpe downloads
  822. 'skip_download': True,
  823. }
  824. },
  825. # Brightcove URL in single quotes
  826. {
  827. 'url': 'http://www.sportsnet.ca/baseball/mlb/sn-presents-russell-martin-world-citizen/',
  828. 'md5': '4ae374f1f8b91c889c4b9203c8c752af',
  829. 'info_dict': {
  830. 'id': '4255764656001',
  831. 'ext': 'mp4',
  832. 'title': 'SN Presents: Russell Martin, World Citizen',
  833. 'description': 'To understand why he was the Toronto Blue Jays’ top off-season priority is to appreciate his background and upbringing in Montreal, where he first developed his baseball skills. Written and narrated by Stephen Brunt.',
  834. 'uploader': 'Rogers Sportsnet',
  835. },
  836. },
  837. # Dailymotion Cloud video
  838. {
  839. 'url': 'http://replay.publicsenat.fr/vod/le-debat/florent-kolandjian,dominique-cena,axel-decourtye,laurence-abeille,bruno-parmentier/175910',
  840. 'md5': '49444254273501a64675a7e68c502681',
  841. 'info_dict': {
  842. 'id': '5585de919473990de4bee11b',
  843. 'ext': 'mp4',
  844. 'title': 'Le débat',
  845. 'thumbnail': 're:^https?://.*\.jpe?g$',
  846. }
  847. },
  848. # OnionStudios embed
  849. {
  850. 'url': 'http://www.clickhole.com/video/dont-understand-bitcoin-man-will-mumble-explanatio-2537',
  851. 'info_dict': {
  852. 'id': '2855',
  853. 'ext': 'mp4',
  854. 'title': 'Don’t Understand Bitcoin? This Man Will Mumble An Explanation At You',
  855. 'thumbnail': 're:^https?://.*\.jpe?g$',
  856. 'uploader': 'ClickHole',
  857. 'uploader_id': 'clickhole',
  858. }
  859. },
  860. # SnagFilms embed
  861. {
  862. 'url': 'http://whilewewatch.blogspot.ru/2012/06/whilewewatch-whilewewatch-gripping.html',
  863. 'info_dict': {
  864. 'id': '74849a00-85a9-11e1-9660-123139220831',
  865. 'ext': 'mp4',
  866. 'title': '#whilewewatch',
  867. }
  868. },
  869. # AdobeTVVideo embed
  870. {
  871. 'url': 'https://helpx.adobe.com/acrobat/how-to/new-experience-acrobat-dc.html?set=acrobat--get-started--essential-beginners',
  872. 'md5': '43662b577c018ad707a63766462b1e87',
  873. 'info_dict': {
  874. 'id': '2456',
  875. 'ext': 'mp4',
  876. 'title': 'New experience with Acrobat DC',
  877. 'description': 'New experience with Acrobat DC',
  878. 'duration': 248.667,
  879. },
  880. }
  881. ]
  882. def report_following_redirect(self, new_url):
  883. """Report information extraction."""
  884. self._downloader.to_screen('[redirect] Following redirect to %s' % new_url)
  885. def _extract_rss(self, url, video_id, doc):
  886. playlist_title = doc.find('./channel/title').text
  887. playlist_desc_el = doc.find('./channel/description')
  888. playlist_desc = None if playlist_desc_el is None else playlist_desc_el.text
  889. entries = []
  890. for it in doc.findall('./channel/item'):
  891. next_url = xpath_text(it, 'link', fatal=False)
  892. if not next_url:
  893. enclosure_nodes = it.findall('./enclosure')
  894. for e in enclosure_nodes:
  895. next_url = e.attrib.get('url')
  896. if next_url:
  897. break
  898. if not next_url:
  899. continue
  900. entries.append({
  901. '_type': 'url',
  902. 'url': next_url,
  903. 'title': it.find('title').text,
  904. })
  905. return {
  906. '_type': 'playlist',
  907. 'id': url,
  908. 'title': playlist_title,
  909. 'description': playlist_desc,
  910. 'entries': entries,
  911. }
  912. def _extract_camtasia(self, url, video_id, webpage):
  913. """ Returns None if no camtasia video can be found. """
  914. camtasia_cfg = self._search_regex(
  915. r'fo\.addVariable\(\s*"csConfigFile",\s*"([^"]+)"\s*\);',
  916. webpage, 'camtasia configuration file', default=None)
  917. if camtasia_cfg is None:
  918. return None
  919. title = self._html_search_meta('DC.title', webpage, fatal=True)
  920. camtasia_url = compat_urlparse.urljoin(url, camtasia_cfg)
  921. camtasia_cfg = self._download_xml(
  922. camtasia_url, video_id,
  923. note='Downloading camtasia configuration',
  924. errnote='Failed to download camtasia configuration')
  925. fileset_node = camtasia_cfg.find('./playlist/array/fileset')
  926. entries = []
  927. for n in fileset_node.getchildren():
  928. url_n = n.find('./uri')
  929. if url_n is None:
  930. continue
  931. entries.append({
  932. 'id': os.path.splitext(url_n.text.rpartition('/')[2])[0],
  933. 'title': '%s - %s' % (title, n.tag),
  934. 'url': compat_urlparse.urljoin(url, url_n.text),
  935. 'duration': float_or_none(n.find('./duration').text),
  936. })
  937. return {
  938. '_type': 'playlist',
  939. 'entries': entries,
  940. 'title': title,
  941. }
  942. def _real_extract(self, url):
  943. if url.startswith('//'):
  944. return {
  945. '_type': 'url',
  946. 'url': self.http_scheme() + url,
  947. }
  948. parsed_url = compat_urlparse.urlparse(url)
  949. if not parsed_url.scheme:
  950. default_search = self._downloader.params.get('default_search')
  951. if default_search is None:
  952. default_search = 'fixup_error'
  953. if default_search in ('auto', 'auto_warning', 'fixup_error'):
  954. if '/' in url:
  955. self._downloader.report_warning('The url doesn\'t specify the protocol, trying with http')
  956. return self.url_result('http://' + url)
  957. elif default_search != 'fixup_error':
  958. if default_search == 'auto_warning':
  959. if re.match(r'^(?:url|URL)$', url):
  960. raise ExtractorError(
  961. 'Invalid URL: %r . Call youtube-dl like this: youtube-dl -v "https://www.youtube.com/watch?v=BaW_jenozKc" ' % url,
  962. expected=True)
  963. else:
  964. self._downloader.report_warning(
  965. 'Falling back to youtube search for %s . Set --default-search "auto" to suppress this warning.' % url)
  966. return self.url_result('ytsearch:' + url)
  967. if default_search in ('error', 'fixup_error'):
  968. raise ExtractorError(
  969. '%r is not a valid URL. '
  970. 'Set --default-search "ytsearch" (or run youtube-dl "ytsearch:%s" ) to search YouTube'
  971. % (url, url), expected=True)
  972. else:
  973. if ':' not in default_search:
  974. default_search += ':'
  975. return self.url_result(default_search + url)
  976. url, smuggled_data = unsmuggle_url(url)
  977. force_videoid = None
  978. is_intentional = smuggled_data and smuggled_data.get('to_generic')
  979. if smuggled_data and 'force_videoid' in smuggled_data:
  980. force_videoid = smuggled_data['force_videoid']
  981. video_id = force_videoid
  982. else:
  983. video_id = compat_urllib_parse_unquote(os.path.splitext(url.rstrip('/').split('/')[-1])[0])
  984. self.to_screen('%s: Requesting header' % video_id)
  985. head_req = HEADRequest(url)
  986. head_response = self._request_webpage(
  987. head_req, video_id,
  988. note=False, errnote='Could not send HEAD request to %s' % url,
  989. fatal=False)
  990. if head_response is not False:
  991. # Check for redirect
  992. new_url = head_response.geturl()
  993. if url != new_url:
  994. self.report_following_redirect(new_url)
  995. if force_videoid:
  996. new_url = smuggle_url(
  997. new_url, {'force_videoid': force_videoid})
  998. return self.url_result(new_url)
  999. full_response = None
  1000. if head_response is False:
  1001. request = compat_urllib_request.Request(url)
  1002. request.add_header('Accept-Encoding', '*')
  1003. full_response = self._request_webpage(request, video_id)
  1004. head_response = full_response
  1005. # Check for direct link to a video
  1006. content_type = head_response.headers.get('Content-Type', '')
  1007. m = re.match(r'^(?P<type>audio|video|application(?=/ogg$))/(?P<format_id>.+)$', content_type)
  1008. if m:
  1009. upload_date = unified_strdate(
  1010. head_response.headers.get('Last-Modified'))
  1011. return {
  1012. 'id': video_id,
  1013. 'title': compat_urllib_parse_unquote(os.path.splitext(url_basename(url))[0]),
  1014. 'direct': True,
  1015. 'formats': [{
  1016. 'format_id': m.group('format_id'),
  1017. 'url': url,
  1018. 'vcodec': 'none' if m.group('type') == 'audio' else None
  1019. }],
  1020. 'upload_date': upload_date,
  1021. }
  1022. if not self._downloader.params.get('test', False) and not is_intentional:
  1023. force = self._downloader.params.get('force_generic_extractor', False)
  1024. self._downloader.report_warning(
  1025. '%s on generic information extractor.' % ('Forcing' if force else 'Falling back'))
  1026. if not full_response:
  1027. request = compat_urllib_request.Request(url)
  1028. # Some webservers may serve compressed content of rather big size (e.g. gzipped flac)
  1029. # making it impossible to download only chunk of the file (yet we need only 512kB to
  1030. # test whether it's HTML or not). According to youtube-dl default Accept-Encoding
  1031. # that will always result in downloading the whole file that is not desirable.
  1032. # Therefore for extraction pass we have to override Accept-Encoding to any in order
  1033. # to accept raw bytes and being able to download only a chunk.
  1034. # It may probably better to solve this by checking Content-Type for application/octet-stream
  1035. # after HEAD request finishes, but not sure if we can rely on this.
  1036. request.add_header('Accept-Encoding', '*')
  1037. full_response = self._request_webpage(request, video_id)
  1038. # Maybe it's a direct link to a video?
  1039. # Be careful not to download the whole thing!
  1040. first_bytes = full_response.read(512)
  1041. if not is_html(first_bytes):
  1042. self._downloader.report_warning(
  1043. 'URL could be a direct video link, returning it as such.')
  1044. upload_date = unified_strdate(
  1045. head_response.headers.get('Last-Modified'))
  1046. return {
  1047. 'id': video_id,
  1048. 'title': compat_urllib_parse_unquote(os.path.splitext(url_basename(url))[0]),
  1049. 'direct': True,
  1050. 'url': url,
  1051. 'upload_date': upload_date,
  1052. }
  1053. webpage = self._webpage_read_content(
  1054. full_response, url, video_id, prefix=first_bytes)
  1055. self.report_extraction(video_id)
  1056. # Is it an RSS feed?
  1057. try:
  1058. doc = parse_xml(webpage)
  1059. if doc.tag == 'rss':
  1060. return self._extract_rss(url, video_id, doc)
  1061. except compat_xml_parse_error:
  1062. pass
  1063. # Is it a Camtasia project?
  1064. camtasia_res = self._extract_camtasia(url, video_id, webpage)
  1065. if camtasia_res is not None:
  1066. return camtasia_res
  1067. # Sometimes embedded video player is hidden behind percent encoding
  1068. # (e.g. https://github.com/rg3/youtube-dl/issues/2448)
  1069. # Unescaping the whole page allows to handle those cases in a generic way
  1070. webpage = compat_urllib_parse.unquote(webpage)
  1071. # it's tempting to parse this further, but you would
  1072. # have to take into account all the variations like
  1073. # Video Title - Site Name
  1074. # Site Name | Video Title
  1075. # Video Title - Tagline | Site Name
  1076. # and so on and so forth; it's just not practical
  1077. video_title = self._html_search_regex(
  1078. r'(?s)<title>(.*?)</title>', webpage, 'video title',
  1079. default='video')
  1080. # Try to detect age limit automatically
  1081. age_limit = self._rta_search(webpage)
  1082. # And then there are the jokers who advertise that they use RTA,
  1083. # but actually don't.
  1084. AGE_LIMIT_MARKERS = [
  1085. r'Proudly Labeled <a href="http://www.rtalabel.org/" title="Restricted to Adults">RTA</a>',
  1086. ]
  1087. if any(re.search(marker, webpage) for marker in AGE_LIMIT_MARKERS):
  1088. age_limit = 18
  1089. # video uploader is domain name
  1090. video_uploader = self._search_regex(
  1091. r'^(?:https?://)?([^/]*)/.*', url, 'video uploader')
  1092. # Helper method
  1093. def _playlist_from_matches(matches, getter=None, ie=None):
  1094. urlrs = orderedSet(
  1095. self.url_result(self._proto_relative_url(getter(m) if getter else m), ie)
  1096. for m in matches)
  1097. return self.playlist_result(
  1098. urlrs, playlist_id=video_id, playlist_title=video_title)
  1099. # Look for BrightCove:
  1100. bc_urls = BrightcoveIE._extract_brightcove_urls(webpage)
  1101. if bc_urls:
  1102. self.to_screen('Brightcove video detected.')
  1103. entries = [{
  1104. '_type': 'url',
  1105. 'url': smuggle_url(bc_url, {'Referer': url}),
  1106. 'ie_key': 'Brightcove'
  1107. } for bc_url in bc_urls]
  1108. return {
  1109. '_type': 'playlist',
  1110. 'title': video_title,
  1111. 'id': video_id,
  1112. 'entries': entries,
  1113. }
  1114. # Look for embedded rtl.nl player
  1115. matches = re.findall(
  1116. r'<iframe[^>]+?src="((?:https?:)?//(?:www\.)?rtl\.nl/system/videoplayer/[^"]+(?:video_)?embed[^"]+)"',
  1117. webpage)
  1118. if matches:
  1119. return _playlist_from_matches(matches, ie='RtlNl')
  1120. vimeo_url = VimeoIE._extract_vimeo_url(url, webpage)
  1121. if vimeo_url is not None:
  1122. return self.url_result(vimeo_url)
  1123. # Look for embedded YouTube player
  1124. matches = re.findall(r'''(?x)
  1125. (?:
  1126. <iframe[^>]+?src=|
  1127. data-video-url=|
  1128. <embed[^>]+?src=|
  1129. embedSWF\(?:\s*|
  1130. new\s+SWFObject\(
  1131. )
  1132. (["\'])
  1133. (?P<url>(?:https?:)?//(?:www\.)?youtube(?:-nocookie)?\.com/
  1134. (?:embed|v|p)/.+?)
  1135. \1''', webpage)
  1136. if matches:
  1137. return _playlist_from_matches(
  1138. matches, lambda m: unescapeHTML(m[1]))
  1139. # Look for lazyYT YouTube embed
  1140. matches = re.findall(
  1141. r'class="lazyYT" data-youtube-id="([^"]+)"', webpage)
  1142. if matches:
  1143. return _playlist_from_matches(matches, lambda m: unescapeHTML(m))
  1144. # Look for embedded Dailymotion player
  1145. matches = re.findall(
  1146. r'<iframe[^>]+?src=(["\'])(?P<url>(?:https?:)?//(?:www\.)?dailymotion\.com/embed/video/.+?)\1', webpage)
  1147. if matches:
  1148. return _playlist_from_matches(
  1149. matches, lambda m: unescapeHTML(m[1]))
  1150. # Look for embedded Dailymotion playlist player (#3822)
  1151. m = re.search(
  1152. r'<iframe[^>]+?src=(["\'])(?P<url>(?:https?:)?//(?:www\.)?dailymotion\.[a-z]{2,3}/widget/jukebox\?.+?)\1', webpage)
  1153. if m:
  1154. playlists = re.findall(
  1155. r'list\[\]=/playlist/([^/]+)/', unescapeHTML(m.group('url')))
  1156. if playlists:
  1157. return _playlist_from_matches(
  1158. playlists, lambda p: '//dailymotion.com/playlist/%s' % p)
  1159. # Look for embedded Wistia player
  1160. match = re.search(
  1161. r'<(?:meta[^>]+?content|iframe[^>]+?src)=(["\'])(?P<url>(?:https?:)?//(?:fast\.)?wistia\.net/embed/iframe/.+?)\1', webpage)
  1162. if match:
  1163. embed_url = self._proto_relative_url(
  1164. unescapeHTML(match.group('url')))
  1165. return {
  1166. '_type': 'url_transparent',
  1167. 'url': embed_url,
  1168. 'ie_key': 'Wistia',
  1169. 'uploader': video_uploader,
  1170. 'title': video_title,
  1171. 'id': video_id,
  1172. }
  1173. match = re.search(r'(?:id=["\']wistia_|data-wistia-?id=["\']|Wistia\.embed\(["\'])(?P<id>[^"\']+)', webpage)
  1174. if match:
  1175. return {
  1176. '_type': 'url_transparent',
  1177. 'url': 'http://fast.wistia.net/embed/iframe/{0:}'.format(match.group('id')),
  1178. 'ie_key': 'Wistia',
  1179. 'uploader': video_uploader,
  1180. 'title': video_title,
  1181. 'id': match.group('id')
  1182. }
  1183. # Look for embedded blip.tv player
  1184. bliptv_url = BlipTVIE._extract_url(webpage)
  1185. if bliptv_url:
  1186. return self.url_result(bliptv_url, 'BlipTV')
  1187. # Look for SVT player
  1188. svt_url = SVTIE._extract_url(webpage)
  1189. if svt_url:
  1190. return self.url_result(svt_url, 'SVT')
  1191. # Look for embedded condenast player
  1192. matches = re.findall(
  1193. r'<iframe\s+(?:[a-zA-Z-]+="[^"]+"\s+)*?src="(https?://player\.cnevids\.com/embed/[^"]+")',
  1194. webpage)
  1195. if matches:
  1196. return {
  1197. '_type': 'playlist',
  1198. 'entries': [{
  1199. '_type': 'url',
  1200. 'ie_key': 'CondeNast',
  1201. 'url': ma,
  1202. } for ma in matches],
  1203. 'title': video_title,
  1204. 'id': video_id,
  1205. }
  1206. # Look for Bandcamp pages with custom domain
  1207. mobj = re.search(r'<meta property="og:url"[^>]*?content="(.*?bandcamp\.com.*?)"', webpage)
  1208. if mobj is not None:
  1209. burl = unescapeHTML(mobj.group(1))
  1210. # Don't set the extractor because it can be a track url or an album
  1211. return self.url_result(burl)
  1212. # Look for embedded Vevo player
  1213. mobj = re.search(
  1214. r'<iframe[^>]+?src=(["\'])(?P<url>(?:https?:)?//(?:cache\.)?vevo\.com/.+?)\1', webpage)
  1215. if mobj is not None:
  1216. return self.url_result(mobj.group('url'))
  1217. # Look for embedded Viddler player
  1218. mobj = re.search(
  1219. r'<(?:iframe[^>]+?src|param[^>]+?value)=(["\'])(?P<url>(?:https?:)?//(?:www\.)?viddler\.com/(?:embed|player)/.+?)\1',
  1220. webpage)
  1221. if mobj is not None:
  1222. return self.url_result(mobj.group('url'))
  1223. # Look for NYTimes player
  1224. mobj = re.search(
  1225. r'<iframe[^>]+src=(["\'])(?P<url>(?:https?:)?//graphics8\.nytimes\.com/bcvideo/[^/]+/iframe/embed\.html.+?)\1>',
  1226. webpage)
  1227. if mobj is not None:
  1228. return self.url_result(mobj.group('url'))
  1229. # Look for Libsyn player
  1230. mobj = re.search(
  1231. r'<iframe[^>]+src=(["\'])(?P<url>(?:https?:)?//html5-player\.libsyn\.com/embed/.+?)\1', webpage)
  1232. if mobj is not None:
  1233. return self.url_result(mobj.group('url'))
  1234. # Look for Ooyala videos
  1235. mobj = (re.search(r'player\.ooyala\.com/[^"?]+\?[^"]*?(?:embedCode|ec)=(?P<ec>[^"&]+)', webpage) or
  1236. re.search(r'OO\.Player\.create\([\'"].*?[\'"],\s*[\'"](?P<ec>.{32})[\'"]', webpage) or
  1237. re.search(r'SBN\.VideoLinkset\.ooyala\([\'"](?P<ec>.{32})[\'"]\)', webpage) or
  1238. re.search(r'data-ooyala-video-id\s*=\s*[\'"](?P<ec>.{32})[\'"]', webpage))
  1239. if mobj is not None:
  1240. return OoyalaIE._build_url_result(mobj.group('ec'))
  1241. # Look for multiple Ooyala embeds on SBN network websites
  1242. mobj = re.search(r'SBN\.VideoLinkset\.entryGroup\((\[.*?\])', webpage)
  1243. if mobj is not None:
  1244. embeds = self._parse_json(mobj.group(1), video_id, fatal=False)
  1245. if embeds:
  1246. return _playlist_from_matches(
  1247. embeds, getter=lambda v: OoyalaIE._url_for_embed_code(v['provider_video_id']), ie='Ooyala')
  1248. # Look for Aparat videos
  1249. mobj = re.search(r'<iframe .*?src="(http://www\.aparat\.com/video/[^"]+)"', webpage)
  1250. if mobj is not None:
  1251. return self.url_result(mobj.group(1), 'Aparat')
  1252. # Look for MPORA videos
  1253. mobj = re.search(r'<iframe .*?src="(http://mpora\.(?:com|de)/videos/[^"]+)"', webpage)
  1254. if mobj is not None:
  1255. return self.url_result(mobj.group(1), 'Mpora')
  1256. # Look for embedded NovaMov-based player
  1257. mobj = re.search(
  1258. r'''(?x)<(?:pagespeed_)?iframe[^>]+?src=(["\'])
  1259. (?P<url>http://(?:(?:embed|www)\.)?
  1260. (?:novamov\.com|
  1261. nowvideo\.(?:ch|sx|eu|at|ag|co)|
  1262. videoweed\.(?:es|com)|
  1263. movshare\.(?:net|sx|ag)|
  1264. divxstage\.(?:eu|net|ch|co|at|ag))
  1265. /embed\.php.+?)\1''', webpage)
  1266. if mobj is not None:
  1267. return self.url_result(mobj.group('url'))
  1268. # Look for embedded Facebook player
  1269. mobj = re.search(
  1270. r'<iframe[^>]+?src=(["\'])(?P<url>https://www\.facebook\.com/video/embed.+?)\1', webpage)
  1271. if mobj is not None:
  1272. return self.url_result(mobj.group('url'), 'Facebook')
  1273. # Look for embedded VK player
  1274. mobj = re.search(r'<iframe[^>]+?src=(["\'])(?P<url>https?://vk\.com/video_ext\.php.+?)\1', webpage)
  1275. if mobj is not None:
  1276. return self.url_result(mobj.group('url'), 'VK')
  1277. # Look for embedded ivi player
  1278. mobj = re.search(r'<embed[^>]+?src=(["\'])(?P<url>https?://(?:www\.)?ivi\.ru/video/player.+?)\1', webpage)
  1279. if mobj is not None:
  1280. return self.url_result(mobj.group('url'), 'Ivi')
  1281. # Look for embedded Huffington Post player
  1282. mobj = re.search(
  1283. r'<iframe[^>]+?src=(["\'])(?P<url>https?://embed\.live\.huffingtonpost\.com/.+?)\1', webpage)
  1284. if mobj is not None:
  1285. return self.url_result(mobj.group('url'), 'HuffPost')
  1286. # Look for embed.ly
  1287. mobj = re.search(r'class=["\']embedly-card["\'][^>]href=["\'](?P<url>[^"\']+)', webpage)
  1288. if mobj is not None:
  1289. return self.url_result(mobj.group('url'))
  1290. mobj = re.search(r'class=["\']embedly-embed["\'][^>]src=["\'][^"\']*url=(?P<url>[^&]+)', webpage)
  1291. if mobj is not None:
  1292. return self.url_result(compat_urllib_parse.unquote(mobj.group('url')))
  1293. # Look for funnyordie embed
  1294. matches = re.findall(r'<iframe[^>]+?src="(https?://(?:www\.)?funnyordie\.com/embed/[^"]+)"', webpage)
  1295. if matches:
  1296. return _playlist_from_matches(
  1297. matches, getter=unescapeHTML, ie='FunnyOrDie')
  1298. # Look for BBC iPlayer embed
  1299. matches = re.findall(r'setPlaylist\("(https?://www\.bbc\.co\.uk/iplayer/[^/]+/[\da-z]{8})"\)', webpage)
  1300. if matches:
  1301. return _playlist_from_matches(matches, ie='BBCCoUk')
  1302. # Look for embedded RUTV player
  1303. rutv_url = RUTVIE._extract_url(webpage)
  1304. if rutv_url:
  1305. return self.url_result(rutv_url, 'RUTV')
  1306. # Look for embedded TVC player
  1307. tvc_url = TVCIE._extract_url(webpage)
  1308. if tvc_url:
  1309. return self.url_result(tvc_url, 'TVC')
  1310. # Look for embedded SportBox player
  1311. sportbox_urls = SportBoxEmbedIE._extract_urls(webpage)
  1312. if sportbox_urls:
  1313. return _playlist_from_matches(sportbox_urls, ie='SportBoxEmbed')
  1314. # Look for embedded PornHub player
  1315. pornhub_url = PornHubIE._extract_url(webpage)
  1316. if pornhub_url:
  1317. return self.url_result(pornhub_url, 'PornHub')
  1318. # Look for embedded XHamster player
  1319. xhamster_urls = XHamsterEmbedIE._extract_urls(webpage)
  1320. if xhamster_urls:
  1321. return _playlist_from_matches(xhamster_urls, ie='XHamsterEmbed')
  1322. # Look for embedded Tvigle player
  1323. mobj = re.search(
  1324. r'<iframe[^>]+?src=(["\'])(?P<url>(?:https?:)?//cloud\.tvigle\.ru/video/.+?)\1', webpage)
  1325. if mobj is not None:
  1326. return self.url_result(mobj.group('url'), 'Tvigle')
  1327. # Look for embedded TED player
  1328. mobj = re.search(
  1329. r'<iframe[^>]+?src=(["\'])(?P<url>https?://embed(?:-ssl)?\.ted\.com/.+?)\1', webpage)
  1330. if mobj is not None:
  1331. return self.url_result(mobj.group('url'), 'TED')
  1332. # Look for embedded Ustream videos
  1333. mobj = re.search(
  1334. r'<iframe[^>]+?src=(["\'])(?P<url>http://www\.ustream\.tv/embed/.+?)\1', webpage)
  1335. if mobj is not None:
  1336. return self.url_result(mobj.group('url'), 'Ustream')
  1337. # Look for embedded arte.tv player
  1338. mobj = re.search(
  1339. r'<script [^>]*?src="(?P<url>http://www\.arte\.tv/playerv2/embed[^"]+)"',
  1340. webpage)
  1341. if mobj is not None:
  1342. return self.url_result(mobj.group('url'), 'ArteTVEmbed')
  1343. # Look for embedded smotri.com player
  1344. smotri_url = SmotriIE._extract_url(webpage)
  1345. if smotri_url:
  1346. return self.url_result(smotri_url, 'Smotri')
  1347. # Look for embeded soundcloud player
  1348. mobj = re.search(
  1349. r'<iframe\s+(?:[a-zA-Z0-9_-]+="[^"]+"\s+)*src="(?P<url>https?://(?:w\.)?soundcloud\.com/player[^"]+)"',
  1350. webpage)
  1351. if mobj is not None:
  1352. url = unescapeHTML(mobj.group('url'))
  1353. return self.url_result(url)
  1354. # Look for embedded vulture.com player
  1355. mobj = re.search(
  1356. r'<iframe src="(?P<url>https?://video\.vulture\.com/[^"]+)"',
  1357. webpage)
  1358. if mobj is not None:
  1359. url = unescapeHTML(mobj.group('url'))
  1360. return self.url_result(url, ie='Vulture')
  1361. # Look for embedded mtvservices player
  1362. mobj = re.search(
  1363. r'<iframe src="(?P<url>https?://media\.mtvnservices\.com/embed/[^"]+)"',
  1364. webpage)
  1365. if mobj is not None:
  1366. url = unescapeHTML(mobj.group('url'))
  1367. return self.url_result(url, ie='MTVServicesEmbedded')
  1368. # Look for embedded yahoo player
  1369. mobj = re.search(
  1370. r'<iframe[^>]+?src=(["\'])(?P<url>https?://(?:screen|movies)\.yahoo\.com/.+?\.html\?format=embed)\1',
  1371. webpage)
  1372. if mobj is not None:
  1373. return self.url_result(mobj.group('url'), 'Yahoo')
  1374. # Look for embedded sbs.com.au player
  1375. mobj = re.search(
  1376. r'''(?x)
  1377. (?:
  1378. <meta\s+property="og:video"\s+content=|
  1379. <iframe[^>]+?src=
  1380. )
  1381. (["\'])(?P<url>https?://(?:www\.)?sbs\.com\.au/ondemand/video/.+?)\1''',
  1382. webpage)
  1383. if mobj is not None:
  1384. return self.url_result(mobj.group('url'), 'SBS')
  1385. # Look for embedded Cinchcast player
  1386. mobj = re.search(
  1387. r'<iframe[^>]+?src=(["\'])(?P<url>https?://player\.cinchcast\.com/.+?)\1',
  1388. webpage)
  1389. if mobj is not None:
  1390. return self.url_result(mobj.group('url'), 'Cinchcast')
  1391. mobj = re.search(
  1392. r'<iframe[^>]+?src=(["\'])(?P<url>https?://m(?:lb)?\.mlb\.com/shared/video/embed/embed\.html\?.+?)\1',
  1393. webpage)
  1394. if not mobj:
  1395. mobj = re.search(
  1396. r'data-video-link=["\'](?P<url>http://m.mlb.com/video/[^"\']+)',
  1397. webpage)
  1398. if mobj is not None:
  1399. return self.url_result(mobj.group('url'), 'MLB')
  1400. mobj = re.search(
  1401. r'<iframe[^>]+?src=(["\'])(?P<url>%s)\1' % CondeNastIE.EMBED_URL,
  1402. webpage)
  1403. if mobj is not None:
  1404. return self.url_result(self._proto_relative_url(mobj.group('url'), scheme='http:'), 'CondeNast')
  1405. mobj = re.search(
  1406. r'<iframe[^>]+src="(?P<url>https?://new\.livestream\.com/[^"]+/player[^"]+)"',
  1407. webpage)
  1408. if mobj is not None:
  1409. return self.url_result(mobj.group('url'), 'Livestream')
  1410. # Look for Zapiks embed
  1411. mobj = re.search(
  1412. r'<iframe[^>]+src="(?P<url>https?://(?:www\.)?zapiks\.fr/index\.php\?.+?)"', webpage)
  1413. if mobj is not None:
  1414. return self.url_result(mobj.group('url'), 'Zapiks')
  1415. # Look for Kaltura embeds
  1416. mobj = (re.search(r"(?s)kWidget\.(?:thumb)?[Ee]mbed\(\{.*?'wid'\s*:\s*'_?(?P<partner_id>[^']+)',.*?'entry_id'\s*:\s*'(?P<id>[^']+)',", webpage) or
  1417. re.search(r'(?s)(["\'])(?:https?:)?//cdnapisec\.kaltura\.com/.*?(?:p|partner_id)/(?P<partner_id>\d+).*?\1.*?entry_id\s*:\s*(["\'])(?P<id>[^\2]+?)\2', webpage))
  1418. if mobj is not None:
  1419. return self.url_result('kaltura:%(partner_id)s:%(id)s' % mobj.groupdict(), 'Kaltura')
  1420. # Look for Eagle.Platform embeds
  1421. mobj = re.search(
  1422. r'<iframe[^>]+src="(?P<url>https?://.+?\.media\.eagleplatform\.com/index/player\?.+?)"', webpage)
  1423. if mobj is not None:
  1424. return self.url_result(mobj.group('url'), 'EaglePlatform')
  1425. # Look for ClipYou (uses Eagle.Platform) embeds
  1426. mobj = re.search(
  1427. r'<iframe[^>]+src="https?://(?P<host>media\.clipyou\.ru)/index/player\?.*\brecord_id=(?P<id>\d+).*"', webpage)
  1428. if mobj is not None:
  1429. return self.url_result('eagleplatform:%(host)s:%(id)s' % mobj.groupdict(), 'EaglePlatform')
  1430. # Look for Pladform embeds
  1431. mobj = re.search(
  1432. r'<iframe[^>]+src="(?P<url>https?://out\.pladform\.ru/player\?.+?)"', webpage)
  1433. if mobj is not None:
  1434. return self.url_result(mobj.group('url'), 'Pladform')
  1435. # Look for Playwire embeds
  1436. mobj = re.search(
  1437. r'<script[^>]+data-config=(["\'])(?P<url>(?:https?:)?//config\.playwire\.com/.+?)\1', webpage)
  1438. if mobj is not None:
  1439. return self.url_result(mobj.group('url'))
  1440. # Look for 5min embeds
  1441. mobj = re.search(
  1442. r'<meta[^>]+property="og:video"[^>]+content="https?://embed\.5min\.com/(?P<id>[0-9]+)/?', webpage)
  1443. if mobj is not None:
  1444. return self.url_result('5min:%s' % mobj.group('id'), 'FiveMin')
  1445. # Look for Crooks and Liars embeds
  1446. mobj = re.search(
  1447. r'<(?:iframe[^>]+src|param[^>]+value)=(["\'])(?P<url>(?:https?:)?//embed\.crooksandliars\.com/(?:embed|v)/.+?)\1', webpage)
  1448. if mobj is not None:
  1449. return self.url_result(mobj.group('url'))
  1450. # Look for NBC Sports VPlayer embeds
  1451. nbc_sports_url = NBCSportsVPlayerIE._extract_url(webpage)
  1452. if nbc_sports_url:
  1453. return self.url_result(nbc_sports_url, 'NBCSportsVPlayer')
  1454. # Look for UDN embeds
  1455. mobj = re.search(
  1456. r'<iframe[^>]+src="(?P<url>%s)"' % UDNEmbedIE._VALID_URL, webpage)
  1457. if mobj is not None:
  1458. return self.url_result(
  1459. compat_urlparse.urljoin(url, mobj.group('url')), 'UDNEmbed')
  1460. # Look for Senate ISVP iframe
  1461. senate_isvp_url = SenateISVPIE._search_iframe_url(webpage)
  1462. if senate_isvp_url:
  1463. return self.url_result(senate_isvp_url, 'SenateISVP')
  1464. # Look for Dailymotion Cloud videos
  1465. dmcloud_url = DailymotionCloudIE._extract_dmcloud_url(webpage)
  1466. if dmcloud_url:
  1467. return self.url_result(dmcloud_url, 'DailymotionCloud')
  1468. # Look for OnionStudios embeds
  1469. onionstudios_url = OnionStudiosIE._extract_url(webpage)
  1470. if onionstudios_url:
  1471. return self.url_result(onionstudios_url)
  1472. # Look for SnagFilms embeds
  1473. snagfilms_url = SnagFilmsEmbedIE._extract_url(webpage)
  1474. if snagfilms_url:
  1475. return self.url_result(snagfilms_url)
  1476. # Look for AdobeTVVideo embeds
  1477. mobj = re.search(
  1478. r'<iframe[^>]+src=[\'"]((?:https?:)?//video\.tv\.adobe\.com/v/\d+[^"]+)[\'"]',
  1479. webpage)
  1480. if mobj is not None:
  1481. return self.url_result(
  1482. self._proto_relative_url(unescapeHTML(mobj.group(1))),
  1483. 'AdobeTVVideo')
  1484. def check_video(vurl):
  1485. if YoutubeIE.suitable(vurl):
  1486. return True
  1487. vpath = compat_urlparse.urlparse(vurl).path
  1488. vext = determine_ext(vpath)
  1489. return '.' in vpath and vext not in ('swf', 'png', 'jpg', 'srt', 'sbv', 'sub', 'vtt', 'ttml')
  1490. def filter_video(urls):
  1491. return list(filter(check_video, urls))
  1492. # Start with something easy: JW Player in SWFObject
  1493. found = filter_video(re.findall(r'flashvars: [\'"](?:.*&)?file=(http[^\'"&]*)', webpage))
  1494. if not found:
  1495. # Look for gorilla-vid style embedding
  1496. found = filter_video(re.findall(r'''(?sx)
  1497. (?:
  1498. jw_plugins|
  1499. JWPlayerOptions|
  1500. jwplayer\s*\(\s*["'][^'"]+["']\s*\)\s*\.setup
  1501. )
  1502. .*?
  1503. ['"]?file['"]?\s*:\s*["\'](.*?)["\']''', webpage))
  1504. if not found:
  1505. # Broaden the search a little bit
  1506. found = filter_video(re.findall(r'[^A-Za-z0-9]?(?:file|source)=(http[^\'"&]*)', webpage))
  1507. if not found:
  1508. # Broaden the findall a little bit: JWPlayer JS loader
  1509. found = filter_video(re.findall(
  1510. r'[^A-Za-z0-9]?file["\']?:\s*["\'](http(?![^\'"]+\.[0-9]+[\'"])[^\'"]+)["\']', webpage))
  1511. if not found:
  1512. # Flow player
  1513. found = filter_video(re.findall(r'''(?xs)
  1514. flowplayer\("[^"]+",\s*
  1515. \{[^}]+?\}\s*,
  1516. \s*\{[^}]+? ["']?clip["']?\s*:\s*\{\s*
  1517. ["']?url["']?\s*:\s*["']([^"']+)["']
  1518. ''', webpage))
  1519. if not found:
  1520. # Cinerama player
  1521. found = re.findall(
  1522. r"cinerama\.embedPlayer\(\s*\'[^']+\',\s*'([^']+)'", webpage)
  1523. if not found:
  1524. # Try to find twitter cards info
  1525. found = filter_video(re.findall(
  1526. r'<meta (?:property|name)="twitter:player:stream" (?:content|value)="(.+?)"', webpage))
  1527. if not found:
  1528. # We look for Open Graph info:
  1529. # We have to match any number spaces between elements, some sites try to align them (eg.: statigr.am)
  1530. m_video_type = re.findall(r'<meta.*?property="og:video:type".*?content="video/(.*?)"', webpage)
  1531. # We only look in og:video if the MIME type is a video, don't try if it's a Flash player:
  1532. if m_video_type is not None:
  1533. found = filter_video(re.findall(r'<meta.*?property="og:video".*?content="(.*?)"', webpage))
  1534. if not found:
  1535. # HTML5 video
  1536. found = re.findall(r'(?s)<video[^<]*(?:>.*?<source[^>]*)?\s+src=["\'](.*?)["\']', webpage)
  1537. if not found:
  1538. REDIRECT_REGEX = r'[0-9]{,2};\s*(?:URL|url)=\'?([^\'"]+)'
  1539. found = re.search(
  1540. r'(?i)<meta\s+(?=(?:[a-z-]+="[^"]+"\s+)*http-equiv="refresh")'
  1541. r'(?:[a-z-]+="[^"]+"\s+)*?content="%s' % REDIRECT_REGEX,
  1542. webpage)
  1543. if not found:
  1544. # Look also in Refresh HTTP header
  1545. refresh_header = head_response.headers.get('Refresh')
  1546. if refresh_header:
  1547. found = re.search(REDIRECT_REGEX, refresh_header)
  1548. if found:
  1549. new_url = compat_urlparse.urljoin(url, found.group(1))
  1550. self.report_following_redirect(new_url)
  1551. return {
  1552. '_type': 'url',
  1553. 'url': new_url,
  1554. }
  1555. if not found:
  1556. raise UnsupportedError(url)
  1557. entries = []
  1558. for video_url in found:
  1559. video_url = compat_urlparse.urljoin(url, video_url)
  1560. video_id = compat_urllib_parse.unquote(os.path.basename(video_url))
  1561. # Sometimes, jwplayer extraction will result in a YouTube URL
  1562. if YoutubeIE.suitable(video_url):
  1563. entries.append(self.url_result(video_url, 'Youtube'))
  1564. continue
  1565. # here's a fun little line of code for you:
  1566. video_id = os.path.splitext(video_id)[0]
  1567. if determine_ext(video_url) == 'smil':
  1568. entries.append({
  1569. 'id': video_id,
  1570. 'formats': self._extract_smil_formats(video_url, video_id),
  1571. 'uploader': video_uploader,
  1572. 'title': video_title,
  1573. 'age_limit': age_limit,
  1574. })
  1575. else:
  1576. entries.append({
  1577. 'id': video_id,
  1578. 'url': video_url,
  1579. 'uploader': video_uploader,
  1580. 'title': video_title,
  1581. 'age_limit': age_limit,
  1582. })
  1583. if len(entries) == 1:
  1584. return entries[0]
  1585. else:
  1586. for num, e in enumerate(entries, start=1):
  1587. # 'url' results don't have a title
  1588. if e.get('title') is not None:
  1589. e['title'] = '%s (%d)' % (e['title'], num)
  1590. return {
  1591. '_type': 'playlist',
  1592. 'entries': entries,
  1593. }