generic.py 89 KB

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