pep8 and minor beautification all around

This commit is contained in:
Philipp Hagemeister 2014-12-04 08:27:40 +01:00
parent 5f5e993dc6
commit 810fb84d5e
5 changed files with 17 additions and 15 deletions

View File

@ -26,13 +26,13 @@ class AudiomackIE(InfoExtractor):
{ {
'add_ie': ['Soundcloud'], 'add_ie': ['Soundcloud'],
'url': 'http://www.audiomack.com/song/xclusiveszone/take-kare', 'url': 'http://www.audiomack.com/song/xclusiveszone/take-kare',
'file': '172419696.mp3', 'info_dict': {
'info_dict': 'id': '172419696',
{ 'ext': 'mp3',
'description': 'md5:1fc3272ed7a635cce5be1568c2822997', 'description': 'md5:1fc3272ed7a635cce5be1568c2822997',
'title': 'Young Thug ft Lil Wayne - Take Kare', 'title': 'Young Thug ft Lil Wayne - Take Kare',
'uploader':'Young Thug World', 'uploader': 'Young Thug World',
'upload_date':'20141016', 'upload_date': '20141016',
} }
}, },
] ]

View File

@ -819,7 +819,8 @@ def _float(self, v, name, fatal=False, **kwargs):
return res return res
def _set_cookie(self, domain, name, value, expire_time=None): def _set_cookie(self, domain, name, value, expire_time=None):
cookie = compat_cookiejar.Cookie(0, name, value, None, None, domain, None, cookie = compat_cookiejar.Cookie(
0, name, value, None, None, domain, None,
None, '/', True, False, expire_time, '', None, None, None) None, '/', True, False, expire_time, '', None, None, None)
self._downloader.cookiejar.set_cookie(cookie) self._downloader.cookiejar.set_cookie(cookie)

View File

@ -88,6 +88,7 @@ def _real_extract(self, url):
self.report_warning( self.report_warning(
'%s: No downloadable song on this page' % video_id) '%s: No downloadable song on this page' % video_id)
return return
def search_data(name): def search_data(name):
return self._search_regex( return self._search_regex(
r'''data-%s=([\'"])(?P<data>.*?)\1''' % name, r'''data-%s=([\'"])(?P<data>.*?)\1''' % name,

View File

@ -97,11 +97,8 @@ def _login(self):
if 'returnUrl' not in response: if 'returnUrl' not in response:
raise ExtractorError('Unable to log in') raise ExtractorError('Unable to log in')
def _real_extract(self, url): def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url) lecture_id = self._match_id(url)
lecture_id = mobj.group('id')
lecture = self._download_json( lecture = self._download_json(
'https://www.udemy.com/api-1.1/lectures/%s' % lecture_id, 'https://www.udemy.com/api-1.1/lectures/%s' % lecture_id,

View File

@ -44,9 +44,10 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
_LOGIN_REQUIRED = False _LOGIN_REQUIRED = False
def _set_language(self): def _set_language(self):
self._set_cookie('.youtube.com', 'PREF', 'f1=50000000&hl=en', self._set_cookie(
'.youtube.com', 'PREF', 'f1=50000000&hl=en',
# YouTube sets the expire time to about two months # YouTube sets the expire time to about two months
expire_time=time.time() + 60*24*3600) expire_time=time.time() + 2 * 30 * 24 * 3600)
def _login(self): def _login(self):
""" """
@ -722,9 +723,11 @@ def _real_extract(self, url):
# We fallback to the get_video_info pages (used by the embed page) # We fallback to the get_video_info pages (used by the embed page)
self.report_video_info_webpage_download(video_id) self.report_video_info_webpage_download(video_id)
for el_type in ['&el=embedded', '&el=detailpage', '&el=vevo', '']: for el_type in ['&el=embedded', '&el=detailpage', '&el=vevo', '']:
video_info_url = (proto + '://www.youtube.com/get_video_info?&video_id=%s%s&ps=default&eurl=&gl=US&hl=en' video_info_url = (
% (video_id, el_type)) '%s://www.youtube.com/get_video_info?&video_id=%s%s&ps=default&eurl=&gl=US&hl=en'
video_info_webpage = self._download_webpage(video_info_url, % (proto, video_id, el_type))
video_info_webpage = self._download_webpage(
video_info_url,
video_id, note=False, video_id, note=False,
errnote='unable to download video info webpage') errnote='unable to download video info webpage')
video_info = compat_parse_qs(video_info_webpage) video_info = compat_parse_qs(video_info_webpage)