projects
/
youtube-dl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[refactor] Single quotes consistency
[youtube-dl]
/
youtube_dl
/
extractor
/
common.py
diff --git
a/youtube_dl/extractor/common.py
b/youtube_dl/extractor/common.py
index 6b40a8323463c72d1a223d427ade2a978b763d72..f411ea7633568915e4e97df61958d13c6a8aca80 100644
(file)
--- a/
youtube_dl/extractor/common.py
+++ b/
youtube_dl/extractor/common.py
@@
-636,7
+636,7
@@
class InfoExtractor(object):
downloader_params = self._downloader.params
# Attempt to use provided username and password or .netrc data
downloader_params = self._downloader.params
# Attempt to use provided username and password or .netrc data
- if downloader_params.get('username'
, None
) is not None:
+ if downloader_params.get('username') is not None:
username = downloader_params['username']
password = downloader_params['password']
elif downloader_params.get('usenetrc', False):
username = downloader_params['username']
password = downloader_params['password']
elif downloader_params.get('usenetrc', False):
@@
-663,7
+663,7
@@
class InfoExtractor(object):
return None
downloader_params = self._downloader.params
return None
downloader_params = self._downloader.params
- if downloader_params.get('twofactor'
, None
) is not None:
+ if downloader_params.get('twofactor') is not None:
return downloader_params['twofactor']
return compat_getpass('Type %s and press [Return]: ' % note)
return downloader_params['twofactor']
return compat_getpass('Type %s and press [Return]: ' % note)
@@
-744,7
+744,7
@@
class InfoExtractor(object):
'mature': 17,
'restricted': 19,
}
'mature': 17,
'restricted': 19,
}
- return RATING_TABLE.get(rating.lower()
, None
)
+ return RATING_TABLE.get(rating.lower())
def _family_friendly_search(self, html):
# See http://schema.org/VideoObject
def _family_friendly_search(self, html):
# See http://schema.org/VideoObject
@@
-759,7
+759,7
@@
class InfoExtractor(object):
'0': 18,
'false': 18,
}
'0': 18,
'false': 18,
}
- return RATING_TABLE.get(family_friendly.lower()
, None
)
+ return RATING_TABLE.get(family_friendly.lower())
def _twitter_search_player(self, html):
return self._html_search_meta('twitter:player', html,
def _twitter_search_player(self, html):
return self._html_search_meta('twitter:player', html,
@@
-1224,6
+1224,7
@@
class InfoExtractor(object):
continue
src_url = src if src.startswith('http') else compat_urlparse.urljoin(base, src)
continue
src_url = src if src.startswith('http') else compat_urlparse.urljoin(base, src)
+ src_url = src_url.strip()
if proto == 'm3u8' or src_ext == 'm3u8':
m3u8_formats = self._extract_m3u8_formats(
if proto == 'm3u8' or src_ext == 'm3u8':
m3u8_formats = self._extract_m3u8_formats(
@@
-1434,7
+1435,9
@@
class InfoExtractor(object):
base_url = base_url_e.text + base_url
if re.match(r'^https?://', base_url):
break
base_url = base_url_e.text + base_url
if re.match(r'^https?://', base_url):
break
- if not re.match(r'^https?://', base_url):
+ if mpd_base_url and not re.match(r'^https?://', base_url):
+ if not mpd_base_url.endswith('/') and not base_url.startswith('/'):
+ mpd_base_url += '/'
base_url = mpd_base_url + base_url
representation_id = representation_attrib.get('id')
lang = representation_attrib.get('lang')
base_url = mpd_base_url + base_url
representation_id = representation_attrib.get('id')
lang = representation_attrib.get('lang')
@@
-1494,7
+1497,7
@@
class InfoExtractor(object):
def _live_title(self, name):
""" Generate the title for a live video """
now = datetime.datetime.now()
def _live_title(self, name):
""" Generate the title for a live video """
now = datetime.datetime.now()
- now_str = now.strftime(
"%Y-%m-%d %H:%M"
)
+ now_str = now.strftime(
'%Y-%m-%d %H:%M'
)
return name + ' ' + now_str
def _int(self, v, name, fatal=False, **kwargs):
return name + ' ' + now_str
def _int(self, v, name, fatal=False, **kwargs):
@@
-1567,7
+1570,7
@@
class InfoExtractor(object):
return {}
def _get_subtitles(self, *args, **kwargs):
return {}
def _get_subtitles(self, *args, **kwargs):
- raise NotImplementedError(
"This method must be implemented by subclasses"
)
+ raise NotImplementedError(
'This method must be implemented by subclasses'
)
@staticmethod
def _merge_subtitle_items(subtitle_list1, subtitle_list2):
@staticmethod
def _merge_subtitle_items(subtitle_list1, subtitle_list2):
@@
-1593,7
+1596,7
@@
class InfoExtractor(object):
return {}
def _get_automatic_captions(self, *args, **kwargs):
return {}
def _get_automatic_captions(self, *args, **kwargs):
- raise NotImplementedError(
"This method must be implemented by subclasses"
)
+ raise NotImplementedError(
'This method must be implemented by subclasses'
)
class SearchInfoExtractor(InfoExtractor):
class SearchInfoExtractor(InfoExtractor):
@@
-1633,7
+1636,7
@@
class SearchInfoExtractor(InfoExtractor):
def _get_n_results(self, query, n):
"""Get a specified number of results for a query"""
def _get_n_results(self, query, n):
"""Get a specified number of results for a query"""
- raise NotImplementedError(
"This method must be implemented by subclasses"
)
+ raise NotImplementedError(
'This method must be implemented by subclasses'
)
@property
def SEARCH_KEY(self):
@property
def SEARCH_KEY(self):