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.

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