generic.py 95 KB

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