generic.py 87 KB

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