generic.py 101 KB

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