ContentTooShortError,
date_from_str,
DateRange,
+ DEFAULT_OUTTMPL,
determine_ext,
DownloadError,
encodeFilename,
if v is not None)
template_dict = collections.defaultdict(lambda: 'NA', template_dict)
- tmpl = os.path.expanduser(self.params['outtmpl'])
+ outtmpl = self.params.get('outtmpl', DEFAULT_OUTTMPL)
+ tmpl = os.path.expanduser(outtmpl)
filename = tmpl % template_dict
return filename
except ValueError as err:
def download(self, url_list):
"""Download a given list of URLs."""
+ outtmpl = self.params.get('outtmpl', DEFAULT_OUTTMPL)
if (len(url_list) > 1 and
- '%' not in self.params['outtmpl']
+ '%' not in outtmpl
and self.params.get('max_downloads') != 1):
- raise SameFileError(self.params['outtmpl'])
+ raise SameFileError(outtmpl)
for url in url_list:
try:
compat_getpass,
compat_print,
DateRange,
+ DEFAULT_OUTTMPL,
decodeOption,
get_term_width,
DownloadError,
or (opts.usetitle and u'%(title)s-%(id)s.%(ext)s')
or (opts.useid and u'%(id)s.%(ext)s')
or (opts.autonumber and u'%(autonumber)s-%(id)s.%(ext)s')
- or u'%(title)s-%(id)s.%(ext)s')
+ or DEFAULT_OUTTMPL)
if not os.path.splitext(outtmpl)[1] and opts.extractaudio:
parser.error(u'Cannot download a video and extract audio into the same'
u' file! Use "{0}.%(ext)s" instead of "{0}" as the output'
data = json.loads(self._html_search_regex(
r'window\.POST_DATA = { %s: ({.+?}) }' % video_id, webpage, 'vine data'))
-
+ print(json.dumps(data, indent=2))
formats = [
{
'url': data['videoLowURL'],
'comment_count': data['comments']['count'],
'repost_count': data['reposts']['count'],
'formats': formats,
- }
\ No newline at end of file
+ }
return -1
return q
+
+DEFAULT_OUTTMPL = '%(title)s-%(id)s.%(ext)s'