Compare commits
14 Commits
2014.07.23
...
2014.07.23
Author | SHA1 | Date | |
---|---|---|---|
![]() |
dfe029a62c | ||
![]() |
b0472057a3 | ||
![]() |
c081b35c27 | ||
![]() |
9f43890bcd | ||
![]() |
94a20aa5f8 | ||
![]() |
94e8df3a7e | ||
![]() |
37e64addc8 | ||
![]() |
d82ba23ba5 | ||
![]() |
0fd7fd71b4 | ||
![]() |
eae12e3fe3 | ||
![]() |
798a2cad4f | ||
![]() |
41c0849429 | ||
![]() |
a4e5af1184 | ||
![]() |
b090af5922 |
@@ -137,8 +137,8 @@ def expect_info_dict(self, expected_dict, got_dict):
|
||||
|
||||
|
||||
def assertRegexpMatches(self, text, regexp, msg=None):
|
||||
if hasattr(self, 'assertRegexpMatches'):
|
||||
return self.assertRegexpMatches(text, regexp, msg)
|
||||
if hasattr(self, 'assertRegexp'):
|
||||
return self.assertRegexp(text, regexp, msg)
|
||||
else:
|
||||
m = re.match(regexp, text)
|
||||
if not m:
|
||||
|
@@ -154,7 +154,7 @@ class TestPlaylists(unittest.TestCase):
|
||||
self.assertEqual(result['id'], '4110309')
|
||||
self.assertEqual(result['title'], 'TILT Brass - Bowery Poetry Club, August \'03 [Non-Site SCR 02]')
|
||||
assertRegexpMatches(
|
||||
self, result['description'], r'TILT Brass - Bowery Poetry Club')
|
||||
self, result['description'], r'.*?TILT Brass - Bowery Poetry Club')
|
||||
self.assertEqual(len(result['entries']), 6)
|
||||
|
||||
def test_livestream_event(self):
|
||||
|
@@ -57,6 +57,12 @@ _TESTS = [
|
||||
u'F375F75BF2AFDAAF2666E43868D46816F83F13E81C46.3725A8218E446A0DECD33F79DC282994D6AA92C92C9',
|
||||
u'9C29AA6D499282CD97F33DCED0A644E8128A5273.64C18E31F38361864D86834E6662FAADFA2FB57F'
|
||||
),
|
||||
(
|
||||
u'https://s.ytimg.com/yts/jsbin/html5player-en_US-vflBb0OQx.js',
|
||||
u'js',
|
||||
84,
|
||||
u'123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQ0STUVWXYZ!"#$%&\'()*+,@./:;<=>'
|
||||
)
|
||||
]
|
||||
|
||||
|
||||
|
@@ -1234,14 +1234,21 @@ class YoutubeDL(object):
|
||||
if not self.params.get('verbose'):
|
||||
return
|
||||
|
||||
write_string(
|
||||
encoding_str = (
|
||||
'[debug] Encodings: locale %s, fs %s, out %s, pref %s\n' % (
|
||||
locale.getpreferredencoding(),
|
||||
sys.getfilesystemencoding(),
|
||||
sys.stdout.encoding,
|
||||
self.get_encoding()),
|
||||
encoding=None
|
||||
)
|
||||
self.get_encoding()))
|
||||
try:
|
||||
write_string(encoding_str, encoding=None)
|
||||
except:
|
||||
errmsg = 'Failed to write encoding string %r' % encoding_str
|
||||
try:
|
||||
sys.stdout.write(errmsg)
|
||||
except:
|
||||
pass
|
||||
raise IOError(errmsg)
|
||||
|
||||
self._write_string('[debug] youtube-dl version ' + __version__ + '\n')
|
||||
try:
|
||||
|
@@ -301,8 +301,12 @@ class InfoExtractor(object):
|
||||
def _download_json(self, url_or_request, video_id,
|
||||
note=u'Downloading JSON metadata',
|
||||
errnote=u'Unable to download JSON metadata',
|
||||
transform_source=None):
|
||||
json_string = self._download_webpage(url_or_request, video_id, note, errnote)
|
||||
transform_source=None,
|
||||
fatal=True):
|
||||
json_string = self._download_webpage(
|
||||
url_or_request, video_id, note, errnote, fatal=fatal)
|
||||
if (not fatal) and json_string is False:
|
||||
return None
|
||||
if transform_source:
|
||||
json_string = transform_source(json_string)
|
||||
try:
|
||||
|
@@ -4,7 +4,11 @@ import re
|
||||
import json
|
||||
|
||||
from .common import InfoExtractor
|
||||
from ..utils import find_xpath_attr, compat_str
|
||||
from ..utils import (
|
||||
compat_str,
|
||||
ExtractorError,
|
||||
find_xpath_attr,
|
||||
)
|
||||
|
||||
|
||||
class NBCIE(InfoExtractor):
|
||||
|
@@ -92,16 +92,7 @@ class RTLnowIE(InfoExtractor):
|
||||
},
|
||||
{
|
||||
'url': 'http://www.n-tvnow.de/deluxe-alles-was-spass-macht/thema-ua-luxushotel-fuer-vierbeiner.php?container_id=153819&player=1&season=0',
|
||||
'info_dict': {
|
||||
'id': '153819',
|
||||
'ext': 'flv',
|
||||
'title': 'Deluxe - Alles was Spaß macht - Thema u.a.: Luxushotel für Vierbeiner',
|
||||
'description': 'md5:c3705e1bb32e1a5b2bcd634fc065c631',
|
||||
'thumbnail': 'http://autoimg.static-fra.de/ntvnow/383157/1500x1500/image2.jpg',
|
||||
'upload_date': '20140221',
|
||||
'duration': 2429,
|
||||
},
|
||||
'skip': 'Only works from Germany',
|
||||
'only_matching': True,
|
||||
},
|
||||
]
|
||||
|
||||
|
@@ -20,7 +20,7 @@ class SaveFromIE(InfoExtractor):
|
||||
'upload_date': '20120816',
|
||||
'uploader': 'Howcast',
|
||||
'uploader_id': 'Howcast',
|
||||
'description': 'md5:727900f130df3dc9a25e2721497c7910',
|
||||
'description': 're:(?s).* Hi, my name is Rene Dreifuss\. And I\'m here to show you some MMA.*',
|
||||
},
|
||||
'params': {
|
||||
'skip_download': True
|
||||
|
@@ -5,6 +5,7 @@ from ..utils import (
|
||||
ExtractorError,
|
||||
compat_urllib_parse,
|
||||
compat_urllib_request,
|
||||
determine_ext,
|
||||
)
|
||||
import re
|
||||
|
||||
@@ -68,6 +69,7 @@ class SockshareIE(InfoExtractor):
|
||||
formats = [{
|
||||
'format_id': 'sd',
|
||||
'url': video_url,
|
||||
'ext': determine_ext(title),
|
||||
}]
|
||||
|
||||
return {
|
||||
|
@@ -82,10 +82,10 @@ class SoundcloudIE(InfoExtractor):
|
||||
# downloadable song
|
||||
{
|
||||
'url': 'https://soundcloud.com/oddsamples/bus-brakes',
|
||||
'md5': 'fee7b8747b09bb755cefd4b853e7249a',
|
||||
'md5': '7624f2351f8a3b2e7cd51522496e7631',
|
||||
'info_dict': {
|
||||
'id': '128590877',
|
||||
'ext': 'wav',
|
||||
'ext': 'mp3',
|
||||
'title': 'Bus Brakes',
|
||||
'description': 'md5:0170be75dd395c96025d210d261c784e',
|
||||
'uploader': 'oddsamples',
|
||||
|
@@ -25,7 +25,10 @@ class VubeIE(InfoExtractor):
|
||||
'uploader': 'Chiara.Grispo',
|
||||
'timestamp': 1388743358,
|
||||
'upload_date': '20140103',
|
||||
'duration': 170.56
|
||||
'duration': 170.56,
|
||||
'like_count': int,
|
||||
'dislike_count': int,
|
||||
'comment_count': int,
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -40,7 +43,10 @@ class VubeIE(InfoExtractor):
|
||||
'uploader': 'Seraina',
|
||||
'timestamp': 1396492438,
|
||||
'upload_date': '20140403',
|
||||
'duration': 240.107
|
||||
'duration': 240.107,
|
||||
'like_count': int,
|
||||
'dislike_count': int,
|
||||
'comment_count': int,
|
||||
}
|
||||
}, {
|
||||
'url': 'http://vube.com/vote/Siren+Gene/0nmsMY5vEq?n=2&t=s',
|
||||
@@ -56,6 +62,7 @@ class VubeIE(InfoExtractor):
|
||||
'duration': 221.788,
|
||||
'like_count': int,
|
||||
'dislike_count': int,
|
||||
'comment_count': int,
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -70,7 +77,6 @@ class VubeIE(InfoExtractor):
|
||||
webpage, 'video data'
|
||||
)
|
||||
data = json.loads(data_json)
|
||||
open('/dev/shm/f', 'w').write(json.dumps(data, indent=2))
|
||||
video = (
|
||||
data.get('video') or
|
||||
data)
|
||||
@@ -101,12 +107,22 @@ class VubeIE(InfoExtractor):
|
||||
duration = video['duration']
|
||||
view_count = video.get('raw_view_count')
|
||||
like_count = video.get('rlikes')
|
||||
if like_count is None:
|
||||
like_count = video.get('total_likes')
|
||||
dislike_count = video.get('rhates')
|
||||
if dislike_count is None:
|
||||
dislike_count = video.get('total_hates')
|
||||
|
||||
comment = self._download_json(
|
||||
'http://vube.com/api/video/%s/comment' % video_id, video_id, 'Downloading video comment JSON')
|
||||
|
||||
comment_count = int_or_none(comment.get('total'))
|
||||
comments = video.get('comments')
|
||||
comment_count = None
|
||||
if comments is None:
|
||||
comment_data = self._download_json(
|
||||
'http://vube.com/api/video/%s/comment' % video_id,
|
||||
video_id, 'Downloading video comment JSON', fatal=False)
|
||||
if comment_data is not None:
|
||||
comment_count = int_or_none(comment_data.get('total'))
|
||||
else:
|
||||
comment_count = len(comments)
|
||||
|
||||
return {
|
||||
'id': video_id,
|
||||
|
@@ -6,7 +6,7 @@ import re
|
||||
from .common import InfoExtractor
|
||||
from ..utils import (
|
||||
compat_parse_qs,
|
||||
compat_urlparse,
|
||||
compat_parse_qs,
|
||||
determine_ext,
|
||||
unified_strdate,
|
||||
)
|
||||
@@ -81,7 +81,7 @@ class WDRIE(InfoExtractor):
|
||||
]
|
||||
return self.playlist_result(entries, page_id)
|
||||
|
||||
flashvars = compat_urlparse.parse_qs(
|
||||
flashvars = compat_parse_qs(
|
||||
self._html_search_regex(r'<param name="flashvars" value="([^"]+)"', webpage, 'flashvars'))
|
||||
|
||||
page_id = flashvars['trackerClipId'][0]
|
||||
|
@@ -346,8 +346,10 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
|
||||
|
||||
def _extract_signature_function(self, video_id, player_url, slen):
|
||||
id_m = re.match(
|
||||
r'.*-(?P<id>[a-zA-Z0-9_-]+)(?:/watch_as3)?\.(?P<ext>[a-z]+)$',
|
||||
r'.*-(?P<id>[a-zA-Z0-9_-]+)(?:/watch_as3|/html5player)?\.(?P<ext>[a-z]+)$',
|
||||
player_url)
|
||||
if not id_m:
|
||||
raise ExtractorError('Cannot identify player %r' % player_url)
|
||||
player_type = id_m.group('ext')
|
||||
player_id = id_m.group('id')
|
||||
|
||||
|
@@ -114,13 +114,13 @@ class JSInterpreter(object):
|
||||
obj = {}
|
||||
obj_m = re.search(
|
||||
(r'(?:var\s+)?%s\s*=\s*\{' % re.escape(objname)) +
|
||||
r'\s*(?P<fields>([a-zA-Z$]+\s*:\s*function\(.*?\)\s*\{.*?\})*)' +
|
||||
r'\s*(?P<fields>([a-zA-Z$0-9]+\s*:\s*function\(.*?\)\s*\{.*?\})*)' +
|
||||
r'\}\s*;',
|
||||
self.code)
|
||||
fields = obj_m.group('fields')
|
||||
# Currently, it only supports function definitions
|
||||
fields_m = re.finditer(
|
||||
r'(?P<key>[a-zA-Z$]+)\s*:\s*function'
|
||||
r'(?P<key>[a-zA-Z$0-9]+)\s*:\s*function'
|
||||
r'\((?P<args>[a-z,]+)\){(?P<code>[^}]+)}',
|
||||
fields)
|
||||
for f in fields_m:
|
||||
|
@@ -1,2 +1,2 @@
|
||||
|
||||
__version__ = '2014.07.23'
|
||||
__version__ = '2014.07.23.2'
|
||||
|
Reference in New Issue
Block a user