You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1758 lines
67 KiB

13 years ago
12 years ago
13 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
  1. import base64
  2. import datetime
  3. import itertools
  4. import netrc
  5. import os
  6. import re
  7. import socket
  8. import time
  9. import email.utils
  10. import xml.etree.ElementTree
  11. import random
  12. import math
  13. import operator
  14. import hashlib
  15. import binascii
  16. import urllib
  17. from .utils import *
  18. from .extractor.common import InfoExtractor, SearchInfoExtractor
  19. from .extractor.ard import ARDIE
  20. from .extractor.arte import ArteTvIE
  21. from .extractor.bliptv import BlipTVIE, BlipTVUserIE
  22. from .extractor.comedycentral import ComedyCentralIE
  23. from .extractor.collegehumor import CollegeHumorIE
  24. from .extractor.dailymotion import DailymotionIE
  25. from .extractor.depositfiles import DepositFilesIE
  26. from .extractor.escapist import EscapistIE
  27. from .extractor.facebook import FacebookIE
  28. from .extractor.gametrailers import GametrailersIE
  29. from .extractor.generic import GenericIE
  30. from .extractor.googleplus import GooglePlusIE
  31. from .extractor.googlesearch import GoogleSearchIE
  32. from .extractor.infoq import InfoQIE
  33. from .extractor.metacafe import MetacafeIE
  34. from .extractor.myvideo import MyVideoIE
  35. from .extractor.statigram import StatigramIE
  36. from .extractor.photobucket import PhotobucketIE
  37. from .extractor.soundcloud import SoundcloudIE, SoundcloudSetIE
  38. from .extractor.vimeo import VimeoIE
  39. from .extractor.xvideos import XVideosIE
  40. from .extractor.yahoo import YahooIE, YahooSearchIE
  41. from .extractor.youtube import YoutubeIE, YoutubePlaylistIE, YoutubeSearchIE, YoutubeUserIE, YoutubeChannelIE
  42. from .extractor.zdf import ZDFIE
  43. class MixcloudIE(InfoExtractor):
  44. """Information extractor for www.mixcloud.com"""
  45. _WORKING = False # New API, but it seems good http://www.mixcloud.com/developers/documentation/
  46. _VALID_URL = r'^(?:https?://)?(?:www\.)?mixcloud\.com/([\w\d-]+)/([\w\d-]+)'
  47. IE_NAME = u'mixcloud'
  48. def report_download_json(self, file_id):
  49. """Report JSON download."""
  50. self.to_screen(u'Downloading json')
  51. def get_urls(self, jsonData, fmt, bitrate='best'):
  52. """Get urls from 'audio_formats' section in json"""
  53. file_url = None
  54. try:
  55. bitrate_list = jsonData[fmt]
  56. if bitrate is None or bitrate == 'best' or bitrate not in bitrate_list:
  57. bitrate = max(bitrate_list) # select highest
  58. url_list = jsonData[fmt][bitrate]
  59. except TypeError: # we have no bitrate info.
  60. url_list = jsonData[fmt]
  61. return url_list
  62. def check_urls(self, url_list):
  63. """Returns 1st active url from list"""
  64. for url in url_list:
  65. try:
  66. compat_urllib_request.urlopen(url)
  67. return url
  68. except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err:
  69. url = None
  70. return None
  71. def _print_formats(self, formats):
  72. print('Available formats:')
  73. for fmt in formats.keys():
  74. for b in formats[fmt]:
  75. try:
  76. ext = formats[fmt][b][0]
  77. print('%s\t%s\t[%s]' % (fmt, b, ext.split('.')[-1]))
  78. except TypeError: # we have no bitrate info
  79. ext = formats[fmt][0]
  80. print('%s\t%s\t[%s]' % (fmt, '??', ext.split('.')[-1]))
  81. break
  82. def _real_extract(self, url):
  83. mobj = re.match(self._VALID_URL, url)
  84. if mobj is None:
  85. raise ExtractorError(u'Invalid URL: %s' % url)
  86. # extract uploader & filename from url
  87. uploader = mobj.group(1).decode('utf-8')
  88. file_id = uploader + "-" + mobj.group(2).decode('utf-8')
  89. # construct API request
  90. file_url = 'http://www.mixcloud.com/api/1/cloudcast/' + '/'.join(url.split('/')[-3:-1]) + '.json'
  91. # retrieve .json file with links to files
  92. request = compat_urllib_request.Request(file_url)
  93. try:
  94. self.report_download_json(file_url)
  95. jsonData = compat_urllib_request.urlopen(request).read()
  96. except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err:
  97. raise ExtractorError(u'Unable to retrieve file: %s' % compat_str(err))
  98. # parse JSON
  99. json_data = json.loads(jsonData)
  100. player_url = json_data['player_swf_url']
  101. formats = dict(json_data['audio_formats'])
  102. req_format = self._downloader.params.get('format', None)
  103. bitrate = None
  104. if self._downloader.params.get('listformats', None):
  105. self._print_formats(formats)
  106. return
  107. if req_format is None or req_format == 'best':
  108. for format_param in formats.keys():
  109. url_list = self.get_urls(formats, format_param)
  110. # check urls
  111. file_url = self.check_urls(url_list)
  112. if file_url is not None:
  113. break # got it!
  114. else:
  115. if req_format not in formats:
  116. raise ExtractorError(u'Format is not available')
  117. url_list = self.get_urls(formats, req_format)
  118. file_url = self.check_urls(url_list)
  119. format_param = req_format
  120. return [{
  121. 'id': file_id.decode('utf-8'),
  122. 'url': file_url.decode('utf-8'),
  123. 'uploader': uploader.decode('utf-8'),
  124. 'upload_date': None,
  125. 'title': json_data['name'],
  126. 'ext': file_url.split('.')[-1].decode('utf-8'),
  127. 'format': (format_param is None and u'NA' or format_param.decode('utf-8')),
  128. 'thumbnail': json_data['thumbnail_url'],
  129. 'description': json_data['description'],
  130. 'player_url': player_url.decode('utf-8'),
  131. }]
  132. class StanfordOpenClassroomIE(InfoExtractor):
  133. """Information extractor for Stanford's Open ClassRoom"""
  134. _VALID_URL = r'^(?:https?://)?openclassroom.stanford.edu(?P<path>/?|(/MainFolder/(?:HomePage|CoursePage|VideoPage)\.php([?]course=(?P<course>[^&]+)(&video=(?P<video>[^&]+))?(&.*)?)?))$'
  135. IE_NAME = u'stanfordoc'
  136. def _real_extract(self, url):
  137. mobj = re.match(self._VALID_URL, url)
  138. if mobj is None:
  139. raise ExtractorError(u'Invalid URL: %s' % url)
  140. if mobj.group('course') and mobj.group('video'): # A specific video
  141. course = mobj.group('course')
  142. video = mobj.group('video')
  143. info = {
  144. 'id': course + '_' + video,
  145. 'uploader': None,
  146. 'upload_date': None,
  147. }
  148. self.report_extraction(info['id'])
  149. baseUrl = 'http://openclassroom.stanford.edu/MainFolder/courses/' + course + '/videos/'
  150. xmlUrl = baseUrl + video + '.xml'
  151. try:
  152. metaXml = compat_urllib_request.urlopen(xmlUrl).read()
  153. except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err:
  154. raise ExtractorError(u'Unable to download video info XML: %s' % compat_str(err))
  155. mdoc = xml.etree.ElementTree.fromstring(metaXml)
  156. try:
  157. info['title'] = mdoc.findall('./title')[0].text
  158. info['url'] = baseUrl + mdoc.findall('./videoFile')[0].text
  159. except IndexError:
  160. raise ExtractorError(u'Invalid metadata XML file')
  161. info['ext'] = info['url'].rpartition('.')[2]
  162. return [info]
  163. elif mobj.group('course'): # A course page
  164. course = mobj.group('course')
  165. info = {
  166. 'id': course,
  167. 'type': 'playlist',
  168. 'uploader': None,
  169. 'upload_date': None,
  170. }
  171. coursepage = self._download_webpage(url, info['id'],
  172. note='Downloading course info page',
  173. errnote='Unable to download course info page')
  174. info['title'] = self._html_search_regex('<h1>([^<]+)</h1>', coursepage, 'title', default=info['id'])
  175. info['description'] = self._html_search_regex('<description>([^<]+)</description>',
  176. coursepage, u'description', fatal=False)
  177. links = orderedSet(re.findall('<a href="(VideoPage.php\?[^"]+)">', coursepage))
  178. info['list'] = [
  179. {
  180. 'type': 'reference',
  181. 'url': 'http://openclassroom.stanford.edu/MainFolder/' + unescapeHTML(vpage),
  182. }
  183. for vpage in links]
  184. results = []
  185. for entry in info['list']:
  186. assert entry['type'] == 'reference'
  187. results += self.extract(entry['url'])
  188. return results
  189. else: # Root page
  190. info = {
  191. 'id': 'Stanford OpenClassroom',
  192. 'type': 'playlist',
  193. 'uploader': None,
  194. 'upload_date': None,
  195. }
  196. self.report_download_webpage(info['id'])
  197. rootURL = 'http://openclassroom.stanford.edu/MainFolder/HomePage.php'
  198. try:
  199. rootpage = compat_urllib_request.urlopen(rootURL).read()
  200. except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err:
  201. raise ExtractorError(u'Unable to download course info page: ' + compat_str(err))
  202. info['title'] = info['id']
  203. links = orderedSet(re.findall('<a href="(CoursePage.php\?[^"]+)">', rootpage))
  204. info['list'] = [
  205. {
  206. 'type': 'reference',
  207. 'url': 'http://openclassroom.stanford.edu/MainFolder/' + unescapeHTML(cpage),
  208. }
  209. for cpage in links]
  210. results = []
  211. for entry in info['list']:
  212. assert entry['type'] == 'reference'
  213. results += self.extract(entry['url'])
  214. return results
  215. class MTVIE(InfoExtractor):
  216. """Information extractor for MTV.com"""
  217. _VALID_URL = r'^(?P<proto>https?://)?(?:www\.)?mtv\.com/videos/[^/]+/(?P<videoid>[0-9]+)/[^/]+$'
  218. IE_NAME = u'mtv'
  219. def _real_extract(self, url):
  220. mobj = re.match(self._VALID_URL, url)
  221. if mobj is None:
  222. raise ExtractorError(u'Invalid URL: %s' % url)
  223. if not mobj.group('proto'):
  224. url = 'http://' + url
  225. video_id = mobj.group('videoid')
  226. webpage = self._download_webpage(url, video_id)
  227. song_name = self._html_search_regex(r'<meta name="mtv_vt" content="([^"]+)"/>',
  228. webpage, u'song name', fatal=False)
  229. video_title = self._html_search_regex(r'<meta name="mtv_an" content="([^"]+)"/>',
  230. webpage, u'title')
  231. mtvn_uri = self._html_search_regex(r'<meta name="mtvn_uri" content="([^"]+)"/>',
  232. webpage, u'mtvn_uri', fatal=False)
  233. content_id = self._search_regex(r'MTVN.Player.defaultPlaylistId = ([0-9]+);',
  234. webpage, u'content id', fatal=False)
  235. videogen_url = 'http://www.mtv.com/player/includes/mediaGen.jhtml?uri=' + mtvn_uri + '&id=' + content_id + '&vid=' + video_id + '&ref=www.mtvn.com&viewUri=' + mtvn_uri
  236. self.report_extraction(video_id)
  237. request = compat_urllib_request.Request(videogen_url)
  238. try:
  239. metadataXml = compat_urllib_request.urlopen(request).read()
  240. except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err:
  241. raise ExtractorError(u'Unable to download video metadata: %s' % compat_str(err))
  242. mdoc = xml.etree.ElementTree.fromstring(metadataXml)
  243. renditions = mdoc.findall('.//rendition')
  244. # For now, always pick the highest quality.
  245. rendition = renditions[-1]
  246. try:
  247. _,_,ext = rendition.attrib['type'].partition('/')
  248. format = ext + '-' + rendition.attrib['width'] + 'x' + rendition.attrib['height'] + '_' + rendition.attrib['bitrate']
  249. video_url = rendition.find('./src').text
  250. except KeyError:
  251. raise ExtractorError('Invalid rendition field.')
  252. info = {
  253. 'id': video_id,
  254. 'url': video_url,
  255. 'uploader': performer,
  256. 'upload_date': None,
  257. 'title': video_title,
  258. 'ext': ext,
  259. 'format': format,
  260. }
  261. return [info]
  262. class YoukuIE(InfoExtractor):
  263. _VALID_URL = r'(?:http://)?v\.youku\.com/v_show/id_(?P<ID>[A-Za-z0-9]+)\.html'
  264. def _gen_sid(self):
  265. nowTime = int(time.time() * 1000)
  266. random1 = random.randint(1000,1998)
  267. random2 = random.randint(1000,9999)
  268. return "%d%d%d" %(nowTime,random1,random2)
  269. def _get_file_ID_mix_string(self, seed):
  270. mixed = []
  271. source = list("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/\:._-1234567890")
  272. seed = float(seed)
  273. for i in range(len(source)):
  274. seed = (seed * 211 + 30031 ) % 65536
  275. index = math.floor(seed / 65536 * len(source) )
  276. mixed.append(source[int(index)])
  277. source.remove(source[int(index)])
  278. #return ''.join(mixed)
  279. return mixed
  280. def _get_file_id(self, fileId, seed):
  281. mixed = self._get_file_ID_mix_string(seed)
  282. ids = fileId.split('*')
  283. realId = []
  284. for ch in ids:
  285. if ch:
  286. realId.append(mixed[int(ch)])
  287. return ''.join(realId)
  288. def _real_extract(self, url):
  289. mobj = re.match(self._VALID_URL, url)
  290. if mobj is None:
  291. raise ExtractorError(u'Invalid URL: %s' % url)
  292. video_id = mobj.group('ID')
  293. info_url = 'http://v.youku.com/player/getPlayList/VideoIDS/' + video_id
  294. jsondata = self._download_webpage(info_url, video_id)
  295. self.report_extraction(video_id)
  296. try:
  297. config = json.loads(jsondata)
  298. video_title = config['data'][0]['title']
  299. seed = config['data'][0]['seed']
  300. format = self._downloader.params.get('format', None)
  301. supported_format = list(config['data'][0]['streamfileids'].keys())
  302. if format is None or format == 'best':
  303. if 'hd2' in supported_format:
  304. format = 'hd2'
  305. else:
  306. format = 'flv'
  307. ext = u'flv'
  308. elif format == 'worst':
  309. format = 'mp4'
  310. ext = u'mp4'
  311. else:
  312. format = 'flv'
  313. ext = u'flv'
  314. fileid = config['data'][0]['streamfileids'][format]
  315. keys = [s['k'] for s in config['data'][0]['segs'][format]]
  316. except (UnicodeDecodeError, ValueError, KeyError):
  317. raise ExtractorError(u'Unable to extract info section')
  318. files_info=[]
  319. sid = self._gen_sid()
  320. fileid = self._get_file_id(fileid, seed)
  321. #column 8,9 of fileid represent the segment number
  322. #fileid[7:9] should be changed
  323. for index, key in enumerate(keys):
  324. temp_fileid = '%s%02X%s' % (fileid[0:8], index, fileid[10:])
  325. download_url = 'http://f.youku.com/player/getFlvPath/sid/%s_%02X/st/flv/fileid/%s?k=%s' % (sid, index, temp_fileid, key)
  326. info = {
  327. 'id': '%s_part%02d' % (video_id, index),
  328. 'url': download_url,
  329. 'uploader': None,
  330. 'upload_date': None,
  331. 'title': video_title,
  332. 'ext': ext,
  333. }
  334. files_info.append(info)
  335. return files_info
  336. class XNXXIE(InfoExtractor):
  337. """Information extractor for xnxx.com"""
  338. _VALID_URL = r'^(?:https?://)?video\.xnxx\.com/video([0-9]+)/(.*)'
  339. IE_NAME = u'xnxx'
  340. VIDEO_URL_RE = r'flv_url=(.*?)&amp;'
  341. VIDEO_TITLE_RE = r'<title>(.*?)\s+-\s+XNXX.COM'
  342. VIDEO_THUMB_RE = r'url_bigthumb=(.*?)&amp;'
  343. def _real_extract(self, url):
  344. mobj = re.match(self._VALID_URL, url)
  345. if mobj is None:
  346. raise ExtractorError(u'Invalid URL: %s' % url)
  347. video_id = mobj.group(1)
  348. # Get webpage content
  349. webpage = self._download_webpage(url, video_id)
  350. video_url = self._search_regex(self.VIDEO_URL_RE,
  351. webpage, u'video URL')
  352. video_url = compat_urllib_parse.unquote(video_url)
  353. video_title = self._html_search_regex(self.VIDEO_TITLE_RE,
  354. webpage, u'title')
  355. video_thumbnail = self._search_regex(self.VIDEO_THUMB_RE,
  356. webpage, u'thumbnail', fatal=False)
  357. return [{
  358. 'id': video_id,
  359. 'url': video_url,
  360. 'uploader': None,
  361. 'upload_date': None,
  362. 'title': video_title,
  363. 'ext': 'flv',
  364. 'thumbnail': video_thumbnail,
  365. 'description': None,
  366. }]
  367. class NBAIE(InfoExtractor):
  368. _VALID_URL = r'^(?:https?://)?(?:watch\.|www\.)?nba\.com/(?:nba/)?video(/[^?]*?)(?:/index\.html)?(?:\?.*)?$'
  369. IE_NAME = u'nba'
  370. def _real_extract(self, url):
  371. mobj = re.match(self._VALID_URL, url)
  372. if mobj is None:
  373. raise ExtractorError(u'Invalid URL: %s' % url)
  374. video_id = mobj.group(1)
  375. webpage = self._download_webpage(url, video_id)
  376. video_url = u'http://ht-mobile.cdn.turner.com/nba/big' + video_id + '_nba_1280x720.mp4'
  377. shortened_video_id = video_id.rpartition('/')[2]
  378. title = self._html_search_regex(r'<meta property="og:title" content="(.*?)"',
  379. webpage, 'title', default=shortened_video_id).replace('NBA.com: ', '')
  380. # It isn't there in the HTML it returns to us
  381. # uploader_date = self._html_search_regex(r'<b>Date:</b> (.*?)</div>', webpage, 'upload_date', fatal=False)
  382. description = self._html_search_regex(r'<meta name="description" (?:content|value)="(.*?)" />', webpage, 'description', fatal=False)
  383. info = {
  384. 'id': shortened_video_id,
  385. 'url': video_url,
  386. 'ext': 'mp4',
  387. 'title': title,
  388. # 'uploader_date': uploader_date,
  389. 'description': description,
  390. }
  391. return [info]
  392. class JustinTVIE(InfoExtractor):
  393. """Information extractor for justin.tv and twitch.tv"""
  394. # TODO: One broadcast may be split into multiple videos. The key
  395. # 'broadcast_id' is the same for all parts, and 'broadcast_part'
  396. # starts at 1 and increases. Can we treat all parts as one video?
  397. _VALID_URL = r"""(?x)^(?:http://)?(?:www\.)?(?:twitch|justin)\.tv/
  398. (?:
  399. (?P<channelid>[^/]+)|
  400. (?:(?:[^/]+)/b/(?P<videoid>[^/]+))|
  401. (?:(?:[^/]+)/c/(?P<chapterid>[^/]+))
  402. )
  403. /?(?:\#.*)?$
  404. """
  405. _JUSTIN_PAGE_LIMIT = 100
  406. IE_NAME = u'justin.tv'
  407. def report_download_page(self, channel, offset):
  408. """Report attempt to download a single page of videos."""
  409. self.to_screen(u'%s: Downloading video information from %d to %d' %
  410. (channel, offset, offset + self._JUSTIN_PAGE_LIMIT))
  411. # Return count of items, list of *valid* items
  412. def _parse_page(self, url, video_id):
  413. webpage = self._download_webpage(url, video_id,
  414. u'Downloading video info JSON',
  415. u'unable to download video info JSON')
  416. response = json.loads(webpage)
  417. if type(response) != list:
  418. error_text = response.get('error', 'unknown error')
  419. raise ExtractorError(u'Justin.tv API: %s' % error_text)
  420. info = []
  421. for clip in response:
  422. video_url = clip['video_file_url']
  423. if video_url:
  424. video_extension = os.path.splitext(video_url)[1][1:]
  425. video_date = re.sub('-', '', clip['start_time'][:10])
  426. video_uploader_id = clip.get('user_id', clip.get('channel_id'))
  427. video_id = clip['id']
  428. video_title = clip.get('title', video_id)
  429. info.append({
  430. 'id': video_id,
  431. 'url': video_url,
  432. 'title': video_title,
  433. 'uploader': clip.get('channel_name', video_uploader_id),
  434. 'uploader_id': video_uploader_id,
  435. 'upload_date': video_date,
  436. 'ext': video_extension,
  437. })
  438. return (len(response), info)
  439. def _real_extract(self, url):
  440. mobj = re.match(self._VALID_URL, url)
  441. if mobj is None:
  442. raise ExtractorError(u'invalid URL: %s' % url)
  443. api_base = 'http://api.justin.tv'
  444. paged = False
  445. if mobj.group('channelid'):
  446. paged = True
  447. video_id = mobj.group('channelid')
  448. api = api_base + '/channel/archives/%s.json' % video_id
  449. elif mobj.group('chapterid'):
  450. chapter_id = mobj.group('chapterid')
  451. webpage = self._download_webpage(url, chapter_id)
  452. m = re.search(r'PP\.archive_id = "([0-9]+)";', webpage)
  453. if not m:
  454. raise ExtractorError(u'Cannot find archive of a chapter')
  455. archive_id = m.group(1)
  456. api = api_base + '/broadcast/by_chapter/%s.xml' % chapter_id
  457. chapter_info_xml = self._download_webpage(api, chapter_id,
  458. note=u'Downloading chapter information',
  459. errnote=u'Chapter information download failed')
  460. doc = xml.etree.ElementTree.fromstring(chapter_info_xml)
  461. for a in doc.findall('.//archive'):
  462. if archive_id == a.find('./id').text:
  463. break
  464. else:
  465. raise ExtractorError(u'Could not find chapter in chapter information')
  466. video_url = a.find('./video_file_url').text
  467. video_ext = video_url.rpartition('.')[2] or u'flv'
  468. chapter_api_url = u'https://api.twitch.tv/kraken/videos/c' + chapter_id
  469. chapter_info_json = self._download_webpage(chapter_api_url, u'c' + chapter_id,
  470. note='Downloading chapter metadata',
  471. errnote='Download of chapter metadata failed')
  472. chapter_info = json.loads(chapter_info_json)
  473. bracket_start = int(doc.find('.//bracket_start').text)
  474. bracket_end = int(doc.find('.//bracket_end').text)
  475. # TODO determine start (and probably fix up file)
  476. # youtube-dl -v http://www.twitch.tv/firmbelief/c/1757457
  477. #video_url += u'?start=' + TODO:start_timestamp
  478. # bracket_start is 13290, but we want 51670615
  479. self._downloader.report_warning(u'Chapter detected, but we can just download the whole file. '
  480. u'Chapter starts at %s and ends at %s' % (formatSeconds(bracket_start), formatSeconds(bracket_end)))
  481. info = {
  482. 'id': u'c' + chapter_id,
  483. 'url': video_url,
  484. 'ext': video_ext,
  485. 'title': chapter_info['title'],
  486. 'thumbnail': chapter_info['preview'],
  487. 'description': chapter_info['description'],
  488. 'uploader': chapter_info['channel']['display_name'],
  489. 'uploader_id': chapter_info['channel']['name'],
  490. }
  491. return [info]
  492. else:
  493. video_id = mobj.group('videoid')
  494. api = api_base + '/broadcast/by_archive/%s.json' % video_id
  495. self.report_extraction(video_id)
  496. info = []
  497. offset = 0
  498. limit = self._JUSTIN_PAGE_LIMIT
  499. while True:
  500. if paged:
  501. self.report_download_page(video_id, offset)
  502. page_url = api + ('?offset=%d&limit=%d' % (offset, limit))
  503. page_count, page_info = self._parse_page(page_url, video_id)
  504. info.extend(page_info)
  505. if not paged or page_count != limit:
  506. break
  507. offset += limit
  508. return info
  509. class FunnyOrDieIE(InfoExtractor):
  510. _VALID_URL = r'^(?:https?://)?(?:www\.)?funnyordie\.com/videos/(?P<id>[0-9a-f]+)/.*$'
  511. def _real_extract(self, url):
  512. mobj = re.match(self._VALID_URL, url)
  513. if mobj is None:
  514. raise ExtractorError(u'invalid URL: %s' % url)
  515. video_id = mobj.group('id')
  516. webpage = self._download_webpage(url, video_id)
  517. video_url = self._html_search_regex(r'<video[^>]*>\s*<source[^>]*>\s*<source src="(?P<url>[^"]+)"',
  518. webpage, u'video URL', flags=re.DOTALL)
  519. title = self._html_search_regex((r"<h1 class='player_page_h1'.*?>(?P<title>.*?)</h1>",
  520. r'<title>(?P<title>[^<]+?)</title>'), webpage, 'title', flags=re.DOTALL)
  521. video_description = self._html_search_regex(r'<meta property="og:description" content="(?P<desc>.*?)"',
  522. webpage, u'description', fatal=False, flags=re.DOTALL)
  523. info = {
  524. 'id': video_id,
  525. 'url': video_url,
  526. 'ext': 'mp4',
  527. 'title': title,
  528. 'description': video_description,
  529. }
  530. return [info]
  531. class SteamIE(InfoExtractor):
  532. _VALID_URL = r"""http://store\.steampowered\.com/
  533. (agecheck/)?
  534. (?P<urltype>video|app)/ #If the page is only for videos or for a game
  535. (?P<gameID>\d+)/?
  536. (?P<videoID>\d*)(?P<extra>\??) #For urltype == video we sometimes get the videoID
  537. """
  538. _VIDEO_PAGE_TEMPLATE = 'http://store.steampowered.com/video/%s/'
  539. _AGECHECK_TEMPLATE = 'http://store.steampowered.com/agecheck/video/%s/?snr=1_agecheck_agecheck__age-gate&ageDay=1&ageMonth=January&ageYear=1970'
  540. @classmethod
  541. def suitable(cls, url):
  542. """Receives a URL and returns True if suitable for this IE."""
  543. return re.match(cls._VALID_URL, url, re.VERBOSE) is not None
  544. def _real_extract(self, url):
  545. m = re.match(self._VALID_URL, url, re.VERBOSE)
  546. gameID = m.group('gameID')
  547. videourl = self._VIDEO_PAGE_TEMPLATE % gameID
  548. webpage = self._download_webpage(videourl, gameID)
  549. if re.search('<h2>Please enter your birth date to continue:</h2>', webpage) is not None:
  550. videourl = self._AGECHECK_TEMPLATE % gameID
  551. self.report_age_confirmation()
  552. webpage = self._download_webpage(videourl, gameID)
  553. self.report_extraction(gameID)
  554. game_title = self._html_search_regex(r'<h2 class="pageheader">(.*?)</h2>',
  555. webpage, 'game title')
  556. urlRE = r"'movie_(?P<videoID>\d+)': \{\s*FILENAME: \"(?P<videoURL>[\w:/\.\?=]+)\"(,\s*MOVIE_NAME: \"(?P<videoName>[\w:/\.\?=\+-]+)\")?\s*\},"
  557. mweb = re.finditer(urlRE, webpage)
  558. namesRE = r'<span class="title">(?P<videoName>.+?)</span>'
  559. titles = re.finditer(namesRE, webpage)
  560. thumbsRE = r'<img class="movie_thumb" src="(?P<thumbnail>.+?)">'
  561. thumbs = re.finditer(thumbsRE, webpage)
  562. videos = []
  563. for vid,vtitle,thumb in zip(mweb,titles,thumbs):
  564. video_id = vid.group('videoID')
  565. title = vtitle.group('videoName')
  566. video_url = vid.group('videoURL')
  567. video_thumb = thumb.group('thumbnail')
  568. if not video_url:
  569. raise ExtractorError(u'Cannot find video url for %s' % video_id)
  570. info = {
  571. 'id':video_id,
  572. 'url':video_url,
  573. 'ext': 'flv',
  574. 'title': unescapeHTML(title),
  575. 'thumbnail': video_thumb
  576. }
  577. videos.append(info)
  578. return [self.playlist_result(videos, gameID, game_title)]
  579. class UstreamIE(InfoExtractor):
  580. _VALID_URL = r'https?://www\.ustream\.tv/recorded/(?P<videoID>\d+)'
  581. IE_NAME = u'ustream'
  582. def _real_extract(self, url):
  583. m = re.match(self._VALID_URL, url)
  584. video_id = m.group('videoID')
  585. video_url = u'http://tcdn.ustream.tv/video/%s' % video_id
  586. webpage = self._download_webpage(url, video_id)
  587. self.report_extraction(video_id)
  588. video_title = self._html_search_regex(r'data-title="(?P<title>.+)"',
  589. webpage, u'title')
  590. uploader = self._html_search_regex(r'data-content-type="channel".*?>(?P<uploader>.*?)</a>',
  591. webpage, u'uploader', fatal=False, flags=re.DOTALL)
  592. thumbnail = self._html_search_regex(r'<link rel="image_src" href="(?P<thumb>.*?)"',
  593. webpage, u'thumbnail', fatal=False)
  594. info = {
  595. 'id': video_id,
  596. 'url': video_url,
  597. 'ext': 'flv',
  598. 'title': video_title,
  599. 'uploader': uploader,
  600. 'thumbnail': thumbnail,
  601. }
  602. return info
  603. class WorldStarHipHopIE(InfoExtractor):
  604. _VALID_URL = r'https?://(?:www|m)\.worldstar(?:candy|hiphop)\.com/videos/video\.php\?v=(?P<id>.*)'
  605. IE_NAME = u'WorldStarHipHop'
  606. def _real_extract(self, url):
  607. m = re.match(self._VALID_URL, url)
  608. video_id = m.group('id')
  609. webpage_src = self._download_webpage(url, video_id)
  610. video_url = self._search_regex(r'so\.addVariable\("file","(.*?)"\)',
  611. webpage_src, u'video URL')
  612. if 'mp4' in video_url:
  613. ext = 'mp4'
  614. else:
  615. ext = 'flv'
  616. video_title = self._html_search_regex(r"<title>(.*)</title>",
  617. webpage_src, u'title')
  618. # Getting thumbnail and if not thumbnail sets correct title for WSHH candy video.
  619. thumbnail = self._html_search_regex(r'rel="image_src" href="(.*)" />',
  620. webpage_src, u'thumbnail', fatal=False)
  621. if not thumbnail:
  622. _title = r"""candytitles.*>(.*)</span>"""
  623. mobj = re.search(_title, webpage_src)
  624. if mobj is not None:
  625. video_title = mobj.group(1)
  626. results = [{
  627. 'id': video_id,
  628. 'url' : video_url,
  629. 'title' : video_title,
  630. 'thumbnail' : thumbnail,
  631. 'ext' : ext,
  632. }]
  633. return results
  634. class RBMARadioIE(InfoExtractor):
  635. _VALID_URL = r'https?://(?:www\.)?rbmaradio\.com/shows/(?P<videoID>[^/]+)$'
  636. def _real_extract(self, url):
  637. m = re.match(self._VALID_URL, url)
  638. video_id = m.group('videoID')
  639. webpage = self._download_webpage(url, video_id)
  640. json_data = self._search_regex(r'window\.gon.*?gon\.show=(.+?);$',
  641. webpage, u'json data', flags=re.MULTILINE)
  642. try:
  643. data = json.loads(json_data)
  644. except ValueError as e:
  645. raise ExtractorError(u'Invalid JSON: ' + str(e))
  646. video_url = data['akamai_url'] + '&cbr=256'
  647. url_parts = compat_urllib_parse_urlparse(video_url)
  648. video_ext = url_parts.path.rpartition('.')[2]
  649. info = {
  650. 'id': video_id,
  651. 'url': video_url,
  652. 'ext': video_ext,
  653. 'title': data['title'],
  654. 'description': data.get('teaser_text'),
  655. 'location': data.get('country_of_origin'),
  656. 'uploader': data.get('host', {}).get('name'),
  657. 'uploader_id': data.get('host', {}).get('slug'),
  658. 'thumbnail': data.get('image', {}).get('large_url_2x'),
  659. 'duration': data.get('duration'),
  660. }
  661. return [info]
  662. class YouPornIE(InfoExtractor):
  663. """Information extractor for youporn.com."""
  664. _VALID_URL = r'^(?:https?://)?(?:\w+\.)?youporn\.com/watch/(?P<videoid>[0-9]+)/(?P<title>[^/]+)'
  665. def _print_formats(self, formats):
  666. """Print all available formats"""
  667. print(u'Available formats:')
  668. print(u'ext\t\tformat')
  669. print(u'---------------------------------')
  670. for format in formats:
  671. print(u'%s\t\t%s' % (format['ext'], format['format']))
  672. def _specific(self, req_format, formats):
  673. for x in formats:
  674. if(x["format"]==req_format):
  675. return x
  676. return None
  677. def _real_extract(self, url):
  678. mobj = re.match(self._VALID_URL, url)
  679. if mobj is None:
  680. raise ExtractorError(u'Invalid URL: %s' % url)
  681. video_id = mobj.group('videoid')
  682. req = compat_urllib_request.Request(url)
  683. req.add_header('Cookie', 'age_verified=1')
  684. webpage = self._download_webpage(req, video_id)
  685. # Get JSON parameters
  686. json_params = self._search_regex(r'var currentVideo = new Video\((.*)\);', webpage, u'JSON parameters')
  687. try:
  688. params = json.loads(json_params)
  689. except:
  690. raise ExtractorError(u'Invalid JSON')
  691. self.report_extraction(video_id)
  692. try:
  693. video_title = params['title']
  694. upload_date = unified_strdate(params['release_date_f'])
  695. video_description = params['description']
  696. video_uploader = params['submitted_by']
  697. thumbnail = params['thumbnails'][0]['image']
  698. except KeyError:
  699. raise ExtractorError('Missing JSON parameter: ' + sys.exc_info()[1])
  700. # Get all of the formats available
  701. DOWNLOAD_LIST_RE = r'(?s)<ul class="downloadList">(?P<download_list>.*?)</ul>'
  702. download_list_html = self._search_regex(DOWNLOAD_LIST_RE,
  703. webpage, u'download list').strip()
  704. # Get all of the links from the page
  705. LINK_RE = r'(?s)<a href="(?P<url>[^"]+)">'
  706. links = re.findall(LINK_RE, download_list_html)
  707. if(len(links) == 0):
  708. raise ExtractorError(u'ERROR: no known formats available for video')
  709. self.to_screen(u'Links found: %d' % len(links))
  710. formats = []
  711. for link in links:
  712. # A link looks like this:
  713. # http://cdn1.download.youporn.phncdn.com/201210/31/8004515/480p_370k_8004515/YouPorn%20-%20Nubile%20Films%20The%20Pillow%20Fight.mp4?nvb=20121113051249&nva=20121114051249&ir=1200&sr=1200&hash=014b882080310e95fb6a0
  714. # A path looks like this:
  715. # /201210/31/8004515/480p_370k_8004515/YouPorn%20-%20Nubile%20Films%20The%20Pillow%20Fight.mp4
  716. video_url = unescapeHTML( link )
  717. path = compat_urllib_parse_urlparse( video_url ).path
  718. extension = os.path.splitext( path )[1][1:]
  719. format = path.split('/')[4].split('_')[:2]
  720. size = format[0]
  721. bitrate = format[1]
  722. format = "-".join( format )
  723. # title = u'%s-%s-%s' % (video_title, size, bitrate)
  724. formats.append({
  725. 'id': video_id,
  726. 'url': video_url,
  727. 'uploader': video_uploader,
  728. 'upload_date': upload_date,
  729. 'title': video_title,
  730. 'ext': extension,
  731. 'format': format,
  732. 'thumbnail': thumbnail,
  733. 'description': video_description
  734. })
  735. if self._downloader.params.get('listformats', None):
  736. self._print_formats(formats)
  737. return
  738. req_format = self._downloader.params.get('format', None)
  739. self.to_screen(u'Format: %s' % req_format)
  740. if req_format is None or req_format == 'best':
  741. return [formats[0]]
  742. elif req_format == 'worst':
  743. return [formats[-1]]
  744. elif req_format in ('-1', 'all'):
  745. return formats
  746. else:
  747. format = self._specific( req_format, formats )
  748. if result is None:
  749. raise ExtractorError(u'Requested format not available')
  750. return [format]
  751. class PornotubeIE(InfoExtractor):
  752. """Information extractor for pornotube.com."""
  753. _VALID_URL = r'^(?:https?://)?(?:\w+\.)?pornotube\.com(/c/(?P<channel>[0-9]+))?(/m/(?P<videoid>[0-9]+))(/(?P<title>.+))$'
  754. def _real_extract(self, url):
  755. mobj = re.match(self._VALID_URL, url)
  756. if mobj is None:
  757. raise ExtractorError(u'Invalid URL: %s' % url)
  758. video_id = mobj.group('videoid')
  759. video_title = mobj.group('title')
  760. # Get webpage content
  761. webpage = self._download_webpage(url, video_id)
  762. # Get the video URL
  763. VIDEO_URL_RE = r'url: "(?P<url>http://video[0-9].pornotube.com/.+\.flv)",'
  764. video_url = self._search_regex(VIDEO_URL_RE, webpage, u'video url')
  765. video_url = compat_urllib_parse.unquote(video_url)
  766. #Get the uploaded date
  767. VIDEO_UPLOADED_RE = r'<div class="video_added_by">Added (?P<date>[0-9\/]+) by'
  768. upload_date = self._html_search_regex(VIDEO_UPLOADED_RE, webpage, u'upload date', fatal=False)
  769. if upload_date: upload_date = unified_strdate(upload_date)
  770. info = {'id': video_id,
  771. 'url': video_url,
  772. 'uploader': None,
  773. 'upload_date': upload_date,
  774. 'title': video_title,
  775. 'ext': 'flv',
  776. 'format': 'flv'}
  777. return [info]
  778. class YouJizzIE(InfoExtractor):
  779. """Information extractor for youjizz.com."""
  780. _VALID_URL = r'^(?:https?://)?(?:\w+\.)?youjizz\.com/videos/(?P<videoid>[^.]+).html$'
  781. def _real_extract(self, url):
  782. mobj = re.match(self._VALID_URL, url)
  783. if mobj is None:
  784. raise ExtractorError(u'Invalid URL: %s' % url)
  785. video_id = mobj.group('videoid')
  786. # Get webpage content
  787. webpage = self._download_webpage(url, video_id)
  788. # Get the video title
  789. video_title = self._html_search_regex(r'<title>(?P<title>.*)</title>',
  790. webpage, u'title').strip()
  791. # Get the embed page
  792. result = re.search(r'https?://www.youjizz.com/videos/embed/(?P<videoid>[0-9]+)', webpage)
  793. if result is None:
  794. raise ExtractorError(u'ERROR: unable to extract embed page')
  795. embed_page_url = result.group(0).strip()
  796. video_id = result.group('videoid')
  797. webpage = self._download_webpage(embed_page_url, video_id)
  798. # Get the video URL
  799. video_url = self._search_regex(r'so.addVariable\("file",encodeURIComponent\("(?P<source>[^"]+)"\)\);',
  800. webpage, u'video URL')
  801. info = {'id': video_id,
  802. 'url': video_url,
  803. 'title': video_title,
  804. 'ext': 'flv',
  805. 'format': 'flv',
  806. 'player_url': embed_page_url}
  807. return [info]
  808. class EightTracksIE(InfoExtractor):
  809. IE_NAME = '8tracks'
  810. _VALID_URL = r'https?://8tracks.com/(?P<user>[^/]+)/(?P<id>[^/#]+)(?:#.*)?$'
  811. def _real_extract(self, url):
  812. mobj = re.match(self._VALID_URL, url)
  813. if mobj is None:
  814. raise ExtractorError(u'Invalid URL: %s' % url)
  815. playlist_id = mobj.group('id')
  816. webpage = self._download_webpage(url, playlist_id)
  817. json_like = self._search_regex(r"PAGE.mix = (.*?);\n", webpage, u'trax information', flags=re.DOTALL)
  818. data = json.loads(json_like)
  819. session = str(random.randint(0, 1000000000))
  820. mix_id = data['id']
  821. track_count = data['tracks_count']
  822. first_url = 'http://8tracks.com/sets/%s/play?player=sm&mix_id=%s&format=jsonh' % (session, mix_id)
  823. next_url = first_url
  824. res = []
  825. for i in itertools.count():
  826. api_json = self._download_webpage(next_url, playlist_id,
  827. note=u'Downloading song information %s/%s' % (str(i+1), track_count),
  828. errnote=u'Failed to download song information')
  829. api_data = json.loads(api_json)
  830. track_data = api_data[u'set']['track']
  831. info = {
  832. 'id': track_data['id'],
  833. 'url': track_data['track_file_stream_url'],
  834. 'title': track_data['performer'] + u' - ' + track_data['name'],
  835. 'raw_title': track_data['name'],
  836. 'uploader_id': data['user']['login'],
  837. 'ext': 'm4a',
  838. }
  839. res.append(info)
  840. if api_data['set']['at_last_track']:
  841. break
  842. next_url = 'http://8tracks.com/sets/%s/next?player=sm&mix_id=%s&format=jsonh&track_id=%s' % (session, mix_id, track_data['id'])
  843. return res
  844. class KeekIE(InfoExtractor):
  845. _VALID_URL = r'http://(?:www\.)?keek\.com/(?:!|\w+/keeks/)(?P<videoID>\w+)'
  846. IE_NAME = u'keek'
  847. def _real_extract(self, url):
  848. m = re.match(self._VALID_URL, url)
  849. video_id = m.group('videoID')
  850. video_url = u'http://cdn.keek.com/keek/video/%s' % video_id
  851. thumbnail = u'http://cdn.keek.com/keek/thumbnail/%s/w100/h75' % video_id
  852. webpage = self._download_webpage(url, video_id)
  853. video_title = self._html_search_regex(r'<meta property="og:title" content="(?P<title>.*?)"',
  854. webpage, u'title')
  855. uploader = self._html_search_regex(r'<div class="user-name-and-bio">[\S\s]+?<h2>(?P<uploader>.+?)</h2>',
  856. webpage, u'uploader', fatal=False)
  857. info = {
  858. 'id': video_id,
  859. 'url': video_url,
  860. 'ext': 'mp4',
  861. 'title': video_title,
  862. 'thumbnail': thumbnail,
  863. 'uploader': uploader
  864. }
  865. return [info]
  866. class TEDIE(InfoExtractor):
  867. _VALID_URL=r'''http://www\.ted\.com/
  868. (
  869. ((?P<type_playlist>playlists)/(?P<playlist_id>\d+)) # We have a playlist
  870. |
  871. ((?P<type_talk>talks)) # We have a simple talk
  872. )
  873. (/lang/(.*?))? # The url may contain the language
  874. /(?P<name>\w+) # Here goes the name and then ".html"
  875. '''
  876. @classmethod
  877. def suitable(cls, url):
  878. """Receives a URL and returns True if suitable for this IE."""
  879. return re.match(cls._VALID_URL, url, re.VERBOSE) is not None
  880. def _real_extract(self, url):
  881. m=re.match(self._VALID_URL, url, re.VERBOSE)
  882. if m.group('type_talk'):
  883. return [self._talk_info(url)]
  884. else :
  885. playlist_id=m.group('playlist_id')
  886. name=m.group('name')
  887. self.to_screen(u'Getting info of playlist %s: "%s"' % (playlist_id,name))
  888. return [self._playlist_videos_info(url,name,playlist_id)]
  889. def _playlist_videos_info(self,url,name,playlist_id=0):
  890. '''Returns the videos of the playlist'''
  891. video_RE=r'''
  892. <li\ id="talk_(\d+)"([.\s]*?)data-id="(?P<video_id>\d+)"
  893. ([.\s]*?)data-playlist_item_id="(\d+)"
  894. ([.\s]*?)data-mediaslug="(?P<mediaSlug>.+?)"
  895. '''
  896. video_name_RE=r'<p\ class="talk-title"><a href="(?P<talk_url>/talks/(.+).html)">(?P<fullname>.+?)</a></p>'
  897. webpage=self._download_webpage(url, playlist_id, 'Downloading playlist webpage')
  898. m_videos=re.finditer(video_RE,webpage,re.VERBOSE)
  899. m_names=re.finditer(video_name_RE,webpage)
  900. playlist_title = self._html_search_regex(r'div class="headline">\s*?<h1>\s*?<span>(.*?)</span>',
  901. webpage, 'playlist title')
  902. playlist_entries = []
  903. for m_video, m_name in zip(m_videos,m_names):
  904. video_id=m_video.group('video_id')
  905. talk_url='http://www.ted.com%s' % m_name.group('talk_url')
  906. playlist_entries.append(self.url_result(talk_url, 'TED'))
  907. return self.playlist_result(playlist_entries, playlist_id = playlist_id, playlist_title = playlist_title)
  908. def _talk_info(self, url, video_id=0):
  909. """Return the video for the talk in the url"""
  910. m = re.match(self._VALID_URL, url,re.VERBOSE)
  911. video_name = m.group('name')
  912. webpage = self._download_webpage(url, video_id, 'Downloading \"%s\" page' % video_name)
  913. self.report_extraction(video_name)
  914. # If the url includes the language we get the title translated
  915. title = self._html_search_regex(r'<span id="altHeadline" >(?P<title>.*)</span>',
  916. webpage, 'title')
  917. json_data = self._search_regex(r'<script.*?>var talkDetails = ({.*?})</script>',
  918. webpage, 'json data')
  919. info = json.loads(json_data)
  920. desc = self._html_search_regex(r'<div class="talk-intro">.*?<p.*?>(.*?)</p>',
  921. webpage, 'description', flags = re.DOTALL)
  922. thumbnail = self._search_regex(r'</span>[\s.]*</div>[\s.]*<img src="(.*?)"',
  923. webpage, 'thumbnail')
  924. info = {
  925. 'id': info['id'],
  926. 'url': info['htmlStreams'][-1]['file'],
  927. 'ext': 'mp4',
  928. 'title': title,
  929. 'thumbnail': thumbnail,
  930. 'description': desc,
  931. }
  932. return info
  933. class MySpassIE(InfoExtractor):
  934. _VALID_URL = r'http://www.myspass.de/.*'
  935. def _real_extract(self, url):
  936. META_DATA_URL_TEMPLATE = 'http://www.myspass.de/myspass/includes/apps/video/getvideometadataxml.php?id=%s'
  937. # video id is the last path element of the URL
  938. # usually there is a trailing slash, so also try the second but last
  939. url_path = compat_urllib_parse_urlparse(url).path
  940. url_parent_path, video_id = os.path.split(url_path)
  941. if not video_id:
  942. _, video_id = os.path.split(url_parent_path)
  943. # get metadata
  944. metadata_url = META_DATA_URL_TEMPLATE % video_id
  945. metadata_text = self._download_webpage(metadata_url, video_id)
  946. metadata = xml.etree.ElementTree.fromstring(metadata_text.encode('utf-8'))
  947. # extract values from metadata
  948. url_flv_el = metadata.find('url_flv')
  949. if url_flv_el is None:
  950. raise ExtractorError(u'Unable to extract download url')
  951. video_url = url_flv_el.text
  952. extension = os.path.splitext(video_url)[1][1:]
  953. title_el = metadata.find('title')
  954. if title_el is None:
  955. raise ExtractorError(u'Unable to extract title')
  956. title = title_el.text
  957. format_id_el = metadata.find('format_id')
  958. if format_id_el is None:
  959. format = ext
  960. else:
  961. format = format_id_el.text
  962. description_el = metadata.find('description')
  963. if description_el is not None:
  964. description = description_el.text
  965. else:
  966. description = None
  967. imagePreview_el = metadata.find('imagePreview')
  968. if imagePreview_el is not None:
  969. thumbnail = imagePreview_el.text
  970. else:
  971. thumbnail = None
  972. info = {
  973. 'id': video_id,
  974. 'url': video_url,
  975. 'title': title,
  976. 'ext': extension,
  977. 'format': format,
  978. 'thumbnail': thumbnail,
  979. 'description': description
  980. }
  981. return [info]
  982. class SpiegelIE(InfoExtractor):
  983. _VALID_URL = r'https?://(?:www\.)?spiegel\.de/video/[^/]*-(?P<videoID>[0-9]+)(?:\.html)?(?:#.*)?$'
  984. def _real_extract(self, url):
  985. m = re.match(self._VALID_URL, url)
  986. video_id = m.group('videoID')
  987. webpage = self._download_webpage(url, video_id)
  988. video_title = self._html_search_regex(r'<div class="module-title">(.*?)</div>',
  989. webpage, u'title')
  990. xml_url = u'http://video2.spiegel.de/flash/' + video_id + u'.xml'
  991. xml_code = self._download_webpage(xml_url, video_id,
  992. note=u'Downloading XML', errnote=u'Failed to download XML')
  993. idoc = xml.etree.ElementTree.fromstring(xml_code)
  994. last_type = idoc[-1]
  995. filename = last_type.findall('./filename')[0].text
  996. duration = float(last_type.findall('./duration')[0].text)
  997. video_url = 'http://video2.spiegel.de/flash/' + filename
  998. video_ext = filename.rpartition('.')[2]
  999. info = {
  1000. 'id': video_id,
  1001. 'url': video_url,
  1002. 'ext': video_ext,
  1003. 'title': video_title,
  1004. 'duration': duration,
  1005. }
  1006. return [info]
  1007. class LiveLeakIE(InfoExtractor):
  1008. _VALID_URL = r'^(?:http?://)?(?:\w+\.)?liveleak\.com/view\?(?:.*?)i=(?P<video_id>[\w_]+)(?:.*)'
  1009. IE_NAME = u'liveleak'
  1010. def _real_extract(self, url):
  1011. mobj = re.match(self._VALID_URL, url)
  1012. if mobj is None:
  1013. raise ExtractorError(u'Invalid URL: %s' % url)
  1014. video_id = mobj.group('video_id')
  1015. webpage = self._download_webpage(url, video_id)
  1016. video_url = self._search_regex(r'file: "(.*?)",',
  1017. webpage, u'video URL')
  1018. video_title = self._html_search_regex(r'<meta property="og:title" content="(?P<title>.*?)"',
  1019. webpage, u'title').replace('LiveLeak.com -', '').strip()
  1020. video_description = self._html_search_regex(r'<meta property="og:description" content="(?P<desc>.*?)"',
  1021. webpage, u'description', fatal=False)
  1022. video_uploader = self._html_search_regex(r'By:.*?(\w+)</a>',
  1023. webpage, u'uploader', fatal=False)
  1024. info = {
  1025. 'id': video_id,
  1026. 'url': video_url,
  1027. 'ext': 'mp4',
  1028. 'title': video_title,
  1029. 'description': video_description,
  1030. 'uploader': video_uploader
  1031. }
  1032. return [info]
  1033. class TumblrIE(InfoExtractor):
  1034. _VALID_URL = r'http://(?P<blog_name>.*?)\.tumblr\.com/((post)|(video))/(?P<id>\d*)/(.*?)'
  1035. def _real_extract(self, url):
  1036. m_url = re.match(self._VALID_URL, url)
  1037. video_id = m_url.group('id')
  1038. blog = m_url.group('blog_name')
  1039. url = 'http://%s.tumblr.com/post/%s/' % (blog, video_id)
  1040. webpage = self._download_webpage(url, video_id)
  1041. re_video = r'src=\\x22(?P<video_url>http://%s\.tumblr\.com/video_file/%s/(.*?))\\x22 type=\\x22video/(?P<ext>.*?)\\x22' % (blog, video_id)
  1042. video = re.search(re_video, webpage)
  1043. if video is None:
  1044. raise ExtractorError(u'Unable to extract video')
  1045. video_url = video.group('video_url')
  1046. ext = video.group('ext')
  1047. video_thumbnail = self._search_regex(r'posters(.*?)\[\\x22(?P<thumb>.*?)\\x22',
  1048. webpage, u'thumbnail', fatal=False) # We pick the first poster
  1049. if video_thumbnail: video_thumbnail = video_thumbnail.replace('\\', '')
  1050. # The only place where you can get a title, it's not complete,
  1051. # but searching in other places doesn't work for all videos
  1052. video_title = self._html_search_regex(r'<title>(?P<title>.*?)</title>',
  1053. webpage, u'title', flags=re.DOTALL)
  1054. return [{'id': video_id,
  1055. 'url': video_url,
  1056. 'title': video_title,
  1057. 'thumbnail': video_thumbnail,
  1058. 'ext': ext
  1059. }]
  1060. class BandcampIE(InfoExtractor):
  1061. _VALID_URL = r'http://.*?\.bandcamp\.com/track/(?P<title>.*)'
  1062. def _real_extract(self, url):
  1063. mobj = re.match(self._VALID_URL, url)
  1064. title = mobj.group('title')
  1065. webpage = self._download_webpage(url, title)
  1066. # We get the link to the free download page
  1067. m_download = re.search(r'freeDownloadPage: "(.*?)"', webpage)
  1068. if m_download is None:
  1069. raise ExtractorError(u'No free songs found')
  1070. download_link = m_download.group(1)
  1071. id = re.search(r'var TralbumData = {(.*?)id: (?P<id>\d*?)$',
  1072. webpage, re.MULTILINE|re.DOTALL).group('id')
  1073. download_webpage = self._download_webpage(download_link, id,
  1074. 'Downloading free downloads page')
  1075. # We get the dictionary of the track from some javascrip code
  1076. info = re.search(r'items: (.*?),$',
  1077. download_webpage, re.MULTILINE).group(1)
  1078. info = json.loads(info)[0]
  1079. # We pick mp3-320 for now, until format selection can be easily implemented.
  1080. mp3_info = info[u'downloads'][u'mp3-320']
  1081. # If we try to use this url it says the link has expired
  1082. initial_url = mp3_info[u'url']
  1083. re_url = r'(?P<server>http://(.*?)\.bandcamp\.com)/download/track\?enc=mp3-320&fsig=(?P<fsig>.*?)&id=(?P<id>.*?)&ts=(?P<ts>.*)$'
  1084. m_url = re.match(re_url, initial_url)
  1085. #We build the url we will use to get the final track url
  1086. # This url is build in Bandcamp in the script download_bunde_*.js
  1087. request_url = '%s/statdownload/track?enc=mp3-320&fsig=%s&id=%s&ts=%s&.rand=665028774616&.vrs=1' % (m_url.group('server'), m_url.group('fsig'), id, m_url.group('ts'))
  1088. final_url_webpage = self._download_webpage(request_url, id, 'Requesting download url')
  1089. # If we could correctly generate the .rand field the url would be
  1090. #in the "download_url" key
  1091. final_url = re.search(r'"retry_url":"(.*?)"', final_url_webpage).group(1)
  1092. track_info = {'id':id,
  1093. 'title' : info[u'title'],
  1094. 'ext' : 'mp3',
  1095. 'url' : final_url,
  1096. 'thumbnail' : info[u'thumb_url'],
  1097. 'uploader' : info[u'artist']
  1098. }
  1099. return [track_info]
  1100. class RedTubeIE(InfoExtractor):
  1101. """Information Extractor for redtube"""
  1102. _VALID_URL = r'(?:http://)?(?:www\.)?redtube\.com/(?P<id>[0-9]+)'
  1103. def _real_extract(self,url):
  1104. mobj = re.match(self._VALID_URL, url)
  1105. if mobj is None:
  1106. raise ExtractorError(u'Invalid URL: %s' % url)
  1107. video_id = mobj.group('id')
  1108. video_extension = 'mp4'
  1109. webpage = self._download_webpage(url, video_id)
  1110. self.report_extraction(video_id)
  1111. video_url = self._html_search_regex(r'<source src="(.+?)" type="video/mp4">',
  1112. webpage, u'video URL')
  1113. video_title = self._html_search_regex('<h1 class="videoTitle slidePanelMovable">(.+?)</h1>',
  1114. webpage, u'title')
  1115. return [{
  1116. 'id': video_id,
  1117. 'url': video_url,
  1118. 'ext': video_extension,
  1119. 'title': video_title,
  1120. }]
  1121. class InaIE(InfoExtractor):
  1122. """Information Extractor for Ina.fr"""
  1123. _VALID_URL = r'(?:http://)?(?:www\.)?ina\.fr/video/(?P<id>I[0-9]+)/.*'
  1124. def _real_extract(self,url):
  1125. mobj = re.match(self._VALID_URL, url)
  1126. video_id = mobj.group('id')
  1127. mrss_url='http://player.ina.fr/notices/%s.mrss' % video_id
  1128. video_extension = 'mp4'
  1129. webpage = self._download_webpage(mrss_url, video_id)
  1130. self.report_extraction(video_id)
  1131. video_url = self._html_search_regex(r'<media:player url="(?P<mp4url>http://mp4.ina.fr/[^"]+\.mp4)',
  1132. webpage, u'video URL')
  1133. video_title = self._search_regex(r'<title><!\[CDATA\[(?P<titre>.*?)]]></title>',
  1134. webpage, u'title')
  1135. return [{
  1136. 'id': video_id,
  1137. 'url': video_url,
  1138. 'ext': video_extension,
  1139. 'title': video_title,
  1140. }]
  1141. class HowcastIE(InfoExtractor):
  1142. """Information Extractor for Howcast.com"""
  1143. _VALID_URL = r'(?:https?://)?(?:www\.)?howcast\.com/videos/(?P<id>\d+)'
  1144. def _real_extract(self, url):
  1145. mobj = re.match(self._VALID_URL, url)
  1146. video_id = mobj.group('id')
  1147. webpage_url = 'http://www.howcast.com/videos/' + video_id
  1148. webpage = self._download_webpage(webpage_url, video_id)
  1149. self.report_extraction(video_id)
  1150. video_url = self._search_regex(r'\'?file\'?: "(http://mobile-media\.howcast\.com/[0-9]+\.mp4)',
  1151. webpage, u'video URL')
  1152. video_title = self._html_search_regex(r'<meta content=(?:"([^"]+)"|\'([^\']+)\') property=\'og:title\'',
  1153. webpage, u'title')
  1154. video_description = self._html_search_regex(r'<meta content=(?:"([^"]+)"|\'([^\']+)\') name=\'description\'',
  1155. webpage, u'description', fatal=False)
  1156. thumbnail = self._html_search_regex(r'<meta content=\'(.+?)\' property=\'og:image\'',
  1157. webpage, u'thumbnail', fatal=False)
  1158. return [{
  1159. 'id': video_id,
  1160. 'url': video_url,
  1161. 'ext': 'mp4',
  1162. 'title': video_title,
  1163. 'description': video_description,
  1164. 'thumbnail': thumbnail,
  1165. }]
  1166. class VineIE(InfoExtractor):
  1167. """Information Extractor for Vine.co"""
  1168. _VALID_URL = r'(?:https?://)?(?:www\.)?vine\.co/v/(?P<id>\w+)'
  1169. def _real_extract(self, url):
  1170. mobj = re.match(self._VALID_URL, url)
  1171. video_id = mobj.group('id')
  1172. webpage_url = 'https://vine.co/v/' + video_id
  1173. webpage = self._download_webpage(webpage_url, video_id)
  1174. self.report_extraction(video_id)
  1175. video_url = self._html_search_regex(r'<meta property="twitter:player:stream" content="(.+?)"',
  1176. webpage, u'video URL')
  1177. video_title = self._html_search_regex(r'<meta property="og:title" content="(.+?)"',
  1178. webpage, u'title')
  1179. thumbnail = self._html_search_regex(r'<meta property="og:image" content="(.+?)(\?.*?)?"',
  1180. webpage, u'thumbnail', fatal=False)
  1181. uploader = self._html_search_regex(r'<div class="user">.*?<h2>(.+?)</h2>',
  1182. webpage, u'uploader', fatal=False, flags=re.DOTALL)
  1183. return [{
  1184. 'id': video_id,
  1185. 'url': video_url,
  1186. 'ext': 'mp4',
  1187. 'title': video_title,
  1188. 'thumbnail': thumbnail,
  1189. 'uploader': uploader,
  1190. }]
  1191. class FlickrIE(InfoExtractor):
  1192. """Information Extractor for Flickr videos"""
  1193. _VALID_URL = r'(?:https?://)?(?:www\.)?flickr\.com/photos/(?P<uploader_id>[\w\-_@]+)/(?P<id>\d+).*'
  1194. def _real_extract(self, url):
  1195. mobj = re.match(self._VALID_URL, url)
  1196. video_id = mobj.group('id')
  1197. video_uploader_id = mobj.group('uploader_id')
  1198. webpage_url = 'http://www.flickr.com/photos/' + video_uploader_id + '/' + video_id
  1199. webpage = self._download_webpage(webpage_url, video_id)
  1200. secret = self._search_regex(r"photo_secret: '(\w+)'", webpage, u'secret')
  1201. first_url = 'https://secure.flickr.com/apps/video/video_mtl_xml.gne?v=x&photo_id=' + video_id + '&secret=' + secret + '&bitrate=700&target=_self'
  1202. first_xml = self._download_webpage(first_url, video_id, 'Downloading first data webpage')
  1203. node_id = self._html_search_regex(r'<Item id="id">(\d+-\d+)</Item>',
  1204. first_xml, u'node_id')
  1205. second_url = 'https://secure.flickr.com/video_playlist.gne?node_id=' + node_id + '&tech=flash&mode=playlist&bitrate=700&secret=' + secret + '&rd=video.yahoo.com&noad=1'
  1206. second_xml = self._download_webpage(second_url, video_id, 'Downloading second data webpage')
  1207. self.report_extraction(video_id)
  1208. mobj = re.search(r'<STREAM APP="(.+?)" FULLPATH="(.+?)"', second_xml)
  1209. if mobj is None:
  1210. raise ExtractorError(u'Unable to extract video url')
  1211. video_url = mobj.group(1) + unescapeHTML(mobj.group(2))
  1212. video_title = self._html_search_regex(r'<meta property="og:title" content=(?:"([^"]+)"|\'([^\']+)\')',
  1213. webpage, u'video title')
  1214. video_description = self._html_search_regex(r'<meta property="og:description" content=(?:"([^"]+)"|\'([^\']+)\')',
  1215. webpage, u'description', fatal=False)
  1216. thumbnail = self._html_search_regex(r'<meta property="og:image" content=(?:"([^"]+)"|\'([^\']+)\')',
  1217. webpage, u'thumbnail', fatal=False)
  1218. return [{
  1219. 'id': video_id,
  1220. 'url': video_url,
  1221. 'ext': 'mp4',
  1222. 'title': video_title,
  1223. 'description': video_description,
  1224. 'thumbnail': thumbnail,
  1225. 'uploader_id': video_uploader_id,
  1226. }]
  1227. class TeamcocoIE(InfoExtractor):
  1228. _VALID_URL = r'http://teamcoco\.com/video/(?P<url_title>.*)'
  1229. def _real_extract(self, url):
  1230. mobj = re.match(self._VALID_URL, url)
  1231. if mobj is None:
  1232. raise ExtractorError(u'Invalid URL: %s' % url)
  1233. url_title = mobj.group('url_title')
  1234. webpage = self._download_webpage(url, url_title)
  1235. video_id = self._html_search_regex(r'<article class="video" data-id="(\d+?)"',
  1236. webpage, u'video id')
  1237. self.report_extraction(video_id)
  1238. video_title = self._html_search_regex(r'<meta property="og:title" content="(.+?)"',
  1239. webpage, u'title')
  1240. thumbnail = self._html_search_regex(r'<meta property="og:image" content="(.+?)"',
  1241. webpage, u'thumbnail', fatal=False)
  1242. video_description = self._html_search_regex(r'<meta property="og:description" content="(.*?)"',
  1243. webpage, u'description', fatal=False)
  1244. data_url = 'http://teamcoco.com/cvp/2.0/%s.xml' % video_id
  1245. data = self._download_webpage(data_url, video_id, 'Downloading data webpage')
  1246. video_url = self._html_search_regex(r'<file type="high".*?>(.*?)</file>',
  1247. data, u'video URL')
  1248. return [{
  1249. 'id': video_id,
  1250. 'url': video_url,
  1251. 'ext': 'mp4',
  1252. 'title': video_title,
  1253. 'thumbnail': thumbnail,
  1254. 'description': video_description,
  1255. }]
  1256. class XHamsterIE(InfoExtractor):
  1257. """Information Extractor for xHamster"""
  1258. _VALID_URL = r'(?:http://)?(?:www.)?xhamster\.com/movies/(?P<id>[0-9]+)/.*\.html'
  1259. def _real_extract(self,url):
  1260. mobj = re.match(self._VALID_URL, url)
  1261. video_id = mobj.group('id')
  1262. mrss_url = 'http://xhamster.com/movies/%s/.html' % video_id
  1263. webpage = self._download_webpage(mrss_url, video_id)
  1264. mobj = re.search(r'\'srv\': \'(?P<server>[^\']*)\',\s*\'file\': \'(?P<file>[^\']+)\',', webpage)
  1265. if mobj is None:
  1266. raise ExtractorError(u'Unable to extract media URL')
  1267. if len(mobj.group('server')) == 0:
  1268. video_url = compat_urllib_parse.unquote(mobj.group('file'))
  1269. else:
  1270. video_url = mobj.group('server')+'/key='+mobj.group('file')
  1271. video_extension = video_url.split('.')[-1]
  1272. video_title = self._html_search_regex(r'<title>(?P<title>.+?) - xHamster\.com</title>',
  1273. webpage, u'title')
  1274. # Can't see the description anywhere in the UI
  1275. # video_description = self._html_search_regex(r'<span>Description: </span>(?P<description>[^<]+)',
  1276. # webpage, u'description', fatal=False)
  1277. # if video_description: video_description = unescapeHTML(video_description)
  1278. mobj = re.search(r'hint=\'(?P<upload_date_Y>[0-9]{4})-(?P<upload_date_m>[0-9]{2})-(?P<upload_date_d>[0-9]{2}) [0-9]{2}:[0-9]{2}:[0-9]{2} [A-Z]{3,4}\'', webpage)
  1279. if mobj:
  1280. video_upload_date = mobj.group('upload_date_Y')+mobj.group('upload_date_m')+mobj.group('upload_date_d')
  1281. else:
  1282. video_upload_date = None
  1283. self._downloader.report_warning(u'Unable to extract upload date')
  1284. video_uploader_id = self._html_search_regex(r'<a href=\'/user/[^>]+>(?P<uploader_id>[^<]+)',
  1285. webpage, u'uploader id', default=u'anonymous')
  1286. video_thumbnail = self._search_regex(r'\'image\':\'(?P<thumbnail>[^\']+)\'',
  1287. webpage, u'thumbnail', fatal=False)
  1288. return [{
  1289. 'id': video_id,
  1290. 'url': video_url,
  1291. 'ext': video_extension,
  1292. 'title': video_title,
  1293. # 'description': video_description,
  1294. 'upload_date': video_upload_date,
  1295. 'uploader_id': video_uploader_id,
  1296. 'thumbnail': video_thumbnail
  1297. }]
  1298. class HypemIE(InfoExtractor):
  1299. """Information Extractor for hypem"""
  1300. _VALID_URL = r'(?:http://)?(?:www\.)?hypem\.com/track/([^/]+)/([^/]+)'
  1301. def _real_extract(self, url):
  1302. mobj = re.match(self._VALID_URL, url)
  1303. if mobj is None:
  1304. raise ExtractorError(u'Invalid URL: %s' % url)
  1305. track_id = mobj.group(1)
  1306. data = { 'ax': 1, 'ts': time.time() }
  1307. data_encoded = compat_urllib_parse.urlencode(data)
  1308. complete_url = url + "?" + data_encoded
  1309. request = compat_urllib_request.Request(complete_url)
  1310. response, urlh = self._download_webpage_handle(request, track_id, u'Downloading webpage with the url')
  1311. cookie = urlh.headers.get('Set-Cookie', '')
  1312. self.report_extraction(track_id)
  1313. html_tracks = self._html_search_regex(r'<script type="application/json" id="displayList-data">(.*?)</script>',
  1314. response, u'tracks', flags=re.MULTILINE|re.DOTALL).strip()
  1315. try:
  1316. track_list = json.loads(html_tracks)
  1317. track = track_list[u'tracks'][0]
  1318. except ValueError:
  1319. raise ExtractorError(u'Hypemachine contained invalid JSON.')
  1320. key = track[u"key"]
  1321. track_id = track[u"id"]
  1322. artist = track[u"artist"]
  1323. title = track[u"song"]
  1324. serve_url = "http://hypem.com/serve/source/%s/%s" % (compat_str(track_id), compat_str(key))
  1325. request = compat_urllib_request.Request(serve_url, "" , {'Content-Type': 'application/json'})
  1326. request.add_header('cookie', cookie)
  1327. song_data_json = self._download_webpage(request, track_id, u'Downloading metadata')
  1328. try:
  1329. song_data = json.loads(song_data_json)
  1330. except ValueError:
  1331. raise ExtractorError(u'Hypemachine contained invalid JSON.')
  1332. final_url = song_data[u"url"]
  1333. return [{
  1334. 'id': track_id,
  1335. 'url': final_url,
  1336. 'ext': "mp3",
  1337. 'title': title,
  1338. 'artist': artist,
  1339. }]
  1340. class Vbox7IE(InfoExtractor):
  1341. """Information Extractor for Vbox7"""
  1342. _VALID_URL = r'(?:http://)?(?:www\.)?vbox7\.com/play:([^/]+)'
  1343. def _real_extract(self,url):
  1344. mobj = re.match(self._VALID_URL, url)
  1345. if mobj is None:
  1346. raise ExtractorError(u'Invalid URL: %s' % url)
  1347. video_id = mobj.group(1)
  1348. redirect_page, urlh = self._download_webpage_handle(url, video_id)
  1349. new_location = self._search_regex(r'window\.location = \'(.*)\';', redirect_page, u'redirect location')
  1350. redirect_url = urlh.geturl() + new_location
  1351. webpage = self._download_webpage(redirect_url, video_id, u'Downloading redirect page')
  1352. title = self._html_search_regex(r'<title>(.*)</title>',
  1353. webpage, u'title').split('/')[0].strip()
  1354. ext = "flv"
  1355. info_url = "http://vbox7.com/play/magare.do"
  1356. data = compat_urllib_parse.urlencode({'as3':'1','vid':video_id})
  1357. info_request = compat_urllib_request.Request(info_url, data)
  1358. info_request.add_header('Content-Type', 'application/x-www-form-urlencoded')
  1359. info_response = self._download_webpage(info_request, video_id, u'Downloading info webpage')
  1360. if info_response is None:
  1361. raise ExtractorError(u'Unable to extract the media url')
  1362. (final_url, thumbnail_url) = map(lambda x: x.split('=')[1], info_response.split('&'))
  1363. return [{
  1364. 'id': video_id,
  1365. 'url': final_url,
  1366. 'ext': ext,
  1367. 'title': title,
  1368. 'thumbnail': thumbnail_url,
  1369. }]
  1370. def gen_extractors():
  1371. """ Return a list of an instance of every supported extractor.
  1372. The order does matter; the first extractor matched is the one handling the URL.
  1373. """
  1374. return [
  1375. YoutubePlaylistIE(),
  1376. YoutubeChannelIE(),
  1377. YoutubeUserIE(),
  1378. YoutubeSearchIE(),
  1379. YoutubeIE(),
  1380. MetacafeIE(),
  1381. DailymotionIE(),
  1382. GoogleSearchIE(),
  1383. PhotobucketIE(),
  1384. YahooIE(),
  1385. YahooSearchIE(),
  1386. DepositFilesIE(),
  1387. FacebookIE(),
  1388. BlipTVIE(),
  1389. BlipTVUserIE(),
  1390. VimeoIE(),
  1391. MyVideoIE(),
  1392. ComedyCentralIE(),
  1393. EscapistIE(),
  1394. CollegeHumorIE(),
  1395. XVideosIE(),
  1396. SoundcloudSetIE(),
  1397. SoundcloudIE(),
  1398. InfoQIE(),
  1399. MixcloudIE(),
  1400. StanfordOpenClassroomIE(),
  1401. MTVIE(),
  1402. YoukuIE(),
  1403. XNXXIE(),
  1404. YouJizzIE(),
  1405. PornotubeIE(),
  1406. YouPornIE(),
  1407. GooglePlusIE(),
  1408. ArteTvIE(),
  1409. NBAIE(),
  1410. WorldStarHipHopIE(),
  1411. JustinTVIE(),
  1412. FunnyOrDieIE(),
  1413. SteamIE(),
  1414. UstreamIE(),
  1415. RBMARadioIE(),
  1416. EightTracksIE(),
  1417. KeekIE(),
  1418. TEDIE(),
  1419. MySpassIE(),
  1420. SpiegelIE(),
  1421. LiveLeakIE(),
  1422. ARDIE(),
  1423. ZDFIE(),
  1424. TumblrIE(),
  1425. BandcampIE(),
  1426. RedTubeIE(),
  1427. InaIE(),
  1428. HowcastIE(),
  1429. VineIE(),
  1430. FlickrIE(),
  1431. TeamcocoIE(),
  1432. XHamsterIE(),
  1433. HypemIE(),
  1434. Vbox7IE(),
  1435. GametrailersIE(),
  1436. StatigramIE(),
  1437. GenericIE()
  1438. ]
  1439. def get_info_extractor(ie_name):
  1440. """Returns the info extractor class with the given ie_name"""
  1441. return globals()[ie_name+'IE']