Merge remote-tracking branch 'origin/master'

This commit is contained in:
Philipp Hagemeister 2014-11-09 08:30:12 +01:00
commit 8bb9b97c97
7 changed files with 67 additions and 32 deletions

View File

@ -421,6 +421,7 @@
from .vevo import VevoIE from .vevo import VevoIE
from .vgtv import VGTVIE from .vgtv import VGTVIE
from .vh1 import VH1IE from .vh1 import VH1IE
from .vice import ViceIE
from .viddler import ViddlerIE from .viddler import ViddlerIE
from .videobam import VideoBamIE from .videobam import VideoBamIE
from .videodetective import VideoDetectiveIE from .videodetective import VideoDetectiveIE

View File

@ -576,6 +576,7 @@ def _real_extract(self, url):
return { return {
'id': video_id, 'id': video_id,
'title': os.path.splitext(url_basename(url))[0], 'title': os.path.splitext(url_basename(url))[0],
'direct': True,
'formats': [{ 'formats': [{
'format_id': m.group('format_id'), 'format_id': m.group('format_id'),
'url': url, 'url': url,

View File

@ -1,15 +1,11 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
import re
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import (
compat_urlparse, compat_urlparse,
str_to_int,
ExtractorError, ExtractorError,
) )
import json
class GoshgayIE(InfoExtractor): class GoshgayIE(InfoExtractor):
@ -27,36 +23,27 @@ class GoshgayIE(InfoExtractor):
} }
def _real_extract(self, url): def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url) video_id = self._match_id(url)
video_id = mobj.group('id')
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
title = self._search_regex(r'class="video-title"><h1>(.+?)<', webpage, 'title') title = self._og_search_title(webpage)
thumbnail = self._og_search_thumbnail(webpage)
family_friendly = self._html_search_meta(
'isFamilyFriendly', webpage, default='false')
config_url = self._search_regex(
r"'config'\s*:\s*'([^']+)'", webpage, 'config URL')
player_config = self._search_regex( config = self._download_xml(
r'(?s)jwplayer\("player"\)\.setup\(({.+?})\)', webpage, 'config settings') config_url, video_id, 'Downloading player config XML')
player_vars = json.loads(player_config.replace("'", '"'))
width = str_to_int(player_vars.get('width'))
height = str_to_int(player_vars.get('height'))
config_uri = player_vars.get('config')
if config_uri is None: if config is None:
raise ExtractorError('Missing config URI')
node = self._download_xml(config_uri, video_id, 'Downloading player config XML',
errnote='Unable to download XML')
if node is None:
raise ExtractorError('Missing config XML') raise ExtractorError('Missing config XML')
if node.tag != 'config': if config.tag != 'config':
raise ExtractorError('Missing config attribute') raise ExtractorError('Missing config attribute')
fns = node.findall('file') fns = config.findall('file')
imgs = node.findall('image') if len(fns) < 1:
if len(fns) != 1:
raise ExtractorError('Missing media URI') raise ExtractorError('Missing media URI')
video_url = fns[0].text video_url = fns[0].text
if len(imgs) < 1:
thumbnail = None
else:
thumbnail = imgs[0].text
url_comp = compat_urlparse.urlparse(url) url_comp = compat_urlparse.urlparse(url)
ref = "%s://%s%s" % (url_comp[0], url_comp[1], url_comp[2]) ref = "%s://%s%s" % (url_comp[0], url_comp[1], url_comp[2])
@ -65,9 +52,7 @@ def _real_extract(self, url):
'id': video_id, 'id': video_id,
'url': video_url, 'url': video_url,
'title': title, 'title': title,
'width': width,
'height': height,
'thumbnail': thumbnail, 'thumbnail': thumbnail,
'http_referer': ref, 'http_referer': ref,
'age_limit': 18, 'age_limit': 0 if family_friendly == 'true' else 18,
} }

View File

@ -175,7 +175,8 @@ def _real_extract(self, url):
entries = [{ entries = [{
'_type': 'url', '_type': 'url',
'ie_key': NiconicoIE.ie_key(), 'ie_key': NiconicoIE.ie_key(),
'url': 'http://www.nicovideo.jp/watch/%s' % entry['item_id'], 'url': ('http://www.nicovideo.jp/watch/%s' %
entry['item_data']['video_id']),
} for entry in entries] } for entry in entries]
return { return {

View File

@ -0,0 +1,38 @@
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from .ooyala import OoyalaIE
from ..utils import ExtractorError
class ViceIE(InfoExtractor):
_VALID_URL = r'http://www\.vice\.com/.*?/(?P<name>.+)'
_TEST = {
'url': 'http://www.vice.com/Fringes/cowboy-capitalists-part-1',
'info_dict': {
'id': '43cW1mYzpia9IlestBjVpd23Yu3afAfp',
'ext': 'mp4',
'title': 'VICE_COWBOYCAPITALISTS_PART01_v1_VICE_WM_1080p.mov',
},
'params': {
# Requires ffmpeg (m3u8 manifest)
'skip_download': True,
},
}
def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
name = mobj.group('name')
webpage = self._download_webpage(url, name)
try:
embed_code = self._search_regex(
r'embedCode=([^&\'"]+)', webpage,
'ooyala embed code')
ooyala_url = OoyalaIE._url_for_embed_code(embed_code)
print(ooyala_url)
except ExtractorError:
raise ExtractorError('The page doesn\'t contain a video', expected=True)
return self.url_result(ooyala_url, ie='Ooyala')

View File

@ -49,7 +49,7 @@ def _real_extract(self, url):
quality = qualities(['SD', 'MQ', 'HQ', 'HD']) quality = qualities(['SD', 'MQ', 'HQ', 'HD'])
audio_table = {'flv': 'mp3', 'webm': 'ogg'} audio_table = {'flv': 'mp3', 'webm': 'ogg', 'mp3': 'mp3'}
embedpage = self._download_json('http://www.wrzuta.pl/npp/embed/%s/%s' % (uploader, video_id), video_id) embedpage = self._download_json('http://www.wrzuta.pl/npp/embed/%s/%s' % (uploader, video_id), video_id)

View File

@ -261,7 +261,16 @@ def _hide_login_info(opts):
video_format.add_option( video_format.add_option(
'-f', '--format', '-f', '--format',
action='store', dest='format', metavar='FORMAT', default=None, action='store', dest='format', metavar='FORMAT', default=None,
help='video format code, specify the order of preference using slashes: -f 22/17/18 . -f mp4 , -f m4a and -f flv are also supported. You can also use the special names "best", "bestvideo", "bestaudio", "worst", "worstvideo" and "worstaudio". By default, youtube-dl will pick the best quality. Use commas to download multiple audio formats, such as -f 136/137/mp4/bestvideo,140/m4a/bestaudio') help='video format code, specify the order of preference using'
' slashes: -f 22/17/18 . -f mp4 , -f m4a and -f flv are also'
' supported. You can also use the special names "best",'
' "bestvideo", "bestaudio", "worst", "worstvideo" and'
' "worstaudio". By default, youtube-dl will pick the best quality.'
' Use commas to download multiple audio formats, such as'
' -f 136/137/mp4/bestvideo,140/m4a/bestaudio.'
' You can merge the video and audio of two formats into a single'
' file using -f <video-format>+<audio-format> (requires ffmpeg or'
' avconv), for example -f bestvideo+bestaudio.')
video_format.add_option( video_format.add_option(
'--all-formats', '--all-formats',
action='store_const', dest='format', const='all', action='store_const', dest='format', const='all',