generic.py 97 KB

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