generic.py 76 KB

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