generic.py 81 KB

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