generic.py 75 KB

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