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.

1935 lines
77 KiB

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