mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2024-11-22 16:44:32 +01:00
new info_dict field: uploader_id
This commit is contained in:
parent
1a2c3c0f3e
commit
77c4beab8a
19
README.md
19
README.md
@ -46,15 +46,16 @@ which means you can modify it, redistribute it or use it however you like.
|
|||||||
-A, --auto-number number downloaded files starting from 00000
|
-A, --auto-number number downloaded files starting from 00000
|
||||||
-o, --output TEMPLATE output filename template. Use %(title)s to get the
|
-o, --output TEMPLATE output filename template. Use %(title)s to get the
|
||||||
title, %(uploader)s for the uploader name,
|
title, %(uploader)s for the uploader name,
|
||||||
%(autonumber)s to get an automatically incremented
|
%(uploader_id)s for the uploader nickname if
|
||||||
number, %(ext)s for the filename extension,
|
different, %(autonumber)s to get an automatically
|
||||||
%(upload_date)s for the upload date (YYYYMMDD),
|
incremented number, %(ext)s for the filename
|
||||||
%(extractor)s for the provider (youtube, metacafe,
|
extension, %(upload_date)s for the upload date
|
||||||
etc), %(id)s for the video id and %% for a literal
|
(YYYYMMDD), %(extractor)s for the provider
|
||||||
percent. Use - to output to stdout. Can also be
|
(youtube, metacafe, etc), %(id)s for the video id
|
||||||
used to download to a different directory, for
|
and %% for a literal percent. Use - to output to
|
||||||
example with -o '/my/downloads/%(uploader)s/%(title
|
stdout. Can also be used to download to a different
|
||||||
)s-%(id)s.%(ext)s' .
|
directory, for example with -o '/my/downloads/%(upl
|
||||||
|
oader)s/%(title)s-%(id)s.%(ext)s' .
|
||||||
--restrict-filenames Restrict filenames to only ASCII characters, and
|
--restrict-filenames Restrict filenames to only ASCII characters, and
|
||||||
avoid "&" and spaces in filenames
|
avoid "&" and spaces in filenames
|
||||||
-a, --batch-file FILE file containing URLs to download ('-' for stdin)
|
-a, --batch-file FILE file containing URLs to download ('-' for stdin)
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
"info_dict": {
|
"info_dict": {
|
||||||
"title": "youtube-dl test video \"'/\\ä↭𝕐",
|
"title": "youtube-dl test video \"'/\\ä↭𝕐",
|
||||||
"uploader": "Philipp Hagemeister",
|
"uploader": "Philipp Hagemeister",
|
||||||
|
"uploader_id": "phihag",
|
||||||
"upload_date": "20121002",
|
"upload_date": "20121002",
|
||||||
"description": "test chars: \"'/\\ä↭𝕐\n\nThis is a test video for youtube-dl.\n\nFor more information, contact phihag@phihag.de ."
|
"description": "test chars: \"'/\\ä↭𝕐\n\nThis is a test video for youtube-dl.\n\nFor more information, contact phihag@phihag.de ."
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ class InfoExtractor(object):
|
|||||||
|
|
||||||
id: Video identifier.
|
id: Video identifier.
|
||||||
url: Final video URL.
|
url: Final video URL.
|
||||||
uploader: Nickname of the video uploader, unescaped.
|
uploader: Full name of the video uploader, unescaped.
|
||||||
upload_date: Video upload date (YYYYMMDD).
|
upload_date: Video upload date (YYYYMMDD).
|
||||||
title: Video title, unescaped.
|
title: Video title, unescaped.
|
||||||
ext: Video filename extension.
|
ext: Video filename extension.
|
||||||
@ -42,6 +42,7 @@ class InfoExtractor(object):
|
|||||||
format: The video format, defaults to ext (used for --get-format)
|
format: The video format, defaults to ext (used for --get-format)
|
||||||
thumbnail: Full URL to a video thumbnail image.
|
thumbnail: Full URL to a video thumbnail image.
|
||||||
description: One-line video description.
|
description: One-line video description.
|
||||||
|
uploader_id: Nickname or id of the video uploader.
|
||||||
player_url: SWF Player URL (used for rtmpdump).
|
player_url: SWF Player URL (used for rtmpdump).
|
||||||
subtitles: The .srt file contents.
|
subtitles: The .srt file contents.
|
||||||
urlhandle: [internal] The urlHandle to be used to download the file,
|
urlhandle: [internal] The urlHandle to be used to download the file,
|
||||||
@ -384,10 +385,18 @@ class YoutubeIE(InfoExtractor):
|
|||||||
|
|
||||||
# uploader
|
# uploader
|
||||||
if 'author' not in video_info:
|
if 'author' not in video_info:
|
||||||
self._downloader.trouble(u'ERROR: unable to extract uploader nickname')
|
self._downloader.trouble(u'ERROR: unable to extract uploader name')
|
||||||
return
|
return
|
||||||
video_uploader = compat_urllib_parse.unquote_plus(video_info['author'][0])
|
video_uploader = compat_urllib_parse.unquote_plus(video_info['author'][0])
|
||||||
|
|
||||||
|
# uploader_id
|
||||||
|
video_uploader_id = None
|
||||||
|
mobj = re.search(r'<link itemprop="url" href="http://www.youtube.com/user/([^"]+)">', video_webpage)
|
||||||
|
if mobj is not None:
|
||||||
|
video_uploader_id = mobj.group(1)
|
||||||
|
else:
|
||||||
|
self._downloader.trouble(u'WARNING: unable to extract uploader nickname')
|
||||||
|
|
||||||
# title
|
# title
|
||||||
if 'title' not in video_info:
|
if 'title' not in video_info:
|
||||||
self._downloader.trouble(u'ERROR: unable to extract video title')
|
self._downloader.trouble(u'ERROR: unable to extract video title')
|
||||||
@ -495,6 +504,7 @@ class YoutubeIE(InfoExtractor):
|
|||||||
'id': video_id,
|
'id': video_id,
|
||||||
'url': video_real_url,
|
'url': video_real_url,
|
||||||
'uploader': video_uploader,
|
'uploader': video_uploader,
|
||||||
|
'uploader_id': video_uploader_id,
|
||||||
'upload_date': upload_date,
|
'upload_date': upload_date,
|
||||||
'title': video_title,
|
'title': video_title,
|
||||||
'ext': video_extension,
|
'ext': video_extension,
|
||||||
@ -994,8 +1004,9 @@ class VimeoIE(InfoExtractor):
|
|||||||
# Extract title
|
# Extract title
|
||||||
video_title = config["video"]["title"]
|
video_title = config["video"]["title"]
|
||||||
|
|
||||||
# Extract uploader
|
# Extract uploader and uploader_id
|
||||||
video_uploader = config["video"]["owner"]["name"]
|
video_uploader = config["video"]["owner"]["name"]
|
||||||
|
video_uploader_id = config["video"]["owner"]["url"].split('/')[-1]
|
||||||
|
|
||||||
# Extract video thumbnail
|
# Extract video thumbnail
|
||||||
video_thumbnail = config["video"]["thumbnail"]
|
video_thumbnail = config["video"]["thumbnail"]
|
||||||
@ -1047,6 +1058,7 @@ class VimeoIE(InfoExtractor):
|
|||||||
'id': video_id,
|
'id': video_id,
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
'uploader': video_uploader,
|
'uploader': video_uploader,
|
||||||
|
'uploader_id': video_uploader_id,
|
||||||
'upload_date': video_upload_date,
|
'upload_date': video_upload_date,
|
||||||
'title': video_title,
|
'title': video_title,
|
||||||
'ext': video_extension,
|
'ext': video_extension,
|
||||||
|
@ -307,7 +307,7 @@ def parseOpts():
|
|||||||
action='store_true', dest='autonumber',
|
action='store_true', dest='autonumber',
|
||||||
help='number downloaded files starting from 00000', default=False)
|
help='number downloaded files starting from 00000', default=False)
|
||||||
filesystem.add_option('-o', '--output',
|
filesystem.add_option('-o', '--output',
|
||||||
dest='outtmpl', metavar='TEMPLATE', help='output filename template. Use %(title)s to get the title, %(uploader)s for the uploader name, %(autonumber)s to get an automatically incremented number, %(ext)s for the filename extension, %(upload_date)s for the upload date (YYYYMMDD), %(extractor)s for the provider (youtube, metacafe, etc), %(id)s for the video id and %% for a literal percent. Use - to output to stdout. Can also be used to download to a different directory, for example with -o \'/my/downloads/%(uploader)s/%(title)s-%(id)s.%(ext)s\' .')
|
dest='outtmpl', metavar='TEMPLATE', help='output filename template. Use %(title)s to get the title, %(uploader)s for the uploader name, %(uploader_id)s for the uploader nickname if different, %(autonumber)s to get an automatically incremented number, %(ext)s for the filename extension, %(upload_date)s for the upload date (YYYYMMDD), %(extractor)s for the provider (youtube, metacafe, etc), %(id)s for the video id and %% for a literal percent. Use - to output to stdout. Can also be used to download to a different directory, for example with -o \'/my/downloads/%(uploader)s/%(title)s-%(id)s.%(ext)s\' .')
|
||||||
filesystem.add_option('--restrict-filenames',
|
filesystem.add_option('--restrict-filenames',
|
||||||
action='store_true', dest='restrictfilenames',
|
action='store_true', dest='restrictfilenames',
|
||||||
help='Restrict filenames to only ASCII characters, and avoid "&" and spaces in filenames', default=False)
|
help='Restrict filenames to only ASCII characters, and avoid "&" and spaces in filenames', default=False)
|
||||||
|
Loading…
Reference in New Issue
Block a user