Compare commits
161 Commits
2013.01.17
...
2014.01.27
Author | SHA1 | Date | |
---|---|---|---|
|
b21a918984 | ||
|
f9b8549609 | ||
|
e2ba07024f | ||
|
9b05bd42e5 | ||
|
b6d3a99678 | ||
|
96d7b8873a | ||
|
efc867775e | ||
|
5ab772f09c | ||
|
2a89386232 | ||
|
4d9be98dbc | ||
|
6737907826 | ||
|
c060b77446 | ||
|
7e8caf30c0 | ||
|
ca3e054750 | ||
|
1da1558f46 | ||
|
25c67d257c | ||
|
a17d16d59c | ||
|
d16076ff3e | ||
|
6c57e8a063 | ||
|
db1f388878 | ||
|
0f2999fe2b | ||
|
53bfd6b24c | ||
|
5700e7792a | ||
|
38c2e5b8d5 | ||
|
48f9678a32 | ||
|
beddbc2ad1 | ||
|
f89197d73e | ||
|
944d65c762 | ||
|
f945612bd0 | ||
|
59188de113 | ||
|
352d08e3e5 | ||
|
bacb5e4f44 | ||
|
008af8660b | ||
|
886fa72324 | ||
|
2c5bae429a | ||
|
f265fc1238 | ||
|
1394ce65b4 | ||
|
67ccb77197 | ||
|
63ef36e8d8 | ||
|
0b65e5d40f | ||
|
629be17af4 | ||
|
fd28827864 | ||
|
8c61d9a9b1 | ||
|
975d35dbab | ||
|
8b769664c4 | ||
|
76f270a46a | ||
|
9dab1b7f28 | ||
|
d3e5bbf437 | ||
|
18a25c5d78 | ||
|
924f47f7b6 | ||
|
22ff1c4a93 | ||
|
35409e1101 | ||
|
65d781128a | ||
|
c35b1b07e2 | ||
|
066f6a0630 | ||
|
12ed57418c | ||
|
8b1be5cd73 | ||
|
780083dbc6 | ||
|
4919603f66 | ||
|
dd26ced164 | ||
|
bd2d82a5d3 | ||
|
c4cd138b92 | ||
|
65697b3bf3 | ||
|
50317b111d | ||
|
d7975ea287 | ||
|
714d709a31 | ||
|
11577ec054 | ||
|
79bf58f9b5 | ||
|
cd8a562267 | ||
|
de3ef3ed58 | ||
|
8908741806 | ||
|
ba7678f9cc | ||
|
a70c83768e | ||
|
04b4d394d9 | ||
|
130f12985a | ||
|
4ca5d43cd8 | ||
|
4bbf139aa7 | ||
|
47739636a9 | ||
|
407ae733ab | ||
|
c39f7013e1 | ||
|
a4a028323e | ||
|
780ee4e501 | ||
|
d7b51547c0 | ||
|
43030f36db | ||
|
48c63f1653 | ||
|
90f479b6d5 | ||
|
6fd2957163 | ||
|
d3a1c71917 | ||
|
af1588c05f | ||
|
2250865fb0 | ||
|
99f770caa8 | ||
|
00122de6a9 | ||
|
a70515c0fd | ||
|
398edd0689 | ||
|
6562df768d | ||
|
06769acd71 | ||
|
32dac6943d | ||
|
90834c78fe | ||
|
47917f24c4 | ||
|
d614aa40e3 | ||
|
bc4ba05fcb | ||
|
8d9453b9e8 | ||
|
e4f320a4d0 | ||
|
ef9f2ba7af | ||
|
4a3b72771f | ||
|
913f32929b | ||
|
9834872bf6 | ||
|
94a23d2a1e | ||
|
608bf69880 | ||
|
032b3df5af | ||
|
9d11a41fe4 | ||
|
2989501131 | ||
|
7b0817e8e1 | ||
|
9d4288b2d4 | ||
|
3486df383b | ||
|
b60016e831 | ||
|
5aafe895fc | ||
|
b853d2e155 | ||
|
b7ab059084 | ||
|
c91778f8c0 | ||
|
5016f3eac8 | ||
|
efb1bb90a0 | ||
|
4cf393bb4b | ||
|
ce4e242a6f | ||
|
b27bec212f | ||
|
704519c7e3 | ||
|
6b79f40c3d | ||
|
dd27fd1739 | ||
|
dfa50793d8 | ||
|
2a7c35dd46 | ||
|
f2ffd10bb2 | ||
|
8da531359e | ||
|
e2b944cf43 | ||
|
3ec05685f7 | ||
|
e103fd46ca | ||
|
877bfd69d1 | ||
|
e0ef49f205 | ||
|
f68cd00fe3 | ||
|
ca70d215cf | ||
|
d0390a0c92 | ||
|
dd2535c38a | ||
|
b78d180170 | ||
|
26dca1661e | ||
|
f853f8594d | ||
|
8307aa73fb | ||
|
d0da491e1e | ||
|
6e249060cf | ||
|
fbcd7b5f83 | ||
|
9ac0a67581 | ||
|
befdc8f3b6 | ||
|
bb198c95e2 | ||
|
c1195541b7 | ||
|
26844eb57b | ||
|
a7732b672e | ||
|
677b3ce82f | ||
|
fabfe17d5e | ||
|
82696d5d5d | ||
|
58c3c7ae38 | ||
|
c8650f7ecd | ||
|
14e7543a5a | ||
|
bf6705f584 |
406
README.md
406
README.md
@@ -14,193 +14,229 @@ your Unix box, on Windows or on Mac OS X. It is released to the public domain,
|
|||||||
which means you can modify it, redistribute it or use it however you like.
|
which means you can modify it, redistribute it or use it however you like.
|
||||||
|
|
||||||
# OPTIONS
|
# OPTIONS
|
||||||
-h, --help print this help text and exit
|
-h, --help print this help text and exit
|
||||||
--version print program version and exit
|
--version print program version and exit
|
||||||
-U, --update update this program to latest version. Make sure
|
-U, --update update this program to latest version. Make
|
||||||
that you have sufficient permissions (run with
|
sure that you have sufficient permissions
|
||||||
sudo if needed)
|
(run with sudo if needed)
|
||||||
-i, --ignore-errors continue on download errors, for example to to
|
-i, --ignore-errors continue on download errors, for example to
|
||||||
skip unavailable videos in a playlist
|
to skip unavailable videos in a playlist
|
||||||
--abort-on-error Abort downloading of further videos (in the
|
--abort-on-error Abort downloading of further videos (in the
|
||||||
playlist or the command line) if an error occurs
|
playlist or the command line) if an error
|
||||||
--dump-user-agent display the current browser identification
|
occurs
|
||||||
--user-agent UA specify a custom user agent
|
--dump-user-agent display the current browser identification
|
||||||
--referer REF specify a custom referer, use if the video access
|
--user-agent UA specify a custom user agent
|
||||||
is restricted to one domain
|
--referer REF specify a custom referer, use if the video
|
||||||
--list-extractors List all supported extractors and the URLs they
|
access is restricted to one domain
|
||||||
would handle
|
--list-extractors List all supported extractors and the URLs
|
||||||
--extractor-descriptions Output descriptions of all supported extractors
|
they would handle
|
||||||
--proxy URL Use the specified HTTP/HTTPS proxy. Pass in an
|
--extractor-descriptions Output descriptions of all supported
|
||||||
empty string (--proxy "") for direct connection
|
extractors
|
||||||
--no-check-certificate Suppress HTTPS certificate validation.
|
--proxy URL Use the specified HTTP/HTTPS proxy. Pass in
|
||||||
--cache-dir DIR Location in the filesystem where youtube-dl can
|
an empty string (--proxy "") for direct
|
||||||
store some downloaded information permanently. By
|
connection
|
||||||
default $XDG_CACHE_HOME/youtube-dl or ~/.cache
|
--no-check-certificate Suppress HTTPS certificate validation.
|
||||||
/youtube-dl . At the moment, only YouTube player
|
--cache-dir DIR Location in the filesystem where youtube-dl
|
||||||
files (for videos with obfuscated signatures) are
|
can store some downloaded information
|
||||||
cached, but that may change.
|
permanently. By default $XDG_CACHE_HOME
|
||||||
--no-cache-dir Disable filesystem caching
|
/youtube-dl or ~/.cache/youtube-dl . At the
|
||||||
--socket-timeout None Time to wait before giving up, in seconds
|
moment, only YouTube player files (for
|
||||||
--bidi-workaround Work around terminals that lack bidirectional
|
videos with obfuscated signatures) are
|
||||||
text support. Requires bidiv or fribidi
|
cached, but that may change.
|
||||||
executable in PATH
|
--no-cache-dir Disable filesystem caching
|
||||||
|
--socket-timeout None Time to wait before giving up, in seconds
|
||||||
|
--bidi-workaround Work around terminals that lack
|
||||||
|
bidirectional text support. Requires bidiv
|
||||||
|
or fribidi executable in PATH
|
||||||
|
--default-search PREFIX Use this prefix for unqualified URLs. For
|
||||||
|
example "gvsearch2:" downloads two videos
|
||||||
|
from google videos for youtube-dl "large
|
||||||
|
apple". By default (with value "auto")
|
||||||
|
youtube-dl guesses.
|
||||||
|
|
||||||
## Video Selection:
|
## Video Selection:
|
||||||
--playlist-start NUMBER playlist video to start at (default is 1)
|
--playlist-start NUMBER playlist video to start at (default is 1)
|
||||||
--playlist-end NUMBER playlist video to end at (default is last)
|
--playlist-end NUMBER playlist video to end at (default is last)
|
||||||
--match-title REGEX download only matching titles (regex or caseless
|
--match-title REGEX download only matching titles (regex or
|
||||||
sub-string)
|
caseless sub-string)
|
||||||
--reject-title REGEX skip download for matching titles (regex or
|
--reject-title REGEX skip download for matching titles (regex or
|
||||||
caseless sub-string)
|
caseless sub-string)
|
||||||
--max-downloads NUMBER Abort after downloading NUMBER files
|
--max-downloads NUMBER Abort after downloading NUMBER files
|
||||||
--min-filesize SIZE Do not download any videos smaller than SIZE
|
--min-filesize SIZE Do not download any videos smaller than
|
||||||
(e.g. 50k or 44.6m)
|
SIZE (e.g. 50k or 44.6m)
|
||||||
--max-filesize SIZE Do not download any videos larger than SIZE (e.g.
|
--max-filesize SIZE Do not download any videos larger than SIZE
|
||||||
50k or 44.6m)
|
(e.g. 50k or 44.6m)
|
||||||
--date DATE download only videos uploaded in this date
|
--date DATE download only videos uploaded in this date
|
||||||
--datebefore DATE download only videos uploaded on or before this
|
--datebefore DATE download only videos uploaded on or before
|
||||||
date (i.e. inclusive)
|
this date (i.e. inclusive)
|
||||||
--dateafter DATE download only videos uploaded on or after this
|
--dateafter DATE download only videos uploaded on or after
|
||||||
date (i.e. inclusive)
|
this date (i.e. inclusive)
|
||||||
--min-views COUNT Do not download any videos with less than COUNT
|
--min-views COUNT Do not download any videos with less than
|
||||||
views
|
COUNT views
|
||||||
--max-views COUNT Do not download any videos with more than COUNT
|
--max-views COUNT Do not download any videos with more than
|
||||||
views
|
COUNT views
|
||||||
--no-playlist download only the currently playing video
|
--no-playlist download only the currently playing video
|
||||||
--age-limit YEARS download only videos suitable for the given age
|
--age-limit YEARS download only videos suitable for the given
|
||||||
--download-archive FILE Download only videos not listed in the archive
|
age
|
||||||
file. Record the IDs of all downloaded videos in
|
--download-archive FILE Download only videos not listed in the
|
||||||
it.
|
archive file. Record the IDs of all
|
||||||
|
downloaded videos in it.
|
||||||
|
--include-ads Download advertisements as well
|
||||||
|
(experimental)
|
||||||
|
--youtube-include-dash-manifest Try to download the DASH manifest on
|
||||||
|
YouTube videos (experimental)
|
||||||
|
|
||||||
## Download Options:
|
## Download Options:
|
||||||
-r, --rate-limit LIMIT maximum download rate in bytes per second (e.g.
|
-r, --rate-limit LIMIT maximum download rate in bytes per second
|
||||||
50K or 4.2M)
|
(e.g. 50K or 4.2M)
|
||||||
-R, --retries RETRIES number of retries (default is 10)
|
-R, --retries RETRIES number of retries (default is 10)
|
||||||
--buffer-size SIZE size of download buffer (e.g. 1024 or 16K)
|
--buffer-size SIZE size of download buffer (e.g. 1024 or 16K)
|
||||||
(default is 1024)
|
(default is 1024)
|
||||||
--no-resize-buffer do not automatically adjust the buffer size. By
|
--no-resize-buffer do not automatically adjust the buffer
|
||||||
default, the buffer size is automatically resized
|
size. By default, the buffer size is
|
||||||
from an initial value of SIZE.
|
automatically resized from an initial value
|
||||||
|
of SIZE.
|
||||||
|
|
||||||
## Filesystem Options:
|
## Filesystem Options:
|
||||||
-t, --title use title in file name (default)
|
-t, --title use title in file name (default)
|
||||||
--id use only video ID in file name
|
--id use only video ID in file name
|
||||||
-l, --literal [deprecated] alias of --title
|
-l, --literal [deprecated] alias of --title
|
||||||
-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
|
-o, --output TEMPLATE output filename template. Use %(title)s to
|
||||||
the title, %(uploader)s for the uploader name,
|
get the title, %(uploader)s for the
|
||||||
%(uploader_id)s for the uploader nickname if
|
uploader name, %(uploader_id)s for the
|
||||||
different, %(autonumber)s to get an automatically
|
uploader nickname if different,
|
||||||
incremented number, %(ext)s for the filename
|
%(autonumber)s to get an automatically
|
||||||
extension, %(format)s for the format description
|
incremented number, %(ext)s for the
|
||||||
(like "22 - 1280x720" or "HD"), %(format_id)s for
|
filename extension, %(format)s for the
|
||||||
the unique id of the format (like Youtube's
|
format description (like "22 - 1280x720" or
|
||||||
itags: "137"), %(upload_date)s for the upload
|
"HD"), %(format_id)s for the unique id of
|
||||||
date (YYYYMMDD), %(extractor)s for the provider
|
the format (like Youtube's itags: "137"),
|
||||||
(youtube, metacafe, etc), %(id)s for the video
|
%(upload_date)s for the upload date
|
||||||
id, %(playlist)s for the playlist the video is
|
(YYYYMMDD), %(extractor)s for the provider
|
||||||
in, %(playlist_index)s for the position in the
|
(youtube, metacafe, etc), %(id)s for the
|
||||||
playlist and %% for a literal percent. Use - to
|
video id, %(playlist)s for the playlist the
|
||||||
output to stdout. Can also be used to download to
|
video is in, %(playlist_index)s for the
|
||||||
a different directory, for example with -o '/my/d
|
position in the playlist and %% for a
|
||||||
ownloads/%(uploader)s/%(title)s-%(id)s.%(ext)s' .
|
literal percent. Use - to output to stdout.
|
||||||
--autonumber-size NUMBER Specifies the number of digits in %(autonumber)s
|
Can also be used to download to a different
|
||||||
when it is present in output filename template or
|
directory, for example with -o '/my/downloa
|
||||||
--auto-number option is given
|
ds/%(uploader)s/%(title)s-%(id)s.%(ext)s' .
|
||||||
--restrict-filenames Restrict filenames to only ASCII characters, and
|
--autonumber-size NUMBER Specifies the number of digits in
|
||||||
avoid "&" and spaces in filenames
|
%(autonumber)s when it is present in output
|
||||||
-a, --batch-file FILE file containing URLs to download ('-' for stdin)
|
filename template or --auto-number option
|
||||||
--load-info FILE json file containing the video information
|
is given
|
||||||
(created with the "--write-json" option)
|
--restrict-filenames Restrict filenames to only ASCII
|
||||||
-w, --no-overwrites do not overwrite files
|
characters, and avoid "&" and spaces in
|
||||||
-c, --continue force resume of partially downloaded files. By
|
filenames
|
||||||
default, youtube-dl will resume downloads if
|
-a, --batch-file FILE file containing URLs to download ('-' for
|
||||||
possible.
|
stdin)
|
||||||
--no-continue do not resume partially downloaded files (restart
|
--load-info FILE json file containing the video information
|
||||||
from beginning)
|
(created with the "--write-json" option)
|
||||||
--cookies FILE file to read cookies from and dump cookie jar in
|
-w, --no-overwrites do not overwrite files
|
||||||
--no-part do not use .part files
|
-c, --continue force resume of partially downloaded files.
|
||||||
--no-mtime do not use the Last-modified header to set the
|
By default, youtube-dl will resume
|
||||||
file modification time
|
downloads if possible.
|
||||||
--write-description write video description to a .description file
|
--no-continue do not resume partially downloaded files
|
||||||
--write-info-json write video metadata to a .info.json file
|
(restart from beginning)
|
||||||
--write-annotations write video annotations to a .annotation file
|
--cookies FILE file to read cookies from and dump cookie
|
||||||
--write-thumbnail write thumbnail image to disk
|
jar in
|
||||||
|
--no-part do not use .part files
|
||||||
|
--no-mtime do not use the Last-modified header to set
|
||||||
|
the file modification time
|
||||||
|
--write-description write video description to a .description
|
||||||
|
file
|
||||||
|
--write-info-json write video metadata to a .info.json file
|
||||||
|
--write-annotations write video annotations to a .annotation
|
||||||
|
file
|
||||||
|
--write-thumbnail write thumbnail image to disk
|
||||||
|
|
||||||
## Verbosity / Simulation Options:
|
## Verbosity / Simulation Options:
|
||||||
-q, --quiet activates quiet mode
|
-q, --quiet activates quiet mode
|
||||||
-s, --simulate do not download the video and do not write
|
-s, --simulate do not download the video and do not write
|
||||||
anything to disk
|
anything to disk
|
||||||
--skip-download do not download the video
|
--skip-download do not download the video
|
||||||
-g, --get-url simulate, quiet but print URL
|
-g, --get-url simulate, quiet but print URL
|
||||||
-e, --get-title simulate, quiet but print title
|
-e, --get-title simulate, quiet but print title
|
||||||
--get-id simulate, quiet but print id
|
--get-id simulate, quiet but print id
|
||||||
--get-thumbnail simulate, quiet but print thumbnail URL
|
--get-thumbnail simulate, quiet but print thumbnail URL
|
||||||
--get-description simulate, quiet but print video description
|
--get-description simulate, quiet but print video description
|
||||||
--get-duration simulate, quiet but print video length
|
--get-duration simulate, quiet but print video length
|
||||||
--get-filename simulate, quiet but print output filename
|
--get-filename simulate, quiet but print output filename
|
||||||
--get-format simulate, quiet but print output format
|
--get-format simulate, quiet but print output format
|
||||||
-j, --dump-json simulate, quiet but print JSON information
|
-j, --dump-json simulate, quiet but print JSON information
|
||||||
--newline output progress bar as new lines
|
--newline output progress bar as new lines
|
||||||
--no-progress do not print progress bar
|
--no-progress do not print progress bar
|
||||||
--console-title display progress in console titlebar
|
--console-title display progress in console titlebar
|
||||||
-v, --verbose print various debugging information
|
-v, --verbose print various debugging information
|
||||||
--dump-intermediate-pages print downloaded pages to debug problems (very
|
--dump-intermediate-pages print downloaded pages to debug problems
|
||||||
verbose)
|
(very verbose)
|
||||||
--write-pages Write downloaded intermediary pages to files in
|
--write-pages Write downloaded intermediary pages to
|
||||||
the current directory to debug problems
|
files in the current directory to debug
|
||||||
|
problems
|
||||||
|
--print-traffic Display sent and read HTTP traffic
|
||||||
|
|
||||||
## Video Format Options:
|
## Video Format Options:
|
||||||
-f, --format FORMAT video format code, specify the order of
|
-f, --format FORMAT video format code, specify the order of
|
||||||
preference using slashes: "-f 22/17/18". "-f mp4"
|
preference using slashes: "-f 22/17/18".
|
||||||
and "-f flv" are also supported
|
"-f mp4" and "-f flv" are also supported.
|
||||||
--all-formats download all available video formats
|
You can also use the special names "best",
|
||||||
--prefer-free-formats prefer free video formats unless a specific one
|
"bestaudio", "worst", and "worstaudio". By
|
||||||
is requested
|
default, youtube-dl will pick the best
|
||||||
--max-quality FORMAT highest quality format to download
|
quality.
|
||||||
-F, --list-formats list all available formats
|
--all-formats download all available video formats
|
||||||
|
--prefer-free-formats prefer free video formats unless a specific
|
||||||
|
one is requested
|
||||||
|
--max-quality FORMAT highest quality format to download
|
||||||
|
-F, --list-formats list all available formats
|
||||||
|
|
||||||
## Subtitle Options:
|
## Subtitle Options:
|
||||||
--write-sub write subtitle file
|
--write-sub write subtitle file
|
||||||
--write-auto-sub write automatic subtitle file (youtube only)
|
--write-auto-sub write automatic subtitle file (youtube
|
||||||
--all-subs downloads all the available subtitles of the
|
only)
|
||||||
video
|
--all-subs downloads all the available subtitles of
|
||||||
--list-subs lists all available subtitles for the video
|
the video
|
||||||
--sub-format FORMAT subtitle format (default=srt) ([sbv/vtt] youtube
|
--list-subs lists all available subtitles for the video
|
||||||
only)
|
--sub-format FORMAT subtitle format (default=srt) ([sbv/vtt]
|
||||||
--sub-lang LANGS languages of the subtitles to download (optional)
|
youtube only)
|
||||||
separated by commas, use IETF language tags like
|
--sub-lang LANGS languages of the subtitles to download
|
||||||
'en,pt'
|
(optional) separated by commas, use IETF
|
||||||
|
language tags like 'en,pt'
|
||||||
|
|
||||||
## Authentication Options:
|
## Authentication Options:
|
||||||
-u, --username USERNAME account username
|
-u, --username USERNAME account username
|
||||||
-p, --password PASSWORD account password
|
-p, --password PASSWORD account password
|
||||||
-n, --netrc use .netrc authentication data
|
-n, --netrc use .netrc authentication data
|
||||||
--video-password PASSWORD video password (vimeo, smotri)
|
--video-password PASSWORD video password (vimeo, smotri)
|
||||||
|
|
||||||
## Post-processing Options:
|
## Post-processing Options:
|
||||||
-x, --extract-audio convert video files to audio-only files (requires
|
-x, --extract-audio convert video files to audio-only files
|
||||||
ffmpeg or avconv and ffprobe or avprobe)
|
(requires ffmpeg or avconv and ffprobe or
|
||||||
--audio-format FORMAT "best", "aac", "vorbis", "mp3", "m4a", "opus", or
|
avprobe)
|
||||||
"wav"; best by default
|
--audio-format FORMAT "best", "aac", "vorbis", "mp3", "m4a",
|
||||||
--audio-quality QUALITY ffmpeg/avconv audio quality specification, insert
|
"opus", or "wav"; best by default
|
||||||
a value between 0 (better) and 9 (worse) for VBR
|
--audio-quality QUALITY ffmpeg/avconv audio quality specification,
|
||||||
or a specific bitrate like 128K (default 5)
|
insert a value between 0 (better) and 9
|
||||||
--recode-video FORMAT Encode the video to another format if necessary
|
(worse) for VBR or a specific bitrate like
|
||||||
(currently supported: mp4|flv|ogg|webm)
|
128K (default 5)
|
||||||
-k, --keep-video keeps the video file on disk after the post-
|
--recode-video FORMAT Encode the video to another format if
|
||||||
processing; the video is erased by default
|
necessary (currently supported:
|
||||||
--no-post-overwrites do not overwrite post-processed files; the post-
|
mp4|flv|ogg|webm)
|
||||||
processed files are overwritten by default
|
-k, --keep-video keeps the video file on disk after the
|
||||||
--embed-subs embed subtitles in the video (only for mp4
|
post-processing; the video is erased by
|
||||||
videos)
|
default
|
||||||
--add-metadata write metadata to the video file
|
--no-post-overwrites do not overwrite post-processed files; the
|
||||||
--xattrs write metadata to the video file's xattrs (using
|
post-processed files are overwritten by
|
||||||
dublin core and xdg standards)
|
default
|
||||||
--prefer-avconv Prefer avconv over ffmpeg for running the
|
--embed-subs embed subtitles in the video (only for mp4
|
||||||
postprocessors (default)
|
videos)
|
||||||
--prefer-ffmpeg Prefer ffmpeg over avconv for running the
|
--add-metadata write metadata to the video file
|
||||||
postprocessors
|
--xattrs write metadata to the video file's xattrs
|
||||||
|
(using dublin core and xdg standards)
|
||||||
|
--prefer-avconv Prefer avconv over ffmpeg for running the
|
||||||
|
postprocessors (default)
|
||||||
|
--prefer-ffmpeg Prefer ffmpeg over avconv for running the
|
||||||
|
postprocessors
|
||||||
|
|
||||||
# CONFIGURATION
|
# CONFIGURATION
|
||||||
|
|
||||||
@@ -289,11 +325,27 @@ Since June 2012 (#342) youtube-dl is packed as an executable zipfile, simply unz
|
|||||||
|
|
||||||
To run the exe you need to install first the [Microsoft Visual C++ 2008 Redistributable Package](http://www.microsoft.com/en-us/download/details.aspx?id=29).
|
To run the exe you need to install first the [Microsoft Visual C++ 2008 Redistributable Package](http://www.microsoft.com/en-us/download/details.aspx?id=29).
|
||||||
|
|
||||||
# COPYRIGHT
|
# BUILD INSTRUCTIONS
|
||||||
|
|
||||||
youtube-dl is released into the public domain by the copyright holders.
|
Most users do not need to build youtube-dl and can [download the builds](http://rg3.github.io/youtube-dl/download.html) or get them from their distribution.
|
||||||
|
|
||||||
This README file was originally written by Daniel Bolton (<https://github.com/dbbolton>) and is likewise released into the public domain.
|
To run youtube-dl as a developer, you don't need to build anything either. Simply execute
|
||||||
|
|
||||||
|
python -m youtube_dl
|
||||||
|
|
||||||
|
To run the test, simply invoke your favorite test runner, or execute a test file directly; any of the following work:
|
||||||
|
|
||||||
|
python -m unittest discover
|
||||||
|
python test/test_download.py
|
||||||
|
nosetests
|
||||||
|
|
||||||
|
If you want to create a build of youtube-dl yourself, you'll need
|
||||||
|
|
||||||
|
* python
|
||||||
|
* make
|
||||||
|
* pandoc
|
||||||
|
* zip
|
||||||
|
* nosetests
|
||||||
|
|
||||||
# BUGS
|
# BUGS
|
||||||
|
|
||||||
@@ -352,3 +404,9 @@ Only post features that you (or an incapicated friend you can personally talk to
|
|||||||
### Is your question about youtube-dl?
|
### Is your question about youtube-dl?
|
||||||
|
|
||||||
It may sound strange, but some bug reports we receive are completely unrelated to youtube-dl and relate to a different or even the reporter's own application. Please make sure that you are actually using youtube-dl. If you are using a UI for youtube-dl, report the bug to the maintainer of the actual application providing the UI. On the other hand, if your UI for youtube-dl fails in some way you believe is related to youtube-dl, by all means, go ahead and report the bug.
|
It may sound strange, but some bug reports we receive are completely unrelated to youtube-dl and relate to a different or even the reporter's own application. Please make sure that you are actually using youtube-dl. If you are using a UI for youtube-dl, report the bug to the maintainer of the actual application providing the UI. On the other hand, if your UI for youtube-dl fails in some way you believe is related to youtube-dl, by all means, go ahead and report the bug.
|
||||||
|
|
||||||
|
# COPYRIGHT
|
||||||
|
|
||||||
|
youtube-dl is released into the public domain by the copyright holders.
|
||||||
|
|
||||||
|
This README file was originally written by Daniel Bolton (<https://github.com/dbbolton>) and is likewise released into the public domain.
|
||||||
|
24
setup.py
24
setup.py
@@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
import os.path
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
|
import warnings
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -44,12 +46,24 @@ py2exe_params = {
|
|||||||
if len(sys.argv) >= 2 and sys.argv[1] == 'py2exe':
|
if len(sys.argv) >= 2 and sys.argv[1] == 'py2exe':
|
||||||
params = py2exe_params
|
params = py2exe_params
|
||||||
else:
|
else:
|
||||||
|
files_spec = [
|
||||||
|
('etc/bash_completion.d', ['youtube-dl.bash-completion']),
|
||||||
|
('share/doc/youtube_dl', ['README.txt']),
|
||||||
|
('share/man/man1', ['youtube-dl.1'])
|
||||||
|
]
|
||||||
|
root = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
data_files = []
|
||||||
|
for dirname, files in files_spec:
|
||||||
|
resfiles = []
|
||||||
|
for fn in files:
|
||||||
|
if not os.path.exists(fn):
|
||||||
|
warnings.warn('Skipping file %s since it is not present. Type make to build all automatically generated files.' % fn)
|
||||||
|
else:
|
||||||
|
resfiles.append(fn)
|
||||||
|
data_files.append((dirname, resfiles))
|
||||||
|
|
||||||
params = {
|
params = {
|
||||||
'data_files': [ # Installing system-wide would require sudo...
|
'data_files': data_files,
|
||||||
('etc/bash_completion.d', ['youtube-dl.bash-completion']),
|
|
||||||
('share/doc/youtube_dl', ['README.txt']),
|
|
||||||
('share/man/man1', ['youtube-dl.1'])
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
if setuptools_available:
|
if setuptools_available:
|
||||||
params['entry_points'] = {'console_scripts': ['youtube-dl = youtube_dl:main']}
|
params['entry_points'] = {'console_scripts': ['youtube-dl = youtube_dl:main']}
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
# Allow direct execution
|
# Allow direct execution
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
@@ -30,125 +32,155 @@ class TestFormatSelection(unittest.TestCase):
|
|||||||
ydl = YDL()
|
ydl = YDL()
|
||||||
ydl.params['prefer_free_formats'] = True
|
ydl.params['prefer_free_formats'] = True
|
||||||
formats = [
|
formats = [
|
||||||
{u'ext': u'webm', u'height': 460},
|
{'ext': 'webm', 'height': 460},
|
||||||
{u'ext': u'mp4', u'height': 460},
|
{'ext': 'mp4', 'height': 460},
|
||||||
]
|
]
|
||||||
info_dict = {u'formats': formats, u'extractor': u'test'}
|
info_dict = {'formats': formats, 'extractor': 'test'}
|
||||||
yie = YoutubeIE(ydl)
|
yie = YoutubeIE(ydl)
|
||||||
yie._sort_formats(info_dict['formats'])
|
yie._sort_formats(info_dict['formats'])
|
||||||
ydl.process_ie_result(info_dict)
|
ydl.process_ie_result(info_dict)
|
||||||
downloaded = ydl.downloaded_info_dicts[0]
|
downloaded = ydl.downloaded_info_dicts[0]
|
||||||
self.assertEqual(downloaded[u'ext'], u'webm')
|
self.assertEqual(downloaded['ext'], 'webm')
|
||||||
|
|
||||||
# Different resolution => download best quality (mp4)
|
# Different resolution => download best quality (mp4)
|
||||||
ydl = YDL()
|
ydl = YDL()
|
||||||
ydl.params['prefer_free_formats'] = True
|
ydl.params['prefer_free_formats'] = True
|
||||||
formats = [
|
formats = [
|
||||||
{u'ext': u'webm', u'height': 720},
|
{'ext': 'webm', 'height': 720},
|
||||||
{u'ext': u'mp4', u'height': 1080},
|
{'ext': 'mp4', 'height': 1080},
|
||||||
]
|
]
|
||||||
info_dict[u'formats'] = formats
|
info_dict['formats'] = formats
|
||||||
yie = YoutubeIE(ydl)
|
yie = YoutubeIE(ydl)
|
||||||
yie._sort_formats(info_dict['formats'])
|
yie._sort_formats(info_dict['formats'])
|
||||||
ydl.process_ie_result(info_dict)
|
ydl.process_ie_result(info_dict)
|
||||||
downloaded = ydl.downloaded_info_dicts[0]
|
downloaded = ydl.downloaded_info_dicts[0]
|
||||||
self.assertEqual(downloaded[u'ext'], u'mp4')
|
self.assertEqual(downloaded['ext'], 'mp4')
|
||||||
|
|
||||||
# No prefer_free_formats => prefer mp4 and flv for greater compatibilty
|
# No prefer_free_formats => prefer mp4 and flv for greater compatibilty
|
||||||
ydl = YDL()
|
ydl = YDL()
|
||||||
ydl.params['prefer_free_formats'] = False
|
ydl.params['prefer_free_formats'] = False
|
||||||
formats = [
|
formats = [
|
||||||
{u'ext': u'webm', u'height': 720},
|
{'ext': 'webm', 'height': 720},
|
||||||
{u'ext': u'mp4', u'height': 720},
|
{'ext': 'mp4', 'height': 720},
|
||||||
{u'ext': u'flv', u'height': 720},
|
{'ext': 'flv', 'height': 720},
|
||||||
]
|
]
|
||||||
info_dict[u'formats'] = formats
|
info_dict['formats'] = formats
|
||||||
yie = YoutubeIE(ydl)
|
yie = YoutubeIE(ydl)
|
||||||
yie._sort_formats(info_dict['formats'])
|
yie._sort_formats(info_dict['formats'])
|
||||||
ydl.process_ie_result(info_dict)
|
ydl.process_ie_result(info_dict)
|
||||||
downloaded = ydl.downloaded_info_dicts[0]
|
downloaded = ydl.downloaded_info_dicts[0]
|
||||||
self.assertEqual(downloaded[u'ext'], u'mp4')
|
self.assertEqual(downloaded['ext'], 'mp4')
|
||||||
|
|
||||||
ydl = YDL()
|
ydl = YDL()
|
||||||
ydl.params['prefer_free_formats'] = False
|
ydl.params['prefer_free_formats'] = False
|
||||||
formats = [
|
formats = [
|
||||||
{u'ext': u'flv', u'height': 720},
|
{'ext': 'flv', 'height': 720},
|
||||||
{u'ext': u'webm', u'height': 720},
|
{'ext': 'webm', 'height': 720},
|
||||||
]
|
]
|
||||||
info_dict[u'formats'] = formats
|
info_dict['formats'] = formats
|
||||||
yie = YoutubeIE(ydl)
|
yie = YoutubeIE(ydl)
|
||||||
yie._sort_formats(info_dict['formats'])
|
yie._sort_formats(info_dict['formats'])
|
||||||
ydl.process_ie_result(info_dict)
|
ydl.process_ie_result(info_dict)
|
||||||
downloaded = ydl.downloaded_info_dicts[0]
|
downloaded = ydl.downloaded_info_dicts[0]
|
||||||
self.assertEqual(downloaded[u'ext'], u'flv')
|
self.assertEqual(downloaded['ext'], 'flv')
|
||||||
|
|
||||||
def test_format_limit(self):
|
def test_format_limit(self):
|
||||||
formats = [
|
formats = [
|
||||||
{u'format_id': u'meh', u'url': u'http://example.com/meh', 'preference': 1},
|
{'format_id': 'meh', 'url': 'http://example.com/meh', 'preference': 1},
|
||||||
{u'format_id': u'good', u'url': u'http://example.com/good', 'preference': 2},
|
{'format_id': 'good', 'url': 'http://example.com/good', 'preference': 2},
|
||||||
{u'format_id': u'great', u'url': u'http://example.com/great', 'preference': 3},
|
{'format_id': 'great', 'url': 'http://example.com/great', 'preference': 3},
|
||||||
{u'format_id': u'excellent', u'url': u'http://example.com/exc', 'preference': 4},
|
{'format_id': 'excellent', 'url': 'http://example.com/exc', 'preference': 4},
|
||||||
]
|
]
|
||||||
info_dict = {
|
info_dict = {
|
||||||
u'formats': formats, u'extractor': u'test', 'id': 'testvid'}
|
'formats': formats, 'extractor': 'test', 'id': 'testvid'}
|
||||||
|
|
||||||
ydl = YDL()
|
ydl = YDL()
|
||||||
ydl.process_ie_result(info_dict)
|
ydl.process_ie_result(info_dict)
|
||||||
downloaded = ydl.downloaded_info_dicts[0]
|
downloaded = ydl.downloaded_info_dicts[0]
|
||||||
self.assertEqual(downloaded[u'format_id'], u'excellent')
|
self.assertEqual(downloaded['format_id'], 'excellent')
|
||||||
|
|
||||||
ydl = YDL({'format_limit': 'good'})
|
ydl = YDL({'format_limit': 'good'})
|
||||||
assert ydl.params['format_limit'] == 'good'
|
assert ydl.params['format_limit'] == 'good'
|
||||||
ydl.process_ie_result(info_dict.copy())
|
ydl.process_ie_result(info_dict.copy())
|
||||||
downloaded = ydl.downloaded_info_dicts[0]
|
downloaded = ydl.downloaded_info_dicts[0]
|
||||||
self.assertEqual(downloaded[u'format_id'], u'good')
|
self.assertEqual(downloaded['format_id'], 'good')
|
||||||
|
|
||||||
ydl = YDL({'format_limit': 'great', 'format': 'all'})
|
ydl = YDL({'format_limit': 'great', 'format': 'all'})
|
||||||
ydl.process_ie_result(info_dict.copy())
|
ydl.process_ie_result(info_dict.copy())
|
||||||
self.assertEqual(ydl.downloaded_info_dicts[0][u'format_id'], u'meh')
|
self.assertEqual(ydl.downloaded_info_dicts[0]['format_id'], 'meh')
|
||||||
self.assertEqual(ydl.downloaded_info_dicts[1][u'format_id'], u'good')
|
self.assertEqual(ydl.downloaded_info_dicts[1]['format_id'], 'good')
|
||||||
self.assertEqual(ydl.downloaded_info_dicts[2][u'format_id'], u'great')
|
self.assertEqual(ydl.downloaded_info_dicts[2]['format_id'], 'great')
|
||||||
self.assertTrue('3' in ydl.msgs[0])
|
self.assertTrue('3' in ydl.msgs[0])
|
||||||
|
|
||||||
ydl = YDL()
|
ydl = YDL()
|
||||||
ydl.params['format_limit'] = 'excellent'
|
ydl.params['format_limit'] = 'excellent'
|
||||||
ydl.process_ie_result(info_dict.copy())
|
ydl.process_ie_result(info_dict.copy())
|
||||||
downloaded = ydl.downloaded_info_dicts[0]
|
downloaded = ydl.downloaded_info_dicts[0]
|
||||||
self.assertEqual(downloaded[u'format_id'], u'excellent')
|
self.assertEqual(downloaded['format_id'], 'excellent')
|
||||||
|
|
||||||
def test_format_selection(self):
|
def test_format_selection(self):
|
||||||
formats = [
|
formats = [
|
||||||
{u'format_id': u'35', u'ext': u'mp4', 'preference': 1},
|
{'format_id': '35', 'ext': 'mp4', 'preference': 1},
|
||||||
{u'format_id': u'45', u'ext': u'webm', 'preference': 2},
|
{'format_id': '45', 'ext': 'webm', 'preference': 2},
|
||||||
{u'format_id': u'47', u'ext': u'webm', 'preference': 3},
|
{'format_id': '47', 'ext': 'webm', 'preference': 3},
|
||||||
{u'format_id': u'2', u'ext': u'flv', 'preference': 4},
|
{'format_id': '2', 'ext': 'flv', 'preference': 4},
|
||||||
]
|
]
|
||||||
info_dict = {u'formats': formats, u'extractor': u'test'}
|
info_dict = {'formats': formats, 'extractor': 'test'}
|
||||||
|
|
||||||
ydl = YDL({'format': u'20/47'})
|
ydl = YDL({'format': '20/47'})
|
||||||
ydl.process_ie_result(info_dict.copy())
|
ydl.process_ie_result(info_dict.copy())
|
||||||
downloaded = ydl.downloaded_info_dicts[0]
|
downloaded = ydl.downloaded_info_dicts[0]
|
||||||
self.assertEqual(downloaded['format_id'], u'47')
|
self.assertEqual(downloaded['format_id'], '47')
|
||||||
|
|
||||||
ydl = YDL({'format': u'20/71/worst'})
|
ydl = YDL({'format': '20/71/worst'})
|
||||||
ydl.process_ie_result(info_dict.copy())
|
ydl.process_ie_result(info_dict.copy())
|
||||||
downloaded = ydl.downloaded_info_dicts[0]
|
downloaded = ydl.downloaded_info_dicts[0]
|
||||||
self.assertEqual(downloaded['format_id'], u'35')
|
self.assertEqual(downloaded['format_id'], '35')
|
||||||
|
|
||||||
ydl = YDL()
|
ydl = YDL()
|
||||||
ydl.process_ie_result(info_dict.copy())
|
ydl.process_ie_result(info_dict.copy())
|
||||||
downloaded = ydl.downloaded_info_dicts[0]
|
downloaded = ydl.downloaded_info_dicts[0]
|
||||||
self.assertEqual(downloaded['format_id'], u'2')
|
self.assertEqual(downloaded['format_id'], '2')
|
||||||
|
|
||||||
ydl = YDL({'format': u'webm/mp4'})
|
ydl = YDL({'format': 'webm/mp4'})
|
||||||
ydl.process_ie_result(info_dict.copy())
|
ydl.process_ie_result(info_dict.copy())
|
||||||
downloaded = ydl.downloaded_info_dicts[0]
|
downloaded = ydl.downloaded_info_dicts[0]
|
||||||
self.assertEqual(downloaded['format_id'], u'47')
|
self.assertEqual(downloaded['format_id'], '47')
|
||||||
|
|
||||||
ydl = YDL({'format': u'3gp/40/mp4'})
|
ydl = YDL({'format': '3gp/40/mp4'})
|
||||||
ydl.process_ie_result(info_dict.copy())
|
ydl.process_ie_result(info_dict.copy())
|
||||||
downloaded = ydl.downloaded_info_dicts[0]
|
downloaded = ydl.downloaded_info_dicts[0]
|
||||||
self.assertEqual(downloaded['format_id'], u'35')
|
self.assertEqual(downloaded['format_id'], '35')
|
||||||
|
|
||||||
|
def test_format_selection_audio(self):
|
||||||
|
formats = [
|
||||||
|
{'format_id': 'audio-low', 'ext': 'webm', 'preference': 1, 'vcodec': 'none'},
|
||||||
|
{'format_id': 'audio-mid', 'ext': 'webm', 'preference': 2, 'vcodec': 'none'},
|
||||||
|
{'format_id': 'audio-high', 'ext': 'flv', 'preference': 3, 'vcodec': 'none'},
|
||||||
|
{'format_id': 'vid', 'ext': 'mp4', 'preference': 4},
|
||||||
|
]
|
||||||
|
info_dict = {'formats': formats, 'extractor': 'test'}
|
||||||
|
|
||||||
|
ydl = YDL({'format': 'bestaudio'})
|
||||||
|
ydl.process_ie_result(info_dict.copy())
|
||||||
|
downloaded = ydl.downloaded_info_dicts[0]
|
||||||
|
self.assertEqual(downloaded['format_id'], 'audio-high')
|
||||||
|
|
||||||
|
ydl = YDL({'format': 'worstaudio'})
|
||||||
|
ydl.process_ie_result(info_dict.copy())
|
||||||
|
downloaded = ydl.downloaded_info_dicts[0]
|
||||||
|
self.assertEqual(downloaded['format_id'], 'audio-low')
|
||||||
|
|
||||||
|
formats = [
|
||||||
|
{'format_id': 'vid-low', 'ext': 'mp4', 'preference': 1},
|
||||||
|
{'format_id': 'vid-high', 'ext': 'mp4', 'preference': 2},
|
||||||
|
]
|
||||||
|
info_dict = {'formats': formats, 'extractor': 'test'}
|
||||||
|
|
||||||
|
ydl = YDL({'format': 'bestaudio/worstaudio/best'})
|
||||||
|
ydl.process_ie_result(info_dict.copy())
|
||||||
|
downloaded = ydl.downloaded_info_dicts[0]
|
||||||
|
self.assertEqual(downloaded['format_id'], 'vid-high')
|
||||||
|
|
||||||
def test_youtube_format_selection(self):
|
def test_youtube_format_selection(self):
|
||||||
order = [
|
order = [
|
||||||
@@ -200,17 +232,17 @@ class TestFormatSelection(unittest.TestCase):
|
|||||||
|
|
||||||
def test_prepare_filename(self):
|
def test_prepare_filename(self):
|
||||||
info = {
|
info = {
|
||||||
u'id': u'1234',
|
'id': '1234',
|
||||||
u'ext': u'mp4',
|
'ext': 'mp4',
|
||||||
u'width': None,
|
'width': None,
|
||||||
}
|
}
|
||||||
def fname(templ):
|
def fname(templ):
|
||||||
ydl = YoutubeDL({'outtmpl': templ})
|
ydl = YoutubeDL({'outtmpl': templ})
|
||||||
return ydl.prepare_filename(info)
|
return ydl.prepare_filename(info)
|
||||||
self.assertEqual(fname(u'%(id)s.%(ext)s'), u'1234.mp4')
|
self.assertEqual(fname('%(id)s.%(ext)s'), '1234.mp4')
|
||||||
self.assertEqual(fname(u'%(id)s-%(width)s.%(ext)s'), u'1234-NA.mp4')
|
self.assertEqual(fname('%(id)s-%(width)s.%(ext)s'), '1234-NA.mp4')
|
||||||
# Replace missing fields with 'NA'
|
# Replace missing fields with 'NA'
|
||||||
self.assertEqual(fname(u'%(uploader_date)s-%(id)s.%(ext)s'), u'NA-1234.mp4')
|
self.assertEqual(fname('%(uploader_date)s-%(id)s.%(ext)s'), 'NA-1234.mp4')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@@ -167,13 +167,13 @@ class TestTedSubtitles(BaseTestSubtitles):
|
|||||||
def test_subtitles(self):
|
def test_subtitles(self):
|
||||||
self.DL.params['writesubtitles'] = True
|
self.DL.params['writesubtitles'] = True
|
||||||
subtitles = self.getSubtitles()
|
subtitles = self.getSubtitles()
|
||||||
self.assertEqual(md5(subtitles['en']), '2154f31ff9b9f89a0aa671537559c21d')
|
self.assertEqual(md5(subtitles['en']), '4262c1665ff928a2dada178f62cb8d14')
|
||||||
|
|
||||||
def test_subtitles_lang(self):
|
def test_subtitles_lang(self):
|
||||||
self.DL.params['writesubtitles'] = True
|
self.DL.params['writesubtitles'] = True
|
||||||
self.DL.params['subtitleslangs'] = ['fr']
|
self.DL.params['subtitleslangs'] = ['fr']
|
||||||
subtitles = self.getSubtitles()
|
subtitles = self.getSubtitles()
|
||||||
self.assertEqual(md5(subtitles['fr']), '7616cbc6df20ec2c1204083c83871cf6')
|
self.assertEqual(md5(subtitles['fr']), '66a63f7f42c97a50f8c0e90bc7797bb5')
|
||||||
|
|
||||||
def test_allsubtitles(self):
|
def test_allsubtitles(self):
|
||||||
self.DL.params['writesubtitles'] = True
|
self.DL.params['writesubtitles'] = True
|
||||||
|
@@ -16,8 +16,10 @@ from youtube_dl.utils import (
|
|||||||
DateRange,
|
DateRange,
|
||||||
encodeFilename,
|
encodeFilename,
|
||||||
find_xpath_attr,
|
find_xpath_attr,
|
||||||
|
fix_xml_ampersands,
|
||||||
get_meta_content,
|
get_meta_content,
|
||||||
orderedSet,
|
orderedSet,
|
||||||
|
PagedList,
|
||||||
parse_duration,
|
parse_duration,
|
||||||
sanitize_filename,
|
sanitize_filename,
|
||||||
shell_quote,
|
shell_quote,
|
||||||
@@ -200,5 +202,39 @@ class TestUtil(unittest.TestCase):
|
|||||||
self.assertEqual(parse_duration('9:12:43'), 33163)
|
self.assertEqual(parse_duration('9:12:43'), 33163)
|
||||||
self.assertEqual(parse_duration('x:y'), None)
|
self.assertEqual(parse_duration('x:y'), None)
|
||||||
|
|
||||||
|
def test_fix_xml_ampersands(self):
|
||||||
|
self.assertEqual(
|
||||||
|
fix_xml_ampersands('"&x=y&z=a'), '"&x=y&z=a')
|
||||||
|
self.assertEqual(
|
||||||
|
fix_xml_ampersands('"&x=y&wrong;&z=a'),
|
||||||
|
'"&x=y&wrong;&z=a')
|
||||||
|
self.assertEqual(
|
||||||
|
fix_xml_ampersands('&'><"'),
|
||||||
|
'&'><"')
|
||||||
|
self.assertEqual(
|
||||||
|
fix_xml_ampersands('Ӓ᪼'), 'Ӓ᪼')
|
||||||
|
self.assertEqual(fix_xml_ampersands('&#&#'), '&#&#')
|
||||||
|
|
||||||
|
def test_paged_list(self):
|
||||||
|
def testPL(size, pagesize, sliceargs, expected):
|
||||||
|
def get_page(pagenum):
|
||||||
|
firstid = pagenum * pagesize
|
||||||
|
upto = min(size, pagenum * pagesize + pagesize)
|
||||||
|
for i in range(firstid, upto):
|
||||||
|
yield i
|
||||||
|
|
||||||
|
pl = PagedList(get_page, pagesize)
|
||||||
|
got = pl.getslice(*sliceargs)
|
||||||
|
self.assertEqual(got, expected)
|
||||||
|
|
||||||
|
testPL(5, 2, (), [0, 1, 2, 3, 4])
|
||||||
|
testPL(5, 2, (1,), [1, 2, 3, 4])
|
||||||
|
testPL(5, 2, (2,), [2, 3, 4])
|
||||||
|
testPL(5, 2, (4,), [4])
|
||||||
|
testPL(5, 2, (0, 3), [0, 1, 2])
|
||||||
|
testPL(5, 2, (1, 4), [1, 2, 3])
|
||||||
|
testPL(5, 2, (2, 99), [2, 3, 4])
|
||||||
|
testPL(5, 2, (20, 99), [])
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
@@ -120,7 +120,7 @@ class TestYoutubeLists(unittest.TestCase):
|
|||||||
def test_youtube_toplist(self):
|
def test_youtube_toplist(self):
|
||||||
dl = FakeYDL()
|
dl = FakeYDL()
|
||||||
ie = YoutubeTopListIE(dl)
|
ie = YoutubeTopListIE(dl)
|
||||||
result = ie.extract('yttoplist:music:Top Tracks')
|
result = ie.extract('yttoplist:music:Trending')
|
||||||
entries = result['entries']
|
entries = result['entries']
|
||||||
self.assertTrue(len(entries) >= 5)
|
self.assertTrue(len(entries) >= 5)
|
||||||
|
|
||||||
|
@@ -27,12 +27,6 @@ _TESTS = [
|
|||||||
85,
|
85,
|
||||||
u'3456789a0cdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRS[UVWXYZ!"#$%&\'()*+,-./:;<=>?@',
|
u'3456789a0cdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRS[UVWXYZ!"#$%&\'()*+,-./:;<=>?@',
|
||||||
),
|
),
|
||||||
(
|
|
||||||
u'https://s.ytimg.com/yts/swfbin/watch_as3-vflg5GhxU.swf',
|
|
||||||
u'swf',
|
|
||||||
82,
|
|
||||||
u':/.-,+*)=\'&%$#"!ZYX0VUTSRQPONMLKJIHGFEDCBAzyxw>utsrqponmlkjihgfedcba987654321'
|
|
||||||
),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@@ -39,6 +39,7 @@ from .utils import (
|
|||||||
locked_file,
|
locked_file,
|
||||||
make_HTTPS_handler,
|
make_HTTPS_handler,
|
||||||
MaxDownloadsReached,
|
MaxDownloadsReached,
|
||||||
|
PagedList,
|
||||||
PostProcessingError,
|
PostProcessingError,
|
||||||
platform_name,
|
platform_name,
|
||||||
preferredencoding,
|
preferredencoding,
|
||||||
@@ -151,6 +152,9 @@ class YoutubeDL(object):
|
|||||||
bidi_workaround: Work around buggy terminals without bidirectional text
|
bidi_workaround: Work around buggy terminals without bidirectional text
|
||||||
support, using fridibi
|
support, using fridibi
|
||||||
debug_printtraffic:Print out sent and received HTTP traffic
|
debug_printtraffic:Print out sent and received HTTP traffic
|
||||||
|
include_ads: Download ads as well
|
||||||
|
default_search: Prepend this string if an input url is not valid.
|
||||||
|
'auto' for elaborate guessing
|
||||||
|
|
||||||
The following parameters are not used by YoutubeDL itself, they are used by
|
The following parameters are not used by YoutubeDL itself, they are used by
|
||||||
the FileDownloader:
|
the FileDownloader:
|
||||||
@@ -327,7 +331,7 @@ class YoutubeDL(object):
|
|||||||
|
|
||||||
def __exit__(self, *args):
|
def __exit__(self, *args):
|
||||||
self.restore_console_title()
|
self.restore_console_title()
|
||||||
|
|
||||||
if self.params.get('cookiefile') is not None:
|
if self.params.get('cookiefile') is not None:
|
||||||
self.cookiejar.save()
|
self.cookiejar.save()
|
||||||
|
|
||||||
@@ -392,10 +396,6 @@ class YoutubeDL(object):
|
|||||||
except UnicodeEncodeError:
|
except UnicodeEncodeError:
|
||||||
self.to_screen('[download] The file has already been downloaded')
|
self.to_screen('[download] The file has already been downloaded')
|
||||||
|
|
||||||
def increment_downloads(self):
|
|
||||||
"""Increment the ordinal that assigns a number to each file."""
|
|
||||||
self._num_downloads += 1
|
|
||||||
|
|
||||||
def prepare_filename(self, info_dict):
|
def prepare_filename(self, info_dict):
|
||||||
"""Generate the output filename."""
|
"""Generate the output filename."""
|
||||||
try:
|
try:
|
||||||
@@ -513,6 +513,8 @@ class YoutubeDL(object):
|
|||||||
except ExtractorError as de: # An error we somewhat expected
|
except ExtractorError as de: # An error we somewhat expected
|
||||||
self.report_error(compat_str(de), de.format_traceback())
|
self.report_error(compat_str(de), de.format_traceback())
|
||||||
break
|
break
|
||||||
|
except MaxDownloadsReached:
|
||||||
|
raise
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if self.params.get('ignoreerrors', False):
|
if self.params.get('ignoreerrors', False):
|
||||||
self.report_error(compat_str(e), tb=compat_str(traceback.format_exc()))
|
self.report_error(compat_str(e), tb=compat_str(traceback.format_exc()))
|
||||||
@@ -575,19 +577,27 @@ class YoutubeDL(object):
|
|||||||
|
|
||||||
playlist_results = []
|
playlist_results = []
|
||||||
|
|
||||||
n_all_entries = len(ie_result['entries'])
|
|
||||||
playliststart = self.params.get('playliststart', 1) - 1
|
playliststart = self.params.get('playliststart', 1) - 1
|
||||||
playlistend = self.params.get('playlistend', None)
|
playlistend = self.params.get('playlistend', None)
|
||||||
# For backwards compatibility, interpret -1 as whole list
|
# For backwards compatibility, interpret -1 as whole list
|
||||||
if playlistend == -1:
|
if playlistend == -1:
|
||||||
playlistend = None
|
playlistend = None
|
||||||
|
|
||||||
entries = ie_result['entries'][playliststart:playlistend]
|
if isinstance(ie_result['entries'], list):
|
||||||
n_entries = len(entries)
|
n_all_entries = len(ie_result['entries'])
|
||||||
|
entries = ie_result['entries'][playliststart:playlistend]
|
||||||
self.to_screen(
|
n_entries = len(entries)
|
||||||
"[%s] playlist '%s': Collected %d video ids (downloading %d of them)" %
|
self.to_screen(
|
||||||
(ie_result['extractor'], playlist, n_all_entries, n_entries))
|
"[%s] playlist %s: Collected %d video ids (downloading %d of them)" %
|
||||||
|
(ie_result['extractor'], playlist, n_all_entries, n_entries))
|
||||||
|
else:
|
||||||
|
assert isinstance(ie_result['entries'], PagedList)
|
||||||
|
entries = ie_result['entries'].getslice(
|
||||||
|
playliststart, playlistend)
|
||||||
|
n_entries = len(entries)
|
||||||
|
self.to_screen(
|
||||||
|
"[%s] playlist %s: Downloading %d videos" %
|
||||||
|
(ie_result['extractor'], playlist, n_entries))
|
||||||
|
|
||||||
for i, entry in enumerate(entries, 1):
|
for i, entry in enumerate(entries, 1):
|
||||||
self.to_screen('[download] Downloading video #%s of %s' % (i, n_entries))
|
self.to_screen('[download] Downloading video #%s of %s' % (i, n_entries))
|
||||||
@@ -634,6 +644,18 @@ class YoutubeDL(object):
|
|||||||
return available_formats[-1]
|
return available_formats[-1]
|
||||||
elif format_spec == 'worst':
|
elif format_spec == 'worst':
|
||||||
return available_formats[0]
|
return available_formats[0]
|
||||||
|
elif format_spec == 'bestaudio':
|
||||||
|
audio_formats = [
|
||||||
|
f for f in available_formats
|
||||||
|
if f.get('vcodec') == 'none']
|
||||||
|
if audio_formats:
|
||||||
|
return audio_formats[-1]
|
||||||
|
elif format_spec == 'worstaudio':
|
||||||
|
audio_formats = [
|
||||||
|
f for f in available_formats
|
||||||
|
if f.get('vcodec') == 'none']
|
||||||
|
if audio_formats:
|
||||||
|
return audio_formats[0]
|
||||||
else:
|
else:
|
||||||
extensions = ['mp4', 'flv', 'webm', '3gp']
|
extensions = ['mp4', 'flv', 'webm', '3gp']
|
||||||
if format_spec in extensions:
|
if format_spec in extensions:
|
||||||
@@ -688,17 +710,17 @@ class YoutubeDL(object):
|
|||||||
|
|
||||||
# TODO Central sorting goes here
|
# TODO Central sorting goes here
|
||||||
|
|
||||||
if formats[0] is not info_dict:
|
if formats[0] is not info_dict:
|
||||||
# only set the 'formats' fields if the original info_dict list them
|
# only set the 'formats' fields if the original info_dict list them
|
||||||
# otherwise we end up with a circular reference, the first (and unique)
|
# otherwise we end up with a circular reference, the first (and unique)
|
||||||
# element in the 'formats' field in info_dict is info_dict itself,
|
# element in the 'formats' field in info_dict is info_dict itself,
|
||||||
# wich can't be exported to json
|
# wich can't be exported to json
|
||||||
info_dict['formats'] = formats
|
info_dict['formats'] = formats
|
||||||
if self.params.get('listformats', None):
|
if self.params.get('listformats', None):
|
||||||
self.list_formats(info_dict)
|
self.list_formats(info_dict)
|
||||||
return
|
return
|
||||||
|
|
||||||
req_format = self.params.get('format', 'best')
|
req_format = self.params.get('format')
|
||||||
if req_format is None:
|
if req_format is None:
|
||||||
req_format = 'best'
|
req_format = 'best'
|
||||||
formats_to_download = []
|
formats_to_download = []
|
||||||
@@ -747,8 +769,11 @@ class YoutubeDL(object):
|
|||||||
"""Process a single resolved IE result."""
|
"""Process a single resolved IE result."""
|
||||||
|
|
||||||
assert info_dict.get('_type', 'video') == 'video'
|
assert info_dict.get('_type', 'video') == 'video'
|
||||||
#We increment the download the download count here to match the previous behaviour.
|
|
||||||
self.increment_downloads()
|
max_downloads = self.params.get('max_downloads')
|
||||||
|
if max_downloads is not None:
|
||||||
|
if self._num_downloads >= int(max_downloads):
|
||||||
|
raise MaxDownloadsReached()
|
||||||
|
|
||||||
info_dict['fulltitle'] = info_dict['title']
|
info_dict['fulltitle'] = info_dict['title']
|
||||||
if len(info_dict['title']) > 200:
|
if len(info_dict['title']) > 200:
|
||||||
@@ -765,10 +790,7 @@ class YoutubeDL(object):
|
|||||||
self.to_screen('[download] ' + reason)
|
self.to_screen('[download] ' + reason)
|
||||||
return
|
return
|
||||||
|
|
||||||
max_downloads = self.params.get('max_downloads')
|
self._num_downloads += 1
|
||||||
if max_downloads is not None:
|
|
||||||
if self._num_downloads > int(max_downloads):
|
|
||||||
raise MaxDownloadsReached()
|
|
||||||
|
|
||||||
filename = self.prepare_filename(info_dict)
|
filename = self.prepare_filename(info_dict)
|
||||||
|
|
||||||
@@ -908,6 +930,14 @@ class YoutubeDL(object):
|
|||||||
if info_dict.get('requested_formats') is not None:
|
if info_dict.get('requested_formats') is not None:
|
||||||
downloaded = []
|
downloaded = []
|
||||||
success = True
|
success = True
|
||||||
|
merger = FFmpegMergerPP(self)
|
||||||
|
if not merger._get_executable():
|
||||||
|
postprocessors = []
|
||||||
|
self.report_warning('You have requested multiple '
|
||||||
|
'formats but ffmpeg or avconv are not installed.'
|
||||||
|
' The formats won\'t be merged')
|
||||||
|
else:
|
||||||
|
postprocessors = [merger]
|
||||||
for f in info_dict['requested_formats']:
|
for f in info_dict['requested_formats']:
|
||||||
new_info = dict(info_dict)
|
new_info = dict(info_dict)
|
||||||
new_info.update(f)
|
new_info.update(f)
|
||||||
@@ -916,7 +946,7 @@ class YoutubeDL(object):
|
|||||||
downloaded.append(fname)
|
downloaded.append(fname)
|
||||||
partial_success = dl(fname, new_info)
|
partial_success = dl(fname, new_info)
|
||||||
success = success and partial_success
|
success = success and partial_success
|
||||||
info_dict['__postprocessors'] = [FFmpegMergerPP(self)]
|
info_dict['__postprocessors'] = postprocessors
|
||||||
info_dict['__files_to_merge'] = downloaded
|
info_dict['__files_to_merge'] = downloaded
|
||||||
else:
|
else:
|
||||||
# Just a single file
|
# Just a single file
|
||||||
@@ -1064,9 +1094,15 @@ class YoutubeDL(object):
|
|||||||
res += fdict['format_note'] + ' '
|
res += fdict['format_note'] + ' '
|
||||||
if fdict.get('tbr') is not None:
|
if fdict.get('tbr') is not None:
|
||||||
res += '%4dk ' % fdict['tbr']
|
res += '%4dk ' % fdict['tbr']
|
||||||
|
if fdict.get('container') is not None:
|
||||||
|
if res:
|
||||||
|
res += ', '
|
||||||
|
res += '%s container' % fdict['container']
|
||||||
if (fdict.get('vcodec') is not None and
|
if (fdict.get('vcodec') is not None and
|
||||||
fdict.get('vcodec') != 'none'):
|
fdict.get('vcodec') != 'none'):
|
||||||
res += '%-5s' % fdict['vcodec']
|
if res:
|
||||||
|
res += ', '
|
||||||
|
res += fdict['vcodec']
|
||||||
if fdict.get('vbr') is not None:
|
if fdict.get('vbr') is not None:
|
||||||
res += '@'
|
res += '@'
|
||||||
elif fdict.get('vbr') is not None and fdict.get('abr') is not None:
|
elif fdict.get('vbr') is not None and fdict.get('abr') is not None:
|
||||||
@@ -1076,13 +1112,18 @@ class YoutubeDL(object):
|
|||||||
if fdict.get('acodec') is not None:
|
if fdict.get('acodec') is not None:
|
||||||
if res:
|
if res:
|
||||||
res += ', '
|
res += ', '
|
||||||
res += '%-5s' % fdict['acodec']
|
if fdict['acodec'] == 'none':
|
||||||
|
res += 'video only'
|
||||||
|
else:
|
||||||
|
res += '%-5s' % fdict['acodec']
|
||||||
elif fdict.get('abr') is not None:
|
elif fdict.get('abr') is not None:
|
||||||
if res:
|
if res:
|
||||||
res += ', '
|
res += ', '
|
||||||
res += 'audio'
|
res += 'audio'
|
||||||
if fdict.get('abr') is not None:
|
if fdict.get('abr') is not None:
|
||||||
res += '@%3dk' % fdict['abr']
|
res += '@%3dk' % fdict['abr']
|
||||||
|
if fdict.get('asr') is not None:
|
||||||
|
res += ' (%5dHz)' % fdict['asr']
|
||||||
if fdict.get('filesize') is not None:
|
if fdict.get('filesize') is not None:
|
||||||
if res:
|
if res:
|
||||||
res += ', '
|
res += ', '
|
||||||
|
@@ -39,6 +39,8 @@ __authors__ = (
|
|||||||
'Sergey M.',
|
'Sergey M.',
|
||||||
'Michael Orlitzky',
|
'Michael Orlitzky',
|
||||||
'Chris Gahan',
|
'Chris Gahan',
|
||||||
|
'Saimadhav Heblikar',
|
||||||
|
'Mike Col',
|
||||||
)
|
)
|
||||||
|
|
||||||
__license__ = 'Public Domain'
|
__license__ = 'Public Domain'
|
||||||
@@ -198,7 +200,9 @@ def parseOpts(overrideArguments=None):
|
|||||||
general.add_option(
|
general.add_option(
|
||||||
'--bidi-workaround', dest='bidi_workaround', action='store_true',
|
'--bidi-workaround', dest='bidi_workaround', action='store_true',
|
||||||
help=u'Work around terminals that lack bidirectional text support. Requires bidiv or fribidi executable in PATH')
|
help=u'Work around terminals that lack bidirectional text support. Requires bidiv or fribidi executable in PATH')
|
||||||
|
general.add_option('--default-search',
|
||||||
|
dest='default_search', metavar='PREFIX',
|
||||||
|
help='Use this prefix for unqualified URLs. For example "gvsearch2:" downloads two videos from google videos for youtube-dl "large apple". By default (with value "auto") youtube-dl guesses.')
|
||||||
|
|
||||||
selection.add_option(
|
selection.add_option(
|
||||||
'--playlist-start',
|
'--playlist-start',
|
||||||
@@ -237,7 +241,14 @@ def parseOpts(overrideArguments=None):
|
|||||||
selection.add_option('--download-archive', metavar='FILE',
|
selection.add_option('--download-archive', metavar='FILE',
|
||||||
dest='download_archive',
|
dest='download_archive',
|
||||||
help='Download only videos not listed in the archive file. Record the IDs of all downloaded videos in it.')
|
help='Download only videos not listed in the archive file. Record the IDs of all downloaded videos in it.')
|
||||||
|
selection.add_option(
|
||||||
|
'--include-ads', dest='include_ads',
|
||||||
|
action='store_true',
|
||||||
|
help='Download advertisements as well (experimental)')
|
||||||
|
selection.add_option(
|
||||||
|
'--youtube-include-dash-manifest', action='store_true',
|
||||||
|
dest='youtube_include_dash_manifest', default=False,
|
||||||
|
help='Try to download the DASH manifest on YouTube videos (experimental)')
|
||||||
|
|
||||||
authentication.add_option('-u', '--username',
|
authentication.add_option('-u', '--username',
|
||||||
dest='username', metavar='USERNAME', help='account username')
|
dest='username', metavar='USERNAME', help='account username')
|
||||||
@@ -250,8 +261,8 @@ def parseOpts(overrideArguments=None):
|
|||||||
|
|
||||||
|
|
||||||
video_format.add_option('-f', '--format',
|
video_format.add_option('-f', '--format',
|
||||||
action='store', dest='format', metavar='FORMAT', default='best',
|
action='store', dest='format', metavar='FORMAT', default=None,
|
||||||
help='video format code, specify the order of preference using slashes: "-f 22/17/18". "-f mp4" and "-f flv" are also supported')
|
help='video format code, specify the order of preference using slashes: "-f 22/17/18". "-f mp4" and "-f flv" are also supported. You can also use the special names "best", "bestaudio", "worst", and "worstaudio". By default, youtube-dl will pick the best quality.')
|
||||||
video_format.add_option('--all-formats',
|
video_format.add_option('--all-formats',
|
||||||
action='store_const', dest='format', help='download all available video formats', const='all')
|
action='store_const', dest='format', help='download all available video formats', const='all')
|
||||||
video_format.add_option('--prefer-free-formats',
|
video_format.add_option('--prefer-free-formats',
|
||||||
@@ -342,7 +353,8 @@ def parseOpts(overrideArguments=None):
|
|||||||
help=optparse.SUPPRESS_HELP)
|
help=optparse.SUPPRESS_HELP)
|
||||||
verbosity.add_option('--print-traffic',
|
verbosity.add_option('--print-traffic',
|
||||||
dest='debug_printtraffic', action='store_true', default=False,
|
dest='debug_printtraffic', action='store_true', default=False,
|
||||||
help=optparse.SUPPRESS_HELP)
|
help='Display sent and read HTTP traffic')
|
||||||
|
|
||||||
|
|
||||||
filesystem.add_option('-t', '--title',
|
filesystem.add_option('-t', '--title',
|
||||||
action='store_true', dest='usetitle', help='use title in file name (default)', default=False)
|
action='store_true', dest='usetitle', help='use title in file name (default)', default=False)
|
||||||
@@ -615,6 +627,12 @@ def _real_main(argv=None):
|
|||||||
date = DateRange.day(opts.date)
|
date = DateRange.day(opts.date)
|
||||||
else:
|
else:
|
||||||
date = DateRange(opts.dateafter, opts.datebefore)
|
date = DateRange(opts.dateafter, opts.datebefore)
|
||||||
|
if opts.default_search not in ('auto', None) and ':' not in opts.default_search:
|
||||||
|
parser.error(u'--default-search invalid; did you forget a colon (:) at the end?')
|
||||||
|
|
||||||
|
# Do not download videos when there are audio-only formats
|
||||||
|
if opts.extractaudio and not opts.keepvideo and opts.format is None:
|
||||||
|
opts.format = 'bestaudio/best'
|
||||||
|
|
||||||
# --all-sub automatically sets --write-sub if --write-auto-sub is not given
|
# --all-sub automatically sets --write-sub if --write-auto-sub is not given
|
||||||
# this was the old behaviour if only --all-sub was given.
|
# this was the old behaviour if only --all-sub was given.
|
||||||
@@ -715,6 +733,9 @@ def _real_main(argv=None):
|
|||||||
'bidi_workaround': opts.bidi_workaround,
|
'bidi_workaround': opts.bidi_workaround,
|
||||||
'debug_printtraffic': opts.debug_printtraffic,
|
'debug_printtraffic': opts.debug_printtraffic,
|
||||||
'prefer_ffmpeg': opts.prefer_ffmpeg,
|
'prefer_ffmpeg': opts.prefer_ffmpeg,
|
||||||
|
'include_ads': opts.include_ads,
|
||||||
|
'default_search': opts.default_search,
|
||||||
|
'youtube_include_dash_manifest': opts.youtube_include_dash_manifest,
|
||||||
}
|
}
|
||||||
|
|
||||||
with YoutubeDL(ydl_opts) as ydl:
|
with YoutubeDL(ydl_opts) as ydl:
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from .common import FileDownloader
|
from .common import FileDownloader
|
||||||
from .hls import HlsFD
|
from .hls import HlsFD
|
||||||
from .http import HttpFD
|
from .http import HttpFD
|
||||||
@@ -8,16 +10,17 @@ from ..utils import (
|
|||||||
determine_ext,
|
determine_ext,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_suitable_downloader(info_dict):
|
def get_suitable_downloader(info_dict):
|
||||||
"""Get the downloader class that can handle the info dict."""
|
"""Get the downloader class that can handle the info dict."""
|
||||||
url = info_dict['url']
|
url = info_dict['url']
|
||||||
|
protocol = info_dict.get('protocol')
|
||||||
|
|
||||||
if url.startswith('rtmp'):
|
if url.startswith('rtmp'):
|
||||||
return RtmpFD
|
return RtmpFD
|
||||||
if determine_ext(url) == u'm3u8':
|
if (protocol == 'm3u8') or (protocol is None and determine_ext(url) == 'm3u8'):
|
||||||
return HlsFD
|
return HlsFD
|
||||||
if url.startswith('mms') or url.startswith('rtsp'):
|
if url.startswith('mms') or url.startswith('rtsp'):
|
||||||
return MplayerFD
|
return MplayerFD
|
||||||
else:
|
else:
|
||||||
return HttpFD
|
return HttpFD
|
||||||
|
|
||||||
|
@@ -314,4 +314,3 @@ class FileDownloader(object):
|
|||||||
if the download is successful.
|
if the download is successful.
|
||||||
"""
|
"""
|
||||||
self._progress_hooks.append(ph)
|
self._progress_hooks.append(ph)
|
||||||
|
|
||||||
|
@@ -27,7 +27,7 @@ class HttpFD(FileDownloader):
|
|||||||
request = compat_urllib_request.Request(url, None, headers)
|
request = compat_urllib_request.Request(url, None, headers)
|
||||||
|
|
||||||
if self.params.get('test', False):
|
if self.params.get('test', False):
|
||||||
request.add_header('Range','bytes=0-10240')
|
request.add_header('Range', 'bytes=0-10240')
|
||||||
|
|
||||||
# Establish possible resume length
|
# Establish possible resume length
|
||||||
if os.path.isfile(encodeFilename(tmpfilename)):
|
if os.path.isfile(encodeFilename(tmpfilename)):
|
||||||
@@ -39,7 +39,7 @@ class HttpFD(FileDownloader):
|
|||||||
if resume_len != 0:
|
if resume_len != 0:
|
||||||
if self.params.get('continuedl', False):
|
if self.params.get('continuedl', False):
|
||||||
self.report_resuming_byte(resume_len)
|
self.report_resuming_byte(resume_len)
|
||||||
request.add_header('Range','bytes=%d-' % resume_len)
|
request.add_header('Range', 'bytes=%d-' % resume_len)
|
||||||
open_mode = 'ab'
|
open_mode = 'ab'
|
||||||
else:
|
else:
|
||||||
resume_len = 0
|
resume_len = 0
|
||||||
@@ -100,7 +100,7 @@ class HttpFD(FileDownloader):
|
|||||||
if data_len is not None:
|
if data_len is not None:
|
||||||
data_len = int(data_len) + resume_len
|
data_len = int(data_len) + resume_len
|
||||||
min_data_len = self.params.get("min_filesize", None)
|
min_data_len = self.params.get("min_filesize", None)
|
||||||
max_data_len = self.params.get("max_filesize", None)
|
max_data_len = self.params.get("max_filesize", None)
|
||||||
if min_data_len is not None and data_len < min_data_len:
|
if min_data_len is not None and data_len < min_data_len:
|
||||||
self.to_screen(u'\r[download] File is smaller than min-filesize (%s bytes < %s bytes). Aborting.' % (data_len, min_data_len))
|
self.to_screen(u'\r[download] File is smaller than min-filesize (%s bytes < %s bytes). Aborting.' % (data_len, min_data_len))
|
||||||
return False
|
return False
|
||||||
|
@@ -18,10 +18,10 @@ class MplayerFD(FileDownloader):
|
|||||||
try:
|
try:
|
||||||
subprocess.call(['mplayer', '-h'], stdout=(open(os.path.devnull, 'w')), stderr=subprocess.STDOUT)
|
subprocess.call(['mplayer', '-h'], stdout=(open(os.path.devnull, 'w')), stderr=subprocess.STDOUT)
|
||||||
except (OSError, IOError):
|
except (OSError, IOError):
|
||||||
self.report_error(u'MMS or RTSP download detected but "%s" could not be run' % args[0] )
|
self.report_error(u'MMS or RTSP download detected but "%s" could not be run' % args[0])
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Download using mplayer.
|
# Download using mplayer.
|
||||||
retval = subprocess.call(args)
|
retval = subprocess.call(args)
|
||||||
if retval == 0:
|
if retval == 0:
|
||||||
fsize = os.path.getsize(encodeFilename(tmpfilename))
|
fsize = os.path.getsize(encodeFilename(tmpfilename))
|
||||||
|
@@ -27,6 +27,7 @@ from .cbs import CBSIE
|
|||||||
from .channel9 import Channel9IE
|
from .channel9 import Channel9IE
|
||||||
from .cinemassacre import CinemassacreIE
|
from .cinemassacre import CinemassacreIE
|
||||||
from .clipfish import ClipfishIE
|
from .clipfish import ClipfishIE
|
||||||
|
from .cliphunter import CliphunterIE
|
||||||
from .clipsyndicate import ClipsyndicateIE
|
from .clipsyndicate import ClipsyndicateIE
|
||||||
from .cmt import CMTIE
|
from .cmt import CMTIE
|
||||||
from .cnn import CNNIE
|
from .cnn import CNNIE
|
||||||
@@ -47,6 +48,8 @@ from .depositfiles import DepositFilesIE
|
|||||||
from .dotsub import DotsubIE
|
from .dotsub import DotsubIE
|
||||||
from .dreisat import DreiSatIE
|
from .dreisat import DreiSatIE
|
||||||
from .defense import DefenseGouvFrIE
|
from .defense import DefenseGouvFrIE
|
||||||
|
from .discovery import DiscoveryIE
|
||||||
|
from .dropbox import DropboxIE
|
||||||
from .ebaumsworld import EbaumsWorldIE
|
from .ebaumsworld import EbaumsWorldIE
|
||||||
from .ehow import EHowIE
|
from .ehow import EHowIE
|
||||||
from .eighttracks import EightTracksIE
|
from .eighttracks import EightTracksIE
|
||||||
@@ -62,6 +65,7 @@ from .fktv import (
|
|||||||
FKTVPosteckeIE,
|
FKTVPosteckeIE,
|
||||||
)
|
)
|
||||||
from .flickr import FlickrIE
|
from .flickr import FlickrIE
|
||||||
|
from .franceinter import FranceInterIE
|
||||||
from .francetv import (
|
from .francetv import (
|
||||||
PluzzIE,
|
PluzzIE,
|
||||||
FranceTvInfoIE,
|
FranceTvInfoIE,
|
||||||
@@ -70,6 +74,7 @@ from .francetv import (
|
|||||||
CultureboxIE,
|
CultureboxIE,
|
||||||
)
|
)
|
||||||
from .freesound import FreesoundIE
|
from .freesound import FreesoundIE
|
||||||
|
from .freespeech import FreespeechIE
|
||||||
from .funnyordie import FunnyOrDieIE
|
from .funnyordie import FunnyOrDieIE
|
||||||
from .gamekings import GamekingsIE
|
from .gamekings import GamekingsIE
|
||||||
from .gamespot import GameSpotIE
|
from .gamespot import GameSpotIE
|
||||||
@@ -80,6 +85,7 @@ from .googlesearch import GoogleSearchIE
|
|||||||
from .hark import HarkIE
|
from .hark import HarkIE
|
||||||
from .hotnewhiphop import HotNewHipHopIE
|
from .hotnewhiphop import HotNewHipHopIE
|
||||||
from .howcast import HowcastIE
|
from .howcast import HowcastIE
|
||||||
|
from .huffpost import HuffPostIE
|
||||||
from .hypem import HypemIE
|
from .hypem import HypemIE
|
||||||
from .ign import IGNIE, OneUPIE
|
from .ign import IGNIE, OneUPIE
|
||||||
from .imdb import (
|
from .imdb import (
|
||||||
@@ -103,6 +109,7 @@ from .keezmovies import KeezMoviesIE
|
|||||||
from .khanacademy import KhanAcademyIE
|
from .khanacademy import KhanAcademyIE
|
||||||
from .kickstarter import KickStarterIE
|
from .kickstarter import KickStarterIE
|
||||||
from .keek import KeekIE
|
from .keek import KeekIE
|
||||||
|
from .la7 import LA7IE
|
||||||
from .liveleak import LiveLeakIE
|
from .liveleak import LiveLeakIE
|
||||||
from .livestream import LivestreamIE, LivestreamOriginalIE
|
from .livestream import LivestreamIE, LivestreamOriginalIE
|
||||||
from .lynda import (
|
from .lynda import (
|
||||||
@@ -110,6 +117,7 @@ from .lynda import (
|
|||||||
LyndaCourseIE
|
LyndaCourseIE
|
||||||
)
|
)
|
||||||
from .macgamestore import MacGameStoreIE
|
from .macgamestore import MacGameStoreIE
|
||||||
|
from .malemotion import MalemotionIE
|
||||||
from .mdr import MDRIE
|
from .mdr import MDRIE
|
||||||
from .metacafe import MetacafeIE
|
from .metacafe import MetacafeIE
|
||||||
from .metacritic import MetacriticIE
|
from .metacritic import MetacriticIE
|
||||||
@@ -117,7 +125,10 @@ from .mit import TechTVMITIE, MITIE
|
|||||||
from .mixcloud import MixcloudIE
|
from .mixcloud import MixcloudIE
|
||||||
from .mpora import MporaIE
|
from .mpora import MporaIE
|
||||||
from .mofosex import MofosexIE
|
from .mofosex import MofosexIE
|
||||||
from .mtv import MTVIE
|
from .mtv import (
|
||||||
|
MTVIE,
|
||||||
|
MTVIggyIE,
|
||||||
|
)
|
||||||
from .muzu import MuzuTVIE
|
from .muzu import MuzuTVIE
|
||||||
from .myspace import MySpaceIE
|
from .myspace import MySpaceIE
|
||||||
from .myspass import MySpassIE
|
from .myspass import MySpassIE
|
||||||
@@ -131,6 +142,7 @@ from .nhl import NHLIE, NHLVideocenterIE
|
|||||||
from .niconico import NiconicoIE
|
from .niconico import NiconicoIE
|
||||||
from .ninegag import NineGagIE
|
from .ninegag import NineGagIE
|
||||||
from .novamov import NovamovIE
|
from .novamov import NovamovIE
|
||||||
|
from .nowness import NownessIE
|
||||||
from .nowvideo import NowVideoIE
|
from .nowvideo import NowVideoIE
|
||||||
from .ooyala import OoyalaIE
|
from .ooyala import OoyalaIE
|
||||||
from .orf import ORFIE
|
from .orf import ORFIE
|
||||||
@@ -150,6 +162,7 @@ from .rottentomatoes import RottenTomatoesIE
|
|||||||
from .roxwel import RoxwelIE
|
from .roxwel import RoxwelIE
|
||||||
from .rtlnow import RTLnowIE
|
from .rtlnow import RTLnowIE
|
||||||
from .rutube import RutubeIE
|
from .rutube import RutubeIE
|
||||||
|
from .servingsys import ServingSysIE
|
||||||
from .sina import SinaIE
|
from .sina import SinaIE
|
||||||
from .slashdot import SlashdotIE
|
from .slashdot import SlashdotIE
|
||||||
from .slideshare import SlideshareIE
|
from .slideshare import SlideshareIE
|
||||||
@@ -168,6 +181,7 @@ from .southparkstudios import (
|
|||||||
from .space import SpaceIE
|
from .space import SpaceIE
|
||||||
from .spankwire import SpankwireIE
|
from .spankwire import SpankwireIE
|
||||||
from .spiegel import SpiegelIE
|
from .spiegel import SpiegelIE
|
||||||
|
from .spike import SpikeIE
|
||||||
from .stanfordoc import StanfordOpenClassroomIE
|
from .stanfordoc import StanfordOpenClassroomIE
|
||||||
from .statigram import StatigramIE
|
from .statigram import StatigramIE
|
||||||
from .steam import SteamIE
|
from .steam import SteamIE
|
||||||
@@ -210,7 +224,6 @@ from .vine import VineIE
|
|||||||
from .viki import VikiIE
|
from .viki import VikiIE
|
||||||
from .vk import VKIE
|
from .vk import VKIE
|
||||||
from .wat import WatIE
|
from .wat import WatIE
|
||||||
from .websurg import WeBSurgIE
|
|
||||||
from .weibo import WeiboIE
|
from .weibo import WeiboIE
|
||||||
from .wimp import WimpIE
|
from .wimp import WimpIE
|
||||||
from .wistia import WistiaIE
|
from .wistia import WistiaIE
|
||||||
|
@@ -1,22 +1,28 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
determine_ext,
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ARDIE(InfoExtractor):
|
class ARDIE(InfoExtractor):
|
||||||
_VALID_URL = r'^(?:https?://)?(?:(?:www\.)?ardmediathek\.de|mediathek\.daserste\.de)/(?:.*/)(?P<video_id>[^/\?]+)(?:\?.*)?'
|
_VALID_URL = r'^https?://(?:(?:www\.)?ardmediathek\.de|mediathek\.daserste\.de)/(?:.*/)(?P<video_id>[^/\?]+)(?:\?.*)?'
|
||||||
_TITLE = r'<h1(?: class="boxTopHeadline")?>(?P<title>.*)</h1>'
|
|
||||||
_MEDIA_STREAM = r'mediaCollection\.addMediaStream\((?P<media_type>\d+), (?P<quality>\d+), "(?P<rtmp_url>[^"]*)", "(?P<video_url>[^"]*)", "[^"]*"\)'
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.ardmediathek.de/das-erste/tagesschau-in-100-sek?documentId=14077640',
|
'url': 'http://www.ardmediathek.de/das-erste/guenther-jauch/edward-snowden-im-interview-held-oder-verraeter?documentId=19288786',
|
||||||
u'file': u'14077640.mp4',
|
'file': '19288786.mp4',
|
||||||
u'md5': u'6ca8824255460c787376353f9e20bbd8',
|
'md5': '515bf47ce209fb3f5a61b7aad364634c',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"title": u"11.04.2013 09:23 Uhr - Tagesschau in 100 Sekunden"
|
'title': 'Edward Snowden im Interview - Held oder Verräter?',
|
||||||
|
'description': 'Edward Snowden hat alles aufs Spiel gesetzt, um die weltweite \xdcberwachung durch die Geheimdienste zu enttarnen. Nun stellt sich der ehemalige NSA-Mitarbeiter erstmals weltweit in einem TV-Interview den Fragen eines NDR-Journalisten. Die Sendung vom Sonntagabend.',
|
||||||
|
'thumbnail': 'http://www.ardmediathek.de/ard/servlet/contentblob/19/28/87/90/19288790/bild/2250037',
|
||||||
},
|
},
|
||||||
u'skip': u'Requires rtmpdump'
|
'skip': 'Blocked outside of Germany',
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@@ -29,26 +35,49 @@ class ARDIE(InfoExtractor):
|
|||||||
else:
|
else:
|
||||||
video_id = m.group('video_id')
|
video_id = m.group('video_id')
|
||||||
|
|
||||||
# determine title and media streams from webpage
|
webpage = self._download_webpage(url, video_id)
|
||||||
html = self._download_webpage(url, video_id)
|
|
||||||
title = re.search(self._TITLE, html).group('title')
|
title = self._html_search_regex(
|
||||||
streams = [mo.groupdict() for mo in re.finditer(self._MEDIA_STREAM, html)]
|
r'<h1(?:\s+class="boxTopHeadline")?>(.*?)</h1>', webpage, 'title')
|
||||||
|
description = self._html_search_meta(
|
||||||
|
'dcterms.abstract', webpage, 'description')
|
||||||
|
thumbnail = self._og_search_thumbnail(webpage)
|
||||||
|
|
||||||
|
streams = [
|
||||||
|
mo.groupdict()
|
||||||
|
for mo in re.finditer(
|
||||||
|
r'mediaCollection\.addMediaStream\((?P<media_type>\d+), (?P<quality>\d+), "(?P<rtmp_url>[^"]*)", "(?P<video_url>[^"]*)", "[^"]*"\)', webpage)]
|
||||||
if not streams:
|
if not streams:
|
||||||
assert '"fsk"' in html
|
if '"fsk"' in webpage:
|
||||||
raise ExtractorError(u'This video is only available after 8:00 pm')
|
raise ExtractorError('This video is only available after 20:00')
|
||||||
|
|
||||||
# choose default media type and highest quality for now
|
formats = []
|
||||||
stream = max([s for s in streams if int(s["media_type"]) == 0],
|
for s in streams:
|
||||||
key=lambda s: int(s["quality"]))
|
format = {
|
||||||
|
'quality': int(s['quality']),
|
||||||
|
}
|
||||||
|
if s.get('rtmp_url'):
|
||||||
|
format['protocol'] = 'rtmp'
|
||||||
|
format['url'] = s['rtmp_url']
|
||||||
|
format['playpath'] = s['video_url']
|
||||||
|
else:
|
||||||
|
format['url'] = s['video_url']
|
||||||
|
|
||||||
# there's two possibilities: RTMP stream or HTTP download
|
quality_name = self._search_regex(
|
||||||
info = {'id': video_id, 'title': title, 'ext': 'mp4'}
|
r'[,.]([a-zA-Z0-9_-]+),?\.mp4', format['url'],
|
||||||
if stream['rtmp_url']:
|
'quality name', default='NA')
|
||||||
self.to_screen(u'RTMP download detected')
|
format['format_id'] = '%s-%s-%s-%s' % (
|
||||||
assert stream['video_url'].startswith('mp4:')
|
determine_ext(format['url']), quality_name, s['media_type'],
|
||||||
info["url"] = stream["rtmp_url"]
|
s['quality'])
|
||||||
info["play_path"] = stream['video_url']
|
|
||||||
else:
|
formats.append(format)
|
||||||
assert stream["video_url"].endswith('.mp4')
|
|
||||||
info["url"] = stream["video_url"]
|
self._sort_formats(formats)
|
||||||
return [info]
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': title,
|
||||||
|
'description': description,
|
||||||
|
'formats': formats,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
}
|
||||||
|
@@ -9,9 +9,11 @@ from .common import InfoExtractor
|
|||||||
from ..utils import (
|
from ..utils import (
|
||||||
compat_urllib_parse,
|
compat_urllib_parse,
|
||||||
find_xpath_attr,
|
find_xpath_attr,
|
||||||
|
fix_xml_ampersands,
|
||||||
compat_urlparse,
|
compat_urlparse,
|
||||||
compat_str,
|
compat_str,
|
||||||
compat_urllib_request,
|
compat_urllib_request,
|
||||||
|
compat_parse_qs,
|
||||||
|
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
unsmuggle_url,
|
unsmuggle_url,
|
||||||
@@ -83,17 +85,33 @@ class BrightcoveIE(InfoExtractor):
|
|||||||
lambda m: m.group(1) + '/>', object_str)
|
lambda m: m.group(1) + '/>', object_str)
|
||||||
# Fix up some stupid XML, see https://github.com/rg3/youtube-dl/issues/1608
|
# Fix up some stupid XML, see https://github.com/rg3/youtube-dl/issues/1608
|
||||||
object_str = object_str.replace('<--', '<!--')
|
object_str = object_str.replace('<--', '<!--')
|
||||||
|
object_str = fix_xml_ampersands(object_str)
|
||||||
|
|
||||||
object_doc = xml.etree.ElementTree.fromstring(object_str)
|
object_doc = xml.etree.ElementTree.fromstring(object_str)
|
||||||
assert 'BrightcoveExperience' in object_doc.attrib['class']
|
|
||||||
params = {
|
fv_el = find_xpath_attr(object_doc, './param', 'name', 'flashVars')
|
||||||
'playerID': find_xpath_attr(object_doc, './param', 'name', 'playerID').attrib['value'],
|
if fv_el is not None:
|
||||||
}
|
flashvars = dict(
|
||||||
|
(k, v[0])
|
||||||
|
for k, v in compat_parse_qs(fv_el.attrib['value']).items())
|
||||||
|
else:
|
||||||
|
flashvars = {}
|
||||||
|
|
||||||
def find_param(name):
|
def find_param(name):
|
||||||
|
if name in flashvars:
|
||||||
|
return flashvars[name]
|
||||||
node = find_xpath_attr(object_doc, './param', 'name', name)
|
node = find_xpath_attr(object_doc, './param', 'name', name)
|
||||||
if node is not None:
|
if node is not None:
|
||||||
return node.attrib['value']
|
return node.attrib['value']
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
params = {}
|
||||||
|
|
||||||
|
playerID = find_param('playerID')
|
||||||
|
if playerID is None:
|
||||||
|
raise ExtractorError('Cannot find player ID')
|
||||||
|
params['playerID'] = playerID
|
||||||
|
|
||||||
playerKey = find_param('playerKey')
|
playerKey = find_param('playerKey')
|
||||||
# Not all pages define this value
|
# Not all pages define this value
|
||||||
if playerKey is not None:
|
if playerKey is not None:
|
||||||
@@ -114,8 +132,12 @@ class BrightcoveIE(InfoExtractor):
|
|||||||
if it can't be found
|
if it can't be found
|
||||||
"""
|
"""
|
||||||
m_brightcove = re.search(
|
m_brightcove = re.search(
|
||||||
r'<object[^>]+?class=([\'"])[^>]*?BrightcoveExperience.*?\1.+?</object>',
|
r'''(?sx)<object
|
||||||
webpage, re.DOTALL)
|
(?:
|
||||||
|
[^>]+?class=([\'"])[^>]*?BrightcoveExperience.*?\1 |
|
||||||
|
[^>]*?>\s*<param\s+name="movie"\s+value="https?://[^/]*brightcove\.com/
|
||||||
|
).+?</object>''',
|
||||||
|
webpage)
|
||||||
if m_brightcove is not None:
|
if m_brightcove is not None:
|
||||||
return cls._build_brighcove_url(m_brightcove.group())
|
return cls._build_brighcove_url(m_brightcove.group())
|
||||||
else:
|
else:
|
||||||
@@ -156,6 +178,7 @@ class BrightcoveIE(InfoExtractor):
|
|||||||
info = self._search_regex(r'var experienceJSON = ({.*?});', webpage, 'json')
|
info = self._search_regex(r'var experienceJSON = ({.*?});', webpage, 'json')
|
||||||
info = json.loads(info)['data']
|
info = json.loads(info)['data']
|
||||||
video_info = info['programmedContent']['videoPlayer']['mediaDTO']
|
video_info = info['programmedContent']['videoPlayer']['mediaDTO']
|
||||||
|
video_info['_youtubedl_adServerURL'] = info.get('adServerURL')
|
||||||
|
|
||||||
return self._extract_video_info(video_info)
|
return self._extract_video_info(video_info)
|
||||||
|
|
||||||
@@ -175,7 +198,7 @@ class BrightcoveIE(InfoExtractor):
|
|||||||
def _extract_video_info(self, video_info):
|
def _extract_video_info(self, video_info):
|
||||||
info = {
|
info = {
|
||||||
'id': compat_str(video_info['id']),
|
'id': compat_str(video_info['id']),
|
||||||
'title': video_info['displayName'],
|
'title': video_info['displayName'].strip(),
|
||||||
'description': video_info.get('shortDescription'),
|
'description': video_info.get('shortDescription'),
|
||||||
'thumbnail': video_info.get('videoStillURL') or video_info.get('thumbnailURL'),
|
'thumbnail': video_info.get('videoStillURL') or video_info.get('thumbnailURL'),
|
||||||
'uploader': video_info.get('publisherName'),
|
'uploader': video_info.get('publisherName'),
|
||||||
@@ -193,6 +216,23 @@ class BrightcoveIE(InfoExtractor):
|
|||||||
info.update({
|
info.update({
|
||||||
'url': video_info['FLVFullLengthURL'],
|
'url': video_info['FLVFullLengthURL'],
|
||||||
})
|
})
|
||||||
else:
|
|
||||||
|
if self._downloader.params.get('include_ads', False):
|
||||||
|
adServerURL = video_info.get('_youtubedl_adServerURL')
|
||||||
|
if adServerURL:
|
||||||
|
ad_info = {
|
||||||
|
'_type': 'url',
|
||||||
|
'url': adServerURL,
|
||||||
|
}
|
||||||
|
if 'url' in info:
|
||||||
|
return {
|
||||||
|
'_type': 'playlist',
|
||||||
|
'title': info['title'],
|
||||||
|
'entries': [ad_info, info],
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
return ad_info
|
||||||
|
|
||||||
|
if 'url' not in info and not info.get('formats'):
|
||||||
raise ExtractorError('Unable to extract video url for %s' % info['id'])
|
raise ExtractorError('Unable to extract video url for %s' % info['id'])
|
||||||
return info
|
return info
|
||||||
|
59
youtube_dl/extractor/cliphunter.py
Normal file
59
youtube_dl/extractor/cliphunter.py
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
import string
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
ExtractorError,
|
||||||
|
)
|
||||||
|
|
||||||
|
translation_table = {
|
||||||
|
'a': 'h', 'd': 'e', 'e': 'v', 'f': 'o', 'g': 'f', 'i': 'd', 'l': 'n',
|
||||||
|
'm': 'a', 'n': 'm', 'p': 'u', 'q': 't', 'r': 's', 'v': 'p', 'x': 'r',
|
||||||
|
'y': 'l', 'z': 'i',
|
||||||
|
'$': ':', '&': '.', '(': '=', '^': '&', '=': '/',
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class CliphunterIE(InfoExtractor):
|
||||||
|
IE_NAME = 'cliphunter'
|
||||||
|
|
||||||
|
_VALID_URL = r'''(?x)http://(?:www\.)?cliphunter\.com/w/
|
||||||
|
(?P<id>[0-9]+)/
|
||||||
|
(?P<seo>.+?)(?:$|[#\?])
|
||||||
|
'''
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://www.cliphunter.com/w/1012420/Fun_Jynx_Maze_solo',
|
||||||
|
'file': '1012420.flv',
|
||||||
|
'md5': '15e7740f30428abf70f4223478dc1225',
|
||||||
|
'info_dict': {
|
||||||
|
'title': 'Fun Jynx Maze solo',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
|
pl_fiji = self._search_regex(
|
||||||
|
r'pl_fiji = \'([^\']+)\'', webpage, 'video data')
|
||||||
|
pl_c_qual = self._search_regex(
|
||||||
|
r'pl_c_qual = "(.)"', webpage, 'video quality')
|
||||||
|
video_title = self._search_regex(
|
||||||
|
r'mediaTitle = "([^"]+)"', webpage, 'title')
|
||||||
|
|
||||||
|
video_url = ''.join(translation_table.get(c, c) for c in pl_fiji)
|
||||||
|
|
||||||
|
formats = [{
|
||||||
|
'url': video_url,
|
||||||
|
'format_id': pl_c_qual,
|
||||||
|
}]
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': video_title,
|
||||||
|
'formats': formats,
|
||||||
|
}
|
@@ -3,7 +3,7 @@ import re
|
|||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
find_xpath_attr,
|
find_xpath_attr,
|
||||||
fix_xml_all_ampersand,
|
fix_xml_ampersands
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ class ClipsyndicateIE(InfoExtractor):
|
|||||||
pdoc = self._download_xml(
|
pdoc = self._download_xml(
|
||||||
'http://eplayer.clipsyndicate.com/osmf/playlist?%s' % flvars,
|
'http://eplayer.clipsyndicate.com/osmf/playlist?%s' % flvars,
|
||||||
video_id, u'Downloading video info',
|
video_id, u'Downloading video info',
|
||||||
transform_source=fix_xml_all_ampersand)
|
transform_source=fix_xml_ampersands)
|
||||||
|
|
||||||
track_doc = pdoc.find('trackList/track')
|
track_doc = pdoc.find('trackList/track')
|
||||||
def find_param(name):
|
def find_param(name):
|
||||||
|
@@ -25,12 +25,13 @@ class CNNIE(InfoExtractor):
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
u"url": u"http://edition.cnn.com/video/?/video/us/2013/08/21/sot-student-gives-epic-speech.georgia-institute-of-technology&utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+rss%2Fcnn_topstories+%28RSS%3A+Top+Stories%29",
|
"url": "http://edition.cnn.com/video/?/video/us/2013/08/21/sot-student-gives-epic-speech.georgia-institute-of-technology&utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+rss%2Fcnn_topstories+%28RSS%3A+Top+Stories%29",
|
||||||
u"file": u"us_2013_08_21_sot-student-gives-epic-speech.georgia-institute-of-technology.mp4",
|
"file": "us_2013_08_21_sot-student-gives-epic-speech.georgia-institute-of-technology.mp4",
|
||||||
u"md5": u"b5cc60c60a3477d185af8f19a2a26f4e",
|
"md5": "b5cc60c60a3477d185af8f19a2a26f4e",
|
||||||
u"info_dict": {
|
"info_dict": {
|
||||||
u"title": "Student's epic speech stuns new freshmen",
|
"title": "Student's epic speech stuns new freshmen",
|
||||||
u"description": "A Georgia Tech student welcomes the incoming freshmen with an epic speech backed by music from \"2001: A Space Odyssey.\""
|
"description": "A Georgia Tech student welcomes the incoming freshmen with an epic speech backed by music from \"2001: A Space Odyssey.\"",
|
||||||
|
"upload_date": "20130821",
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
@@ -15,30 +17,22 @@ class ComedyCentralIE(MTVServicesInfoExtractor):
|
|||||||
_VALID_URL = r'''(?x)https?://(?:www.)?comedycentral.com/
|
_VALID_URL = r'''(?x)https?://(?:www.)?comedycentral.com/
|
||||||
(video-clips|episodes|cc-studios|video-collections)
|
(video-clips|episodes|cc-studios|video-collections)
|
||||||
/(?P<title>.*)'''
|
/(?P<title>.*)'''
|
||||||
_FEED_URL = u'http://comedycentral.com/feeds/mrss/'
|
_FEED_URL = 'http://comedycentral.com/feeds/mrss/'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.comedycentral.com/video-clips/kllhuv/stand-up-greg-fitzsimmons--uncensored---too-good-of-a-mother',
|
'url': 'http://www.comedycentral.com/video-clips/kllhuv/stand-up-greg-fitzsimmons--uncensored---too-good-of-a-mother',
|
||||||
u'md5': u'4167875aae411f903b751a21f357f1ee',
|
'md5': '4167875aae411f903b751a21f357f1ee',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'id': u'cef0cbb3-e776-4bc9-b62e-8016deccb354',
|
'id': 'cef0cbb3-e776-4bc9-b62e-8016deccb354',
|
||||||
u'ext': u'mp4',
|
'ext': 'mp4',
|
||||||
u'title': u'Uncensored - Greg Fitzsimmons - Too Good of a Mother',
|
'title': 'CC:Stand-Up|Greg Fitzsimmons: Life on Stage|Uncensored - Too Good of a Mother',
|
||||||
u'description': u'After a certain point, breastfeeding becomes c**kblocking.',
|
'description': 'After a certain point, breastfeeding becomes c**kblocking.',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
|
||||||
mobj = re.match(self._VALID_URL, url)
|
|
||||||
title = mobj.group('title')
|
|
||||||
webpage = self._download_webpage(url, title)
|
|
||||||
mgid = self._search_regex(r'data-mgid="(?P<mgid>mgid:.*?)"',
|
|
||||||
webpage, u'mgid')
|
|
||||||
return self._get_videos_info(mgid)
|
|
||||||
|
|
||||||
|
|
||||||
class ComedyCentralShowsIE(InfoExtractor):
|
class ComedyCentralShowsIE(InfoExtractor):
|
||||||
IE_DESC = u'The Daily Show / Colbert Report'
|
IE_DESC = 'The Daily Show / Colbert Report'
|
||||||
# urls can be abbreviations like :thedailyshow or :colbert
|
# urls can be abbreviations like :thedailyshow or :colbert
|
||||||
# urls for episodes like:
|
# urls for episodes like:
|
||||||
# or urls for clips like: http://www.thedailyshow.com/watch/mon-december-10-2012/any-given-gun-day
|
# or urls for clips like: http://www.thedailyshow.com/watch/mon-december-10-2012/any-given-gun-day
|
||||||
@@ -55,14 +49,14 @@ class ComedyCentralShowsIE(InfoExtractor):
|
|||||||
extended-interviews/(?P<interID>[0-9]+)/playlist_tds_extended_(?P<interview_title>.*?)/.*?)))
|
extended-interviews/(?P<interID>[0-9]+)/playlist_tds_extended_(?P<interview_title>.*?)/.*?)))
|
||||||
$"""
|
$"""
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.thedailyshow.com/watch/thu-december-13-2012/kristen-stewart',
|
'url': 'http://www.thedailyshow.com/watch/thu-december-13-2012/kristen-stewart',
|
||||||
u'file': u'422212.mp4',
|
'file': '422212.mp4',
|
||||||
u'md5': u'4e2f5cb088a83cd8cdb7756132f9739d',
|
'md5': '4e2f5cb088a83cd8cdb7756132f9739d',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"upload_date": u"20121214",
|
"upload_date": "20121214",
|
||||||
u"description": u"Kristen Stewart",
|
"description": "Kristen Stewart",
|
||||||
u"uploader": u"thedailyshow",
|
"uploader": "thedailyshow",
|
||||||
u"title": u"thedailyshow-kristen-stewart part 1"
|
"title": "thedailyshow-kristen-stewart part 1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,20 +88,20 @@ class ComedyCentralShowsIE(InfoExtractor):
|
|||||||
def _transform_rtmp_url(rtmp_video_url):
|
def _transform_rtmp_url(rtmp_video_url):
|
||||||
m = re.match(r'^rtmpe?://.*?/(?P<finalid>gsp.comedystor/.*)$', rtmp_video_url)
|
m = re.match(r'^rtmpe?://.*?/(?P<finalid>gsp.comedystor/.*)$', rtmp_video_url)
|
||||||
if not m:
|
if not m:
|
||||||
raise ExtractorError(u'Cannot transform RTMP url')
|
raise ExtractorError('Cannot transform RTMP url')
|
||||||
base = 'http://mtvnmobile.vo.llnwd.net/kip0/_pxn=1+_pxI0=Ripod-h264+_pxL0=undefined+_pxM0=+_pxK=18639+_pxE=mp4/44620/mtvnorigin/'
|
base = 'http://mtvnmobile.vo.llnwd.net/kip0/_pxn=1+_pxI0=Ripod-h264+_pxL0=undefined+_pxM0=+_pxK=18639+_pxE=mp4/44620/mtvnorigin/'
|
||||||
return base + m.group('finalid')
|
return base + m.group('finalid')
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url, re.VERBOSE)
|
mobj = re.match(self._VALID_URL, url, re.VERBOSE)
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
raise ExtractorError(u'Invalid URL: %s' % url)
|
raise ExtractorError('Invalid URL: %s' % url)
|
||||||
|
|
||||||
if mobj.group('shortname'):
|
if mobj.group('shortname'):
|
||||||
if mobj.group('shortname') in ('tds', 'thedailyshow'):
|
if mobj.group('shortname') in ('tds', 'thedailyshow'):
|
||||||
url = u'http://www.thedailyshow.com/full-episodes/'
|
url = 'http://www.thedailyshow.com/full-episodes/'
|
||||||
else:
|
else:
|
||||||
url = u'http://www.colbertnation.com/full-episodes/'
|
url = 'http://www.colbertnation.com/full-episodes/'
|
||||||
mobj = re.match(self._VALID_URL, url, re.VERBOSE)
|
mobj = re.match(self._VALID_URL, url, re.VERBOSE)
|
||||||
assert mobj is not None
|
assert mobj is not None
|
||||||
|
|
||||||
@@ -133,9 +127,9 @@ class ComedyCentralShowsIE(InfoExtractor):
|
|||||||
url = htmlHandle.geturl()
|
url = htmlHandle.geturl()
|
||||||
mobj = re.match(self._VALID_URL, url, re.VERBOSE)
|
mobj = re.match(self._VALID_URL, url, re.VERBOSE)
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
raise ExtractorError(u'Invalid redirected URL: ' + url)
|
raise ExtractorError('Invalid redirected URL: ' + url)
|
||||||
if mobj.group('episode') == '':
|
if mobj.group('episode') == '':
|
||||||
raise ExtractorError(u'Redirected URL is still not specific: ' + url)
|
raise ExtractorError('Redirected URL is still not specific: ' + url)
|
||||||
epTitle = mobj.group('episode')
|
epTitle = mobj.group('episode')
|
||||||
|
|
||||||
mMovieParams = re.findall('(?:<param name="movie" value="|var url = ")(http://media.mtvnservices.com/([^"]*(?:episode|video).*?:.*?))"', webpage)
|
mMovieParams = re.findall('(?:<param name="movie" value="|var url = ")(http://media.mtvnservices.com/([^"]*(?:episode|video).*?:.*?))"', webpage)
|
||||||
@@ -147,15 +141,15 @@ class ComedyCentralShowsIE(InfoExtractor):
|
|||||||
|
|
||||||
altMovieParams = re.findall('data-mgid="([^"]*(?:episode|video).*?:.*?)"', webpage)
|
altMovieParams = re.findall('data-mgid="([^"]*(?:episode|video).*?:.*?)"', webpage)
|
||||||
if len(altMovieParams) == 0:
|
if len(altMovieParams) == 0:
|
||||||
raise ExtractorError(u'unable to find Flash URL in webpage ' + url)
|
raise ExtractorError('unable to find Flash URL in webpage ' + url)
|
||||||
else:
|
else:
|
||||||
mMovieParams = [("http://media.mtvnservices.com/" + altMovieParams[0], altMovieParams[0])]
|
mMovieParams = [("http://media.mtvnservices.com/" + altMovieParams[0], altMovieParams[0])]
|
||||||
|
|
||||||
uri = mMovieParams[0][1]
|
uri = mMovieParams[0][1]
|
||||||
indexUrl = 'http://shadow.comedycentral.com/feeds/video_player/mrss/?' + compat_urllib_parse.urlencode({'uri': uri})
|
indexUrl = 'http://shadow.comedycentral.com/feeds/video_player/mrss/?' + compat_urllib_parse.urlencode({'uri': uri})
|
||||||
idoc = self._download_xml(indexUrl, epTitle,
|
idoc = self._download_xml(indexUrl, epTitle,
|
||||||
u'Downloading show index',
|
'Downloading show index',
|
||||||
u'unable to download episode index')
|
'unable to download episode index')
|
||||||
|
|
||||||
results = []
|
results = []
|
||||||
|
|
||||||
@@ -170,7 +164,7 @@ class ComedyCentralShowsIE(InfoExtractor):
|
|||||||
configUrl = ('http://www.comedycentral.com/global/feeds/entertainment/media/mediaGenEntertainment.jhtml?' +
|
configUrl = ('http://www.comedycentral.com/global/feeds/entertainment/media/mediaGenEntertainment.jhtml?' +
|
||||||
compat_urllib_parse.urlencode({'uri': mediaId}))
|
compat_urllib_parse.urlencode({'uri': mediaId}))
|
||||||
cdoc = self._download_xml(configUrl, epTitle,
|
cdoc = self._download_xml(configUrl, epTitle,
|
||||||
u'Downloading configuration for %s' % shortMediaId)
|
'Downloading configuration for %s' % shortMediaId)
|
||||||
|
|
||||||
turls = []
|
turls = []
|
||||||
for rendition in cdoc.findall('.//rendition'):
|
for rendition in cdoc.findall('.//rendition'):
|
||||||
@@ -178,7 +172,7 @@ class ComedyCentralShowsIE(InfoExtractor):
|
|||||||
turls.append(finfo)
|
turls.append(finfo)
|
||||||
|
|
||||||
if len(turls) == 0:
|
if len(turls) == 0:
|
||||||
self._downloader.report_error(u'unable to download ' + mediaId + ': No videos found')
|
self._downloader.report_error('unable to download ' + mediaId + ': No videos found')
|
||||||
continue
|
continue
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
@@ -192,7 +186,7 @@ class ComedyCentralShowsIE(InfoExtractor):
|
|||||||
'width': w,
|
'width': w,
|
||||||
})
|
})
|
||||||
|
|
||||||
effTitle = showId + u'-' + epTitle + u' part ' + compat_str(partNum+1)
|
effTitle = showId + '-' + epTitle + ' part ' + compat_str(partNum+1)
|
||||||
results.append({
|
results.append({
|
||||||
'id': shortMediaId,
|
'id': shortMediaId,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
import base64
|
import base64
|
||||||
|
import hashlib
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
@@ -62,13 +63,15 @@ class InfoExtractor(object):
|
|||||||
* tbr Average bitrate of audio and video in KBit/s
|
* tbr Average bitrate of audio and video in KBit/s
|
||||||
* abr Average audio bitrate in KBit/s
|
* abr Average audio bitrate in KBit/s
|
||||||
* acodec Name of the audio codec in use
|
* acodec Name of the audio codec in use
|
||||||
|
* asr Audio sampling rate in Hertz
|
||||||
* vbr Average video bitrate in KBit/s
|
* vbr Average video bitrate in KBit/s
|
||||||
* vcodec Name of the video codec in use
|
* vcodec Name of the video codec in use
|
||||||
|
* container Name of the container format
|
||||||
* filesize The number of bytes, if known in advance
|
* filesize The number of bytes, if known in advance
|
||||||
* player_url SWF Player URL (used for rtmpdump).
|
* player_url SWF Player URL (used for rtmpdump).
|
||||||
* protocol The protocol that will be used for the actual
|
* protocol The protocol that will be used for the actual
|
||||||
download, lower-case.
|
download, lower-case.
|
||||||
"http", "https", "rtsp", "rtmp" or so.
|
"http", "https", "rtsp", "rtmp", "m3u8" or so.
|
||||||
* preference Order number of this format. If this field is
|
* preference Order number of this format. If this field is
|
||||||
present and not None, the formats get sorted
|
present and not None, the formats get sorted
|
||||||
by this field.
|
by this field.
|
||||||
@@ -219,6 +222,8 @@ class InfoExtractor(object):
|
|||||||
webpage_bytes[:1024])
|
webpage_bytes[:1024])
|
||||||
if m:
|
if m:
|
||||||
encoding = m.group(1).decode('ascii')
|
encoding = m.group(1).decode('ascii')
|
||||||
|
elif webpage_bytes.startswith(b'\xff\xfe'):
|
||||||
|
encoding = 'utf-16'
|
||||||
else:
|
else:
|
||||||
encoding = 'utf-8'
|
encoding = 'utf-8'
|
||||||
if self._downloader.params.get('dump_intermediate_pages', False):
|
if self._downloader.params.get('dump_intermediate_pages', False):
|
||||||
@@ -234,6 +239,9 @@ class InfoExtractor(object):
|
|||||||
url = url_or_request.get_full_url()
|
url = url_or_request.get_full_url()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
url = url_or_request
|
url = url_or_request
|
||||||
|
if len(url) > 200:
|
||||||
|
h = u'___' + hashlib.md5(url.encode('utf-8')).hexdigest()
|
||||||
|
url = url[:200 - len(h)] + h
|
||||||
raw_filename = ('%s_%s.dump' % (video_id, url))
|
raw_filename = ('%s_%s.dump' % (video_id, url))
|
||||||
filename = sanitize_filename(raw_filename, restricted=True)
|
filename = sanitize_filename(raw_filename, restricted=True)
|
||||||
self.to_screen(u'Saving request to ' + filename)
|
self.to_screen(u'Saving request to ' + filename)
|
||||||
@@ -458,6 +466,9 @@ class InfoExtractor(object):
|
|||||||
return RATING_TABLE.get(rating.lower(), None)
|
return RATING_TABLE.get(rating.lower(), None)
|
||||||
|
|
||||||
def _sort_formats(self, formats):
|
def _sort_formats(self, formats):
|
||||||
|
if not formats:
|
||||||
|
raise ExtractorError(u'No video formats found')
|
||||||
|
|
||||||
def _formats_key(f):
|
def _formats_key(f):
|
||||||
# TODO remove the following workaround
|
# TODO remove the following workaround
|
||||||
from ..utils import determine_ext
|
from ..utils import determine_ext
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import json
|
import json
|
||||||
@@ -20,30 +21,31 @@ class CondeNastIE(InfoExtractor):
|
|||||||
|
|
||||||
# The keys are the supported sites and the values are the name to be shown
|
# The keys are the supported sites and the values are the name to be shown
|
||||||
# to the user and in the extractor description.
|
# to the user and in the extractor description.
|
||||||
_SITES = {'wired': u'WIRED',
|
_SITES = {
|
||||||
'gq': u'GQ',
|
'wired': 'WIRED',
|
||||||
'vogue': u'Vogue',
|
'gq': 'GQ',
|
||||||
'glamour': u'Glamour',
|
'vogue': 'Vogue',
|
||||||
'wmagazine': u'W Magazine',
|
'glamour': 'Glamour',
|
||||||
'vanityfair': u'Vanity Fair',
|
'wmagazine': 'W Magazine',
|
||||||
}
|
'vanityfair': 'Vanity Fair',
|
||||||
|
}
|
||||||
|
|
||||||
_VALID_URL = r'http://(video|www).(?P<site>%s).com/(?P<type>watch|series|video)/(?P<id>.+)' % '|'.join(_SITES.keys())
|
_VALID_URL = r'http://(video|www)\.(?P<site>%s)\.com/(?P<type>watch|series|video)/(?P<id>.+)' % '|'.join(_SITES.keys())
|
||||||
IE_DESC = u'Condé Nast media group: %s' % ', '.join(sorted(_SITES.values()))
|
IE_DESC = 'Condé Nast media group: %s' % ', '.join(sorted(_SITES.values()))
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://video.wired.com/watch/3d-printed-speakers-lit-with-led',
|
'url': 'http://video.wired.com/watch/3d-printed-speakers-lit-with-led',
|
||||||
u'file': u'5171b343c2b4c00dd0c1ccb3.mp4',
|
'file': '5171b343c2b4c00dd0c1ccb3.mp4',
|
||||||
u'md5': u'1921f713ed48aabd715691f774c451f7',
|
'md5': '1921f713ed48aabd715691f774c451f7',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'3D Printed Speakers Lit With LED',
|
'title': '3D Printed Speakers Lit With LED',
|
||||||
u'description': u'Check out these beautiful 3D printed LED speakers. You can\'t actually buy them, but LumiGeek is working on a board that will let you make you\'re own.',
|
'description': 'Check out these beautiful 3D printed LED speakers. You can\'t actually buy them, but LumiGeek is working on a board that will let you make you\'re own.',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def _extract_series(self, url, webpage):
|
def _extract_series(self, url, webpage):
|
||||||
title = self._html_search_regex(r'<div class="cne-series-info">.*?<h1>(.+?)</h1>',
|
title = self._html_search_regex(r'<div class="cne-series-info">.*?<h1>(.+?)</h1>',
|
||||||
webpage, u'series title', flags=re.DOTALL)
|
webpage, 'series title', flags=re.DOTALL)
|
||||||
url_object = compat_urllib_parse_urlparse(url)
|
url_object = compat_urllib_parse_urlparse(url)
|
||||||
base_url = '%s://%s' % (url_object.scheme, url_object.netloc)
|
base_url = '%s://%s' % (url_object.scheme, url_object.netloc)
|
||||||
m_paths = re.finditer(r'<p class="cne-thumb-title">.*?<a href="(/watch/.+?)["\?]',
|
m_paths = re.finditer(r'<p class="cne-thumb-title">.*?<a href="(/watch/.+?)["\?]',
|
||||||
@@ -57,39 +59,41 @@ class CondeNastIE(InfoExtractor):
|
|||||||
description = self._html_search_regex([r'<div class="cne-video-description">(.+?)</div>',
|
description = self._html_search_regex([r'<div class="cne-video-description">(.+?)</div>',
|
||||||
r'<div class="video-post-content">(.+?)</div>',
|
r'<div class="video-post-content">(.+?)</div>',
|
||||||
],
|
],
|
||||||
webpage, u'description',
|
webpage, 'description',
|
||||||
fatal=False, flags=re.DOTALL)
|
fatal=False, flags=re.DOTALL)
|
||||||
params = self._search_regex(r'var params = {(.+?)}[;,]', webpage,
|
params = self._search_regex(r'var params = {(.+?)}[;,]', webpage,
|
||||||
u'player params', flags=re.DOTALL)
|
'player params', flags=re.DOTALL)
|
||||||
video_id = self._search_regex(r'videoId: [\'"](.+?)[\'"]', params, u'video id')
|
video_id = self._search_regex(r'videoId: [\'"](.+?)[\'"]', params, 'video id')
|
||||||
player_id = self._search_regex(r'playerId: [\'"](.+?)[\'"]', params, u'player id')
|
player_id = self._search_regex(r'playerId: [\'"](.+?)[\'"]', params, 'player id')
|
||||||
target = self._search_regex(r'target: [\'"](.+?)[\'"]', params, u'target')
|
target = self._search_regex(r'target: [\'"](.+?)[\'"]', params, 'target')
|
||||||
data = compat_urllib_parse.urlencode({'videoId': video_id,
|
data = compat_urllib_parse.urlencode({'videoId': video_id,
|
||||||
'playerId': player_id,
|
'playerId': player_id,
|
||||||
'target': target,
|
'target': target,
|
||||||
})
|
})
|
||||||
base_info_url = self._search_regex(r'url = [\'"](.+?)[\'"][,;]',
|
base_info_url = self._search_regex(r'url = [\'"](.+?)[\'"][,;]',
|
||||||
webpage, u'base info url',
|
webpage, 'base info url',
|
||||||
default='http://player.cnevids.com/player/loader.js?')
|
default='http://player.cnevids.com/player/loader.js?')
|
||||||
info_url = base_info_url + data
|
info_url = base_info_url + data
|
||||||
info_page = self._download_webpage(info_url, video_id,
|
info_page = self._download_webpage(info_url, video_id,
|
||||||
u'Downloading video info')
|
'Downloading video info')
|
||||||
video_info = self._search_regex(r'var video = ({.+?});', info_page, u'video info')
|
video_info = self._search_regex(r'var video = ({.+?});', info_page, 'video info')
|
||||||
video_info = json.loads(video_info)
|
video_info = json.loads(video_info)
|
||||||
|
|
||||||
def _formats_sort_key(f):
|
formats = [{
|
||||||
type_ord = 1 if f['type'] == 'video/mp4' else 0
|
'format_id': '%s-%s' % (fdata['type'].split('/')[-1], fdata['quality']),
|
||||||
quality_ord = 1 if f['quality'] == 'high' else 0
|
'url': fdata['src'],
|
||||||
return (quality_ord, type_ord)
|
'ext': fdata['type'].split('/')[-1],
|
||||||
best_format = sorted(video_info['sources'][0], key=_formats_sort_key)[-1]
|
'quality': 1 if fdata['quality'] == 'high' else 0,
|
||||||
|
} for fdata in video_info['sources'][0]]
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
return {'id': video_id,
|
return {
|
||||||
'url': best_format['src'],
|
'id': video_id,
|
||||||
'ext': best_format['type'].split('/')[-1],
|
'formats': formats,
|
||||||
'title': video_info['title'],
|
'title': video_info['title'],
|
||||||
'thumbnail': video_info['poster_frame'],
|
'thumbnail': video_info['poster_frame'],
|
||||||
'description': description,
|
'description': description,
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
@@ -10,7 +10,7 @@ from ..utils import (
|
|||||||
|
|
||||||
|
|
||||||
class CSpanIE(InfoExtractor):
|
class CSpanIE(InfoExtractor):
|
||||||
_VALID_URL = r'http://www\.c-spanvideo\.org/program/(.*)'
|
_VALID_URL = r'http://(?:www\.)?c-spanvideo\.org/program/(?P<name>.*)'
|
||||||
IE_DESC = 'C-SPAN'
|
IE_DESC = 'C-SPAN'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'http://www.c-spanvideo.org/program/HolderonV',
|
'url': 'http://www.c-spanvideo.org/program/HolderonV',
|
||||||
@@ -20,13 +20,14 @@ class CSpanIE(InfoExtractor):
|
|||||||
'title': 'Attorney General Eric Holder on Voting Rights Act Decision',
|
'title': 'Attorney General Eric Holder on Voting Rights Act Decision',
|
||||||
'description': 'Attorney General Eric Holder spoke to reporters following the Supreme Court decision in [Shelby County v. Holder] in which the court ruled that the preclearance provisions of the Voting Rights Act could not be enforced until Congress established new guidelines for review.',
|
'description': 'Attorney General Eric Holder spoke to reporters following the Supreme Court decision in [Shelby County v. Holder] in which the court ruled that the preclearance provisions of the Voting Rights Act could not be enforced until Congress established new guidelines for review.',
|
||||||
},
|
},
|
||||||
|
'skip': 'Regularly fails on travis, for unknown reasons',
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
prog_name = mobj.group(1)
|
prog_name = mobj.group('name')
|
||||||
webpage = self._download_webpage(url, prog_name)
|
webpage = self._download_webpage(url, prog_name)
|
||||||
video_id = self._search_regex(r'programid=(.*?)&', webpage, 'video id')
|
video_id = self._search_regex(r'prog(?:ram)?id=(.*?)&', webpage, 'video id')
|
||||||
|
|
||||||
title = self._html_search_regex(
|
title = self._html_search_regex(
|
||||||
r'<!-- title -->\n\s*<h1[^>]*>(.*?)</h1>', webpage, 'title')
|
r'<!-- title -->\n\s*<h1[^>]*>(.*?)</h1>', webpage, 'title')
|
||||||
|
@@ -1,22 +1,25 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from .canalplus import CanalplusIE
|
from .canalplus import CanalplusIE
|
||||||
|
|
||||||
|
|
||||||
class D8IE(CanalplusIE):
|
class D8IE(CanalplusIE):
|
||||||
_VALID_URL = r'https?://www\.d8\.tv/.*?/(?P<path>.*)'
|
_VALID_URL = r'https?://www\.d8\.tv/.*?/(?P<path>.*)'
|
||||||
_VIDEO_INFO_TEMPLATE = 'http://service.canal-plus.com/video/rest/getVideosLiees/d8/%s'
|
_VIDEO_INFO_TEMPLATE = 'http://service.canal-plus.com/video/rest/getVideosLiees/d8/%s'
|
||||||
IE_NAME = u'd8.tv'
|
IE_NAME = 'd8.tv'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.d8.tv/d8-docs-mags/pid6589-d8-campagne-intime.html',
|
'url': 'http://www.d8.tv/d8-docs-mags/pid6589-d8-campagne-intime.html',
|
||||||
u'file': u'966289.flv',
|
'file': '966289.flv',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'Campagne intime - Documentaire exceptionnel',
|
'title': 'Campagne intime - Documentaire exceptionnel',
|
||||||
u'description': u'md5:d2643b799fb190846ae09c61e59a859f',
|
'description': 'md5:d2643b799fb190846ae09c61e59a859f',
|
||||||
u'upload_date': u'20131108',
|
'upload_date': '20131108',
|
||||||
},
|
},
|
||||||
u'params': {
|
'params': {
|
||||||
# rtmp
|
# rtmp
|
||||||
u'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
|
'skip': 'videos get deleted after a while',
|
||||||
}
|
}
|
||||||
|
46
youtube_dl/extractor/discovery.py
Normal file
46
youtube_dl/extractor/discovery.py
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
import json
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
|
class DiscoveryIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'http://dsc\.discovery\.com\/[a-zA-Z0-9\-]*/[a-zA-Z0-9\-]*/videos/(?P<id>[a-zA-Z0-9\-]*)(.htm)?'
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://dsc.discovery.com/tv-shows/mythbusters/videos/mission-impossible-outtakes.htm',
|
||||||
|
'file': '614784.mp4',
|
||||||
|
'md5': 'e12614f9ee303a6ccef415cb0793eba2',
|
||||||
|
'info_dict': {
|
||||||
|
'title': 'MythBusters: Mission Impossible Outtakes',
|
||||||
|
'description': ('Watch Jamie Hyneman and Adam Savage practice being'
|
||||||
|
' each other -- to the point of confusing Jamie\'s dog -- and '
|
||||||
|
'don\'t miss Adam moon-walking as Jamie ... behind Jamie\'s'
|
||||||
|
' back.'),
|
||||||
|
'duration': 156,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
|
video_list_json = self._search_regex(r'var videoListJSON = ({.*?});',
|
||||||
|
webpage, 'video list', flags=re.DOTALL)
|
||||||
|
video_list = json.loads(video_list_json)
|
||||||
|
info = video_list['clips'][0]
|
||||||
|
formats = []
|
||||||
|
for f in info['mp4']:
|
||||||
|
formats.append(
|
||||||
|
{'url': f['src'], r'ext': r'mp4', 'tbr': int(f['bitrate'][:-1])})
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': info['contentId'],
|
||||||
|
'title': video_list['name'],
|
||||||
|
'formats': formats,
|
||||||
|
'description': info['videoCaption'],
|
||||||
|
'thumbnail': info.get('videoStillURL') or info.get('thumbnailURL'),
|
||||||
|
'duration': info['duration'],
|
||||||
|
}
|
31
youtube_dl/extractor/dropbox.py
Normal file
31
youtube_dl/extractor/dropbox.py
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import os.path
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
|
class DropboxIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?dropbox[.]com/s/(?P<id>[a-zA-Z0-9]{15})/(?P<title>[^?#]*)'
|
||||||
|
_TEST = {
|
||||||
|
'url': 'https://www.dropbox.com/s/mcnzehi9wo55th4/20131219_085616.mp4',
|
||||||
|
'file': 'mcnzehi9wo55th4.mp4',
|
||||||
|
'md5': 'f6d65b1b326e82fd7ab7720bea3dacae',
|
||||||
|
'info_dict': {
|
||||||
|
'title': '20131219_085616'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
title = os.path.splitext(mobj.group('title'))[0]
|
||||||
|
video_url = url + '?dl=1'
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': title,
|
||||||
|
'url': video_url,
|
||||||
|
}
|
@@ -17,7 +17,12 @@ from ..utils import (
|
|||||||
class FacebookIE(InfoExtractor):
|
class FacebookIE(InfoExtractor):
|
||||||
"""Information Extractor for Facebook"""
|
"""Information Extractor for Facebook"""
|
||||||
|
|
||||||
_VALID_URL = r'^(?:https?://)?(?:\w+\.)?facebook\.com/(?:[^#?]*#!/)?(?:video/video|photo)\.php\?(?:.*?)v=(?P<ID>\d+)(?:.*)'
|
_VALID_URL = r'''(?x)
|
||||||
|
(?:https?://)?(?:\w+\.)?facebook\.com/
|
||||||
|
(?:[^#?]*\#!/)?
|
||||||
|
(?:video/video\.php|photo\.php|video/embed)\?(?:.*?)
|
||||||
|
(?:v|video_id)=(?P<id>[0-9]+)
|
||||||
|
(?:.*)'''
|
||||||
_LOGIN_URL = 'https://www.facebook.com/login.php?next=http%3A%2F%2Ffacebook.com%2Fhome.php&login_attempt=1'
|
_LOGIN_URL = 'https://www.facebook.com/login.php?next=http%3A%2F%2Ffacebook.com%2Fhome.php&login_attempt=1'
|
||||||
_CHECKPOINT_URL = 'https://www.facebook.com/checkpoint/?next=http%3A%2F%2Ffacebook.com%2Fhome.php&_fb_noscript=1'
|
_CHECKPOINT_URL = 'https://www.facebook.com/checkpoint/?next=http%3A%2F%2Ffacebook.com%2Fhome.php&_fb_noscript=1'
|
||||||
_NETRC_MACHINE = 'facebook'
|
_NETRC_MACHINE = 'facebook'
|
||||||
@@ -90,7 +95,7 @@ class FacebookIE(InfoExtractor):
|
|||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
raise ExtractorError(u'Invalid URL: %s' % url)
|
raise ExtractorError(u'Invalid URL: %s' % url)
|
||||||
video_id = mobj.group('ID')
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
url = 'https://www.facebook.com/video/video.php?v=%s' % video_id
|
url = 'https://www.facebook.com/video/video.php?v=%s' % video_id
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
@@ -11,13 +13,13 @@ class FlickrIE(InfoExtractor):
|
|||||||
"""Information Extractor for Flickr videos"""
|
"""Information Extractor for Flickr videos"""
|
||||||
_VALID_URL = r'(?:https?://)?(?:www\.|secure\.)?flickr\.com/photos/(?P<uploader_id>[\w\-_@]+)/(?P<id>\d+).*'
|
_VALID_URL = r'(?:https?://)?(?:www\.|secure\.)?flickr\.com/photos/(?P<uploader_id>[\w\-_@]+)/(?P<id>\d+).*'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.flickr.com/photos/forestwander-nature-pictures/5645318632/in/photostream/',
|
'url': 'http://www.flickr.com/photos/forestwander-nature-pictures/5645318632/in/photostream/',
|
||||||
u'file': u'5645318632.mp4',
|
'file': '5645318632.mp4',
|
||||||
u'md5': u'6fdc01adbc89d72fc9c4f15b4a4ba87b',
|
'md5': '6fdc01adbc89d72fc9c4f15b4a4ba87b',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"description": u"Waterfalls in the Springtime at Dark Hollow Waterfalls. These are located just off of Skyline Drive in Virginia. They are only about 6/10 of a mile hike but it is a pretty steep hill and a good climb back up.",
|
"description": "Waterfalls in the Springtime at Dark Hollow Waterfalls. These are located just off of Skyline Drive in Virginia. They are only about 6/10 of a mile hike but it is a pretty steep hill and a good climb back up.",
|
||||||
u"uploader_id": u"forestwander-nature-pictures",
|
"uploader_id": "forestwander-nature-pictures",
|
||||||
u"title": u"Dark Hollow Waterfalls"
|
"title": "Dark Hollow Waterfalls"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,13 +31,13 @@ class FlickrIE(InfoExtractor):
|
|||||||
webpage_url = 'http://www.flickr.com/photos/' + video_uploader_id + '/' + video_id
|
webpage_url = 'http://www.flickr.com/photos/' + video_uploader_id + '/' + video_id
|
||||||
webpage = self._download_webpage(webpage_url, video_id)
|
webpage = self._download_webpage(webpage_url, video_id)
|
||||||
|
|
||||||
secret = self._search_regex(r"photo_secret: '(\w+)'", webpage, u'secret')
|
secret = self._search_regex(r"photo_secret: '(\w+)'", webpage, 'secret')
|
||||||
|
|
||||||
first_url = 'https://secure.flickr.com/apps/video/video_mtl_xml.gne?v=x&photo_id=' + video_id + '&secret=' + secret + '&bitrate=700&target=_self'
|
first_url = 'https://secure.flickr.com/apps/video/video_mtl_xml.gne?v=x&photo_id=' + video_id + '&secret=' + secret + '&bitrate=700&target=_self'
|
||||||
first_xml = self._download_webpage(first_url, video_id, 'Downloading first data webpage')
|
first_xml = self._download_webpage(first_url, video_id, 'Downloading first data webpage')
|
||||||
|
|
||||||
node_id = self._html_search_regex(r'<Item id="id">(\d+-\d+)</Item>',
|
node_id = self._html_search_regex(r'<Item id="id">(\d+-\d+)</Item>',
|
||||||
first_xml, u'node_id')
|
first_xml, 'node_id')
|
||||||
|
|
||||||
second_url = 'https://secure.flickr.com/video_playlist.gne?node_id=' + node_id + '&tech=flash&mode=playlist&bitrate=700&secret=' + secret + '&rd=video.yahoo.com&noad=1'
|
second_url = 'https://secure.flickr.com/video_playlist.gne?node_id=' + node_id + '&tech=flash&mode=playlist&bitrate=700&secret=' + secret + '&rd=video.yahoo.com&noad=1'
|
||||||
second_xml = self._download_webpage(second_url, video_id, 'Downloading second data webpage')
|
second_xml = self._download_webpage(second_url, video_id, 'Downloading second data webpage')
|
||||||
@@ -44,7 +46,7 @@ class FlickrIE(InfoExtractor):
|
|||||||
|
|
||||||
mobj = re.search(r'<STREAM APP="(.+?)" FULLPATH="(.+?)"', second_xml)
|
mobj = re.search(r'<STREAM APP="(.+?)" FULLPATH="(.+?)"', second_xml)
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
raise ExtractorError(u'Unable to extract video url')
|
raise ExtractorError('Unable to extract video url')
|
||||||
video_url = mobj.group(1) + unescapeHTML(mobj.group(2))
|
video_url = mobj.group(1) + unescapeHTML(mobj.group(2))
|
||||||
|
|
||||||
return [{
|
return [{
|
||||||
|
38
youtube_dl/extractor/franceinter.py
Normal file
38
youtube_dl/extractor/franceinter.py
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
|
class FranceInterIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'http://(?:www\.)?franceinter\.fr/player/reecouter\?play=(?P<id>[0-9]{6})'
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://www.franceinter.fr/player/reecouter?play=793962',
|
||||||
|
'file': '793962.mp3',
|
||||||
|
'md5': '4764932e466e6f6c79c317d2e74f6884',
|
||||||
|
"info_dict": {
|
||||||
|
"title": "L’Histoire dans les jeux vidéo",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
title = self._html_search_regex(
|
||||||
|
r'<span class="roll_overflow">(.*?)</span></h1>', webpage, 'title')
|
||||||
|
path = self._search_regex(
|
||||||
|
r'&urlAOD=(.*?)&startTime', webpage, 'video url')
|
||||||
|
video_url = 'http://www.franceinter.fr/' + path
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'formats': [{
|
||||||
|
'url': video_url,
|
||||||
|
'vcodec': 'none',
|
||||||
|
}],
|
||||||
|
'title': title,
|
||||||
|
}
|
37
youtube_dl/extractor/freespeech.py
Normal file
37
youtube_dl/extractor/freespeech.py
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
import json
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
|
class FreespeechIE(InfoExtractor):
|
||||||
|
IE_NAME = 'freespeech.org'
|
||||||
|
_VALID_URL = r'https://www\.freespeech\.org/video/(?P<title>.+)'
|
||||||
|
_TEST = {
|
||||||
|
'add_ie': ['Youtube'],
|
||||||
|
'url': 'https://www.freespeech.org/video/obama-romney-campaign-colorado-ahead-debate-0',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'poKsVCZ64uU',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Obama, Romney Campaign in Colorado Ahead of Debate',
|
||||||
|
'description': 'Obama, Romney Campaign in Colorado Ahead of Debate',
|
||||||
|
'uploader': 'freespeechtv',
|
||||||
|
'uploader_id': 'freespeechtv',
|
||||||
|
'upload_date': '20121002',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
title = mobj.group('title')
|
||||||
|
webpage = self._download_webpage(url, title)
|
||||||
|
info_json = self._search_regex(r'jQuery.extend\(Drupal.settings, ({.*?})\);', webpage, 'info')
|
||||||
|
info = json.loads(info_json)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'_type': 'url',
|
||||||
|
'url': info['jw_player']['basic_video_node_player']['file'],
|
||||||
|
'ie_key': 'Youtube',
|
||||||
|
}
|
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import json
|
import json
|
||||||
|
|
||||||
@@ -13,12 +15,12 @@ from ..utils import (
|
|||||||
class GameSpotIE(InfoExtractor):
|
class GameSpotIE(InfoExtractor):
|
||||||
_VALID_URL = r'(?:http://)?(?:www\.)?gamespot\.com/.*-(?P<page_id>\d+)/?'
|
_VALID_URL = r'(?:http://)?(?:www\.)?gamespot\.com/.*-(?P<page_id>\d+)/?'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u"url": u"http://www.gamespot.com/arma-iii/videos/arma-iii-community-guide-sitrep-i-6410818/",
|
"url": "http://www.gamespot.com/arma-iii/videos/arma-iii-community-guide-sitrep-i-6410818/",
|
||||||
u"file": u"gs-2300-6410818.mp4",
|
"file": "gs-2300-6410818.mp4",
|
||||||
u"md5": u"b2a30deaa8654fcccd43713a6b6a4825",
|
"md5": "b2a30deaa8654fcccd43713a6b6a4825",
|
||||||
u"info_dict": {
|
"info_dict": {
|
||||||
u"title": u"Arma 3 - Community Guide: SITREP I",
|
"title": "Arma 3 - Community Guide: SITREP I",
|
||||||
u'description': u'Check out this video where some of the basics of Arma 3 is explained.',
|
'description': 'Check out this video where some of the basics of Arma 3 is explained.',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,7 +28,7 @@ class GameSpotIE(InfoExtractor):
|
|||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
page_id = mobj.group('page_id')
|
page_id = mobj.group('page_id')
|
||||||
webpage = self._download_webpage(url, page_id)
|
webpage = self._download_webpage(url, page_id)
|
||||||
data_video_json = self._search_regex(r'data-video=\'(.*?)\'', webpage, u'data video')
|
data_video_json = self._search_regex(r'data-video=["\'](.*?)["\']', webpage, 'data video')
|
||||||
data_video = json.loads(unescapeHTML(data_video_json))
|
data_video = json.loads(unescapeHTML(data_video_json))
|
||||||
|
|
||||||
# Transform the manifest url to a link to the mp4 files
|
# Transform the manifest url to a link to the mp4 files
|
||||||
@@ -34,7 +36,7 @@ class GameSpotIE(InfoExtractor):
|
|||||||
f4m_url = data_video['videoStreams']['f4m_stream']
|
f4m_url = data_video['videoStreams']['f4m_stream']
|
||||||
f4m_path = compat_urlparse.urlparse(f4m_url).path
|
f4m_path = compat_urlparse.urlparse(f4m_url).path
|
||||||
QUALITIES_RE = r'((,\d+)+,?)'
|
QUALITIES_RE = r'((,\d+)+,?)'
|
||||||
qualities = self._search_regex(QUALITIES_RE, f4m_path, u'qualities').strip(',').split(',')
|
qualities = self._search_regex(QUALITIES_RE, f4m_path, 'qualities').strip(',').split(',')
|
||||||
http_path = f4m_path[1:].split('/', 1)[1]
|
http_path = f4m_path[1:].split('/', 1)[1]
|
||||||
http_template = re.sub(QUALITIES_RE, r'%s', http_path)
|
http_template = re.sub(QUALITIES_RE, r'%s', http_path)
|
||||||
http_template = http_template.replace('.csmil/manifest.f4m', '')
|
http_template = http_template.replace('.csmil/manifest.f4m', '')
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import re
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from .mtv import MTVServicesInfoExtractor
|
from .mtv import MTVServicesInfoExtractor
|
||||||
|
|
||||||
@@ -6,22 +6,13 @@ from .mtv import MTVServicesInfoExtractor
|
|||||||
class GametrailersIE(MTVServicesInfoExtractor):
|
class GametrailersIE(MTVServicesInfoExtractor):
|
||||||
_VALID_URL = r'http://www\.gametrailers\.com/(?P<type>videos|reviews|full-episodes)/(?P<id>.*?)/(?P<title>.*)'
|
_VALID_URL = r'http://www\.gametrailers\.com/(?P<type>videos|reviews|full-episodes)/(?P<id>.*?)/(?P<title>.*)'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.gametrailers.com/videos/zbvr8i/mirror-s-edge-2-e3-2013--debut-trailer',
|
'url': 'http://www.gametrailers.com/videos/zbvr8i/mirror-s-edge-2-e3-2013--debut-trailer',
|
||||||
u'file': u'70e9a5d7-cf25-4a10-9104-6f3e7342ae0d.mp4',
|
'file': '70e9a5d7-cf25-4a10-9104-6f3e7342ae0d.mp4',
|
||||||
u'md5': u'4c8e67681a0ea7ec241e8c09b3ea8cf7',
|
'md5': '4c8e67681a0ea7ec241e8c09b3ea8cf7',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'E3 2013: Debut Trailer',
|
'title': 'Mirror\'s Edge 2|E3 2013: Debut Trailer',
|
||||||
u'description': u'Faith is back! Check out the World Premiere trailer for Mirror\'s Edge 2 straight from the EA Press Conference at E3 2013!',
|
'description': 'Faith is back! Check out the World Premiere trailer for Mirror\'s Edge 2 straight from the EA Press Conference at E3 2013!',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
_FEED_URL = 'http://www.gametrailers.com/feeds/mrss'
|
_FEED_URL = 'http://www.gametrailers.com/feeds/mrss'
|
||||||
|
|
||||||
def _real_extract(self, url):
|
|
||||||
mobj = re.match(self._VALID_URL, url)
|
|
||||||
video_id = mobj.group('id')
|
|
||||||
webpage = self._download_webpage(url, video_id)
|
|
||||||
mgid = self._search_regex([r'data-video="(?P<mgid>mgid:.*?)"',
|
|
||||||
r'data-contentId=\'(?P<mgid>mgid:.*?)\''],
|
|
||||||
webpage, u'mgid')
|
|
||||||
return self._get_videos_info(mgid)
|
|
||||||
|
@@ -92,11 +92,12 @@ class GenericIE(InfoExtractor):
|
|||||||
# ooyala video
|
# ooyala video
|
||||||
{
|
{
|
||||||
'url': 'http://www.rollingstone.com/music/videos/norwegian-dj-cashmere-cat-goes-spartan-on-with-me-premiere-20131219',
|
'url': 'http://www.rollingstone.com/music/videos/norwegian-dj-cashmere-cat-goes-spartan-on-with-me-premiere-20131219',
|
||||||
|
'file': 'BwY2RxaTrTkslxOfcan0UCf0YqyvWysJ.mp4',
|
||||||
'md5': '5644c6ca5d5782c1d0d350dad9bd840c',
|
'md5': '5644c6ca5d5782c1d0d350dad9bd840c',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'BwY2RxaTrTkslxOfcan0UCf0YqyvWysJ',
|
'id': 'BwY2RxaTrTkslxOfcan0UCf0YqyvWysJ',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': '2cc213299525360.mov', #that's what we get
|
'title': '2cc213299525360.mov', # that's what we get
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
@@ -161,8 +162,19 @@ class GenericIE(InfoExtractor):
|
|||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
parsed_url = compat_urlparse.urlparse(url)
|
parsed_url = compat_urlparse.urlparse(url)
|
||||||
if not parsed_url.scheme:
|
if not parsed_url.scheme:
|
||||||
self._downloader.report_warning('The url doesn\'t specify the protocol, trying with http')
|
default_search = self._downloader.params.get('default_search')
|
||||||
return self.url_result('http://' + url)
|
if default_search is None:
|
||||||
|
default_search = 'auto'
|
||||||
|
|
||||||
|
if default_search == 'auto':
|
||||||
|
if '/' in url:
|
||||||
|
self._downloader.report_warning('The url doesn\'t specify the protocol, trying with http')
|
||||||
|
return self.url_result('http://' + url)
|
||||||
|
else:
|
||||||
|
return self.url_result('ytsearch:' + url)
|
||||||
|
else:
|
||||||
|
assert ':' in default_search
|
||||||
|
return self.url_result(default_search + url)
|
||||||
video_id = os.path.splitext(url.split('/')[-1])[0]
|
video_id = os.path.splitext(url.split('/')[-1])[0]
|
||||||
|
|
||||||
self.to_screen('%s: Requesting header' % video_id)
|
self.to_screen('%s: Requesting header' % video_id)
|
||||||
@@ -318,6 +330,18 @@ class GenericIE(InfoExtractor):
|
|||||||
if mobj is not None:
|
if mobj is not None:
|
||||||
return self.url_result(mobj.group('url'), 'Novamov')
|
return self.url_result(mobj.group('url'), 'Novamov')
|
||||||
|
|
||||||
|
# Look for embedded Facebook player
|
||||||
|
mobj = re.search(
|
||||||
|
r'<iframe[^>]+?src=(["\'])(?P<url>https://www\.facebook\.com/video/embed.+?)\1', webpage)
|
||||||
|
if mobj is not None:
|
||||||
|
return self.url_result(mobj.group('url'), 'Facebook')
|
||||||
|
|
||||||
|
# Look for embedded Huffington Post player
|
||||||
|
mobj = re.search(
|
||||||
|
r'<iframe[^>]+?src=(["\'])(?P<url>https?://embed\.live.huffingtonpost\.com/.+?)\1', webpage)
|
||||||
|
if mobj is not None:
|
||||||
|
return self.url_result(mobj.group('url'), 'HuffPost')
|
||||||
|
|
||||||
# Start with something easy: JW Player in SWFObject
|
# Start with something easy: JW Player in SWFObject
|
||||||
mobj = re.search(r'flashvars: [\'"](?:.*&)?file=(http[^\'"&]*)', webpage)
|
mobj = re.search(r'flashvars: [\'"](?:.*&)?file=(http[^\'"&]*)', webpage)
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
|
@@ -1,17 +1,25 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import base64
|
import base64
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
compat_urllib_parse,
|
||||||
|
compat_urllib_request,
|
||||||
|
ExtractorError,
|
||||||
|
HEADRequest,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class HotNewHipHopIE(InfoExtractor):
|
class HotNewHipHopIE(InfoExtractor):
|
||||||
_VALID_URL = r'http://www\.hotnewhiphop.com/.*\.(?P<id>.*)\.html'
|
_VALID_URL = r'http://www\.hotnewhiphop\.com/.*\.(?P<id>.*)\.html'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u"http://www.hotnewhiphop.com/freddie-gibbs-lay-it-down-song.1435540.html",
|
'url': 'http://www.hotnewhiphop.com/freddie-gibbs-lay-it-down-song.1435540.html',
|
||||||
u'file': u'1435540.mp3',
|
'file': '1435540.mp3',
|
||||||
u'md5': u'2c2cd2f76ef11a9b3b581e8b232f3d96',
|
'md5': '2c2cd2f76ef11a9b3b581e8b232f3d96',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"title": u'Freddie Gibbs "Lay It Down"'
|
'title': 'Freddie Gibbs - Lay It Down'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -21,24 +29,41 @@ class HotNewHipHopIE(InfoExtractor):
|
|||||||
|
|
||||||
webpage_src = self._download_webpage(url, video_id)
|
webpage_src = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
video_url_base64 = self._search_regex(r'data-path="(.*?)"',
|
video_url_base64 = self._search_regex(
|
||||||
webpage_src, u'video URL', fatal=False)
|
r'data-path="(.*?)"', webpage_src, u'video URL', fatal=False)
|
||||||
|
|
||||||
if video_url_base64 == None:
|
if video_url_base64 is None:
|
||||||
video_url = self._search_regex(r'"contentUrl" content="(.*?)"', webpage_src,
|
video_url = self._search_regex(
|
||||||
u'video URL')
|
r'"contentUrl" content="(.*?)"', webpage_src, u'video URL')
|
||||||
return self.url_result(video_url, ie='Youtube')
|
return self.url_result(video_url, ie='Youtube')
|
||||||
|
|
||||||
video_url = base64.b64decode(video_url_base64).decode('utf-8')
|
reqdata = compat_urllib_parse.urlencode([
|
||||||
|
('mediaType', 's'),
|
||||||
|
('mediaId', video_id),
|
||||||
|
])
|
||||||
|
r = compat_urllib_request.Request(
|
||||||
|
'http://www.hotnewhiphop.com/ajax/media/getActions/', data=reqdata)
|
||||||
|
r.add_header('Content-Type', 'application/x-www-form-urlencoded')
|
||||||
|
mkd = self._download_json(
|
||||||
|
r, video_id, note='Requesting media key',
|
||||||
|
errnote='Could not download media key')
|
||||||
|
if 'mediaKey' not in mkd:
|
||||||
|
raise ExtractorError('Did not get a media key')
|
||||||
|
|
||||||
video_title = self._html_search_regex(r"<title>(.*)</title>",
|
redirect_url = base64.b64decode(video_url_base64).decode('utf-8')
|
||||||
webpage_src, u'title')
|
redirect_req = HEADRequest(redirect_url)
|
||||||
|
req = self._request_webpage(
|
||||||
|
redirect_req, video_id,
|
||||||
|
note='Resolving final URL', errnote='Could not resolve final URL')
|
||||||
|
video_url = req.geturl()
|
||||||
|
if video_url.endswith('.html'):
|
||||||
|
raise ExtractorError('Redirect failed')
|
||||||
|
|
||||||
results = [{
|
video_title = self._og_search_title(webpage_src).strip()
|
||||||
'id': video_id,
|
|
||||||
'url' : video_url,
|
return {
|
||||||
'title' : video_title,
|
'id': video_id,
|
||||||
'thumbnail' : self._og_search_thumbnail(webpage_src),
|
'url': video_url,
|
||||||
'ext' : 'mp3',
|
'title': video_title,
|
||||||
}]
|
'thumbnail': self._og_search_thumbnail(webpage_src),
|
||||||
return results
|
}
|
||||||
|
82
youtube_dl/extractor/huffpost.py
Normal file
82
youtube_dl/extractor/huffpost.py
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
parse_duration,
|
||||||
|
unified_strdate,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class HuffPostIE(InfoExtractor):
|
||||||
|
IE_DESC = 'Huffington Post'
|
||||||
|
_VALID_URL = r'''(?x)
|
||||||
|
https?://(embed\.)?live\.huffingtonpost\.com/
|
||||||
|
(?:
|
||||||
|
r/segment/[^/]+/|
|
||||||
|
HPLEmbedPlayer/\?segmentId=
|
||||||
|
)
|
||||||
|
(?P<id>[0-9a-f]+)'''
|
||||||
|
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://live.huffingtonpost.com/r/segment/legalese-it/52dd3e4b02a7602131000677',
|
||||||
|
'file': '52dd3e4b02a7602131000677.mp4',
|
||||||
|
'md5': '55f5e8981c1c80a64706a44b74833de8',
|
||||||
|
'info_dict': {
|
||||||
|
'title': 'Legalese It! with @MikeSacksHP',
|
||||||
|
'description': 'This week on Legalese It, Mike talks to David Bosco about his new book on the ICC, "Rough Justice," he also discusses the Virginia AG\'s historic stance on gay marriage, the execution of Edgar Tamayo, the ICC\'s delay of Kenya\'s President and more. ',
|
||||||
|
'duration': 1549,
|
||||||
|
'upload_date': '20140124',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
api_url = 'http://embed.live.huffingtonpost.com/api/segments/%s.json' % video_id
|
||||||
|
data = self._download_json(api_url, video_id)['data']
|
||||||
|
|
||||||
|
video_title = data['title']
|
||||||
|
duration = parse_duration(data['running_time'])
|
||||||
|
upload_date = unified_strdate(data['schedule']['starts_at'])
|
||||||
|
description = data.get('description')
|
||||||
|
|
||||||
|
thumbnails = []
|
||||||
|
for url in data['images'].values():
|
||||||
|
m = re.match('.*-([0-9]+x[0-9]+)\.', url)
|
||||||
|
if not m:
|
||||||
|
continue
|
||||||
|
thumbnails.append({
|
||||||
|
'url': url,
|
||||||
|
'resolution': m.group(1),
|
||||||
|
})
|
||||||
|
|
||||||
|
formats = [{
|
||||||
|
'format': key,
|
||||||
|
'format_id': key.replace('/', '.'),
|
||||||
|
'ext': 'mp4',
|
||||||
|
'url': url,
|
||||||
|
'vcodec': 'none' if key.startswith('audio/') else None,
|
||||||
|
} for key, url in data['sources']['live'].items()]
|
||||||
|
if data.get('fivemin_id'):
|
||||||
|
fid = data['fivemin_id']
|
||||||
|
fcat = str(int(fid) // 100 + 1)
|
||||||
|
furl = 'http://avideos.5min.com/2/' + fcat[-3:] + '/' + fcat + '/' + fid + '.mp4'
|
||||||
|
formats.append({
|
||||||
|
'format': 'fivemin',
|
||||||
|
'url': furl,
|
||||||
|
'preference': 1,
|
||||||
|
})
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': video_title,
|
||||||
|
'description': description,
|
||||||
|
'formats': formats,
|
||||||
|
'duration': duration,
|
||||||
|
'upload_date': upload_date,
|
||||||
|
'thumbnails': thumbnails,
|
||||||
|
}
|
@@ -67,23 +67,16 @@ class ImdbListIE(InfoExtractor):
|
|||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
list_id = mobj.group('id')
|
list_id = mobj.group('id')
|
||||||
|
|
||||||
# RSS XML is sometimes malformed
|
webpage = self._download_webpage(url, list_id)
|
||||||
rss = self._download_webpage('http://rss.imdb.com/list/%s' % list_id, list_id, 'Downloading list RSS')
|
list_code = self._search_regex(
|
||||||
list_title = self._html_search_regex(r'<title>(.*?)</title>', rss, 'list title')
|
r'(?s)<div\s+class="list\sdetail">(.*?)class="see-more"',
|
||||||
|
webpage, 'list code')
|
||||||
# Export is independent of actual author_id, but returns 404 if no author_id is provided.
|
entries = [
|
||||||
# However, passing dummy author_id seems to be enough.
|
self.url_result('http://www.imdb.com' + m, 'Imdb')
|
||||||
csv = self._download_webpage('http://www.imdb.com/list/export?list_id=%s&author_id=ur00000000' % list_id,
|
for m in re.findall(r'href="(/video/imdb/vi[^"]+)"', webpage)]
|
||||||
list_id, 'Downloading list CSV')
|
|
||||||
|
list_title = self._html_search_regex(
|
||||||
entries = []
|
r'<h1 class="header">(.*?)</h1>', webpage, 'list title')
|
||||||
for item in csv.split('\n')[1:]:
|
|
||||||
cols = item.split(',')
|
|
||||||
if len(cols) < 2:
|
|
||||||
continue
|
|
||||||
item_id = cols[1][1:-1]
|
|
||||||
if item_id.startswith('vi'):
|
|
||||||
entries.append(self.url_result('http://www.imdb.com/video/imdb/%s' % item_id, 'Imdb'))
|
|
||||||
|
|
||||||
return self.playlist_result(entries, list_id, list_title)
|
return self.playlist_result(entries, list_id, list_title)
|
||||||
|
@@ -1,21 +1,24 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import hashlib
|
import hashlib
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import determine_ext
|
|
||||||
|
|
||||||
_md5 = lambda s: hashlib.md5(s.encode('utf-8')).hexdigest()
|
_md5 = lambda s: hashlib.md5(s.encode('utf-8')).hexdigest()
|
||||||
|
|
||||||
|
|
||||||
class KankanIE(InfoExtractor):
|
class KankanIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:.*?\.)?kankan\.com/.+?/(?P<id>\d+)\.shtml'
|
_VALID_URL = r'https?://(?:.*?\.)?kankan\.com/.+?/(?P<id>\d+)\.shtml'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://yinyue.kankan.com/vod/48/48863.shtml',
|
'url': 'http://yinyue.kankan.com/vod/48/48863.shtml',
|
||||||
u'file': u'48863.flv',
|
'file': '48863.flv',
|
||||||
u'md5': u'29aca1e47ae68fc28804aca89f29507e',
|
'md5': '29aca1e47ae68fc28804aca89f29507e',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'Ready To Go',
|
'title': 'Ready To Go',
|
||||||
},
|
},
|
||||||
|
'skip': 'Only available from China',
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@@ -23,22 +26,23 @@ class KankanIE(InfoExtractor):
|
|||||||
video_id = mobj.group('id')
|
video_id = mobj.group('id')
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
title = self._search_regex(r'(?:G_TITLE=|G_MOVIE_TITLE = )[\'"](.+?)[\'"]', webpage, u'video title')
|
title = self._search_regex(r'(?:G_TITLE=|G_MOVIE_TITLE = )[\'"](.+?)[\'"]', webpage, 'video title')
|
||||||
surls = re.search(r'surls:\[\'.+?\'\]|lurl:\'.+?\.flv\'', webpage).group(0)
|
surls = re.search(r'surls:\[\'.+?\'\]|lurl:\'.+?\.flv\'', webpage).group(0)
|
||||||
gcids = re.findall(r"http://.+?/.+?/(.+?)/", surls)
|
gcids = re.findall(r"http://.+?/.+?/(.+?)/", surls)
|
||||||
gcid = gcids[-1]
|
gcid = gcids[-1]
|
||||||
|
|
||||||
video_info_page = self._download_webpage('http://p2s.cl.kankan.com/getCdnresource_flv?gcid=%s' % gcid,
|
info_url = 'http://p2s.cl.kankan.com/getCdnresource_flv?gcid=%s' % gcid
|
||||||
video_id, u'Downloading video url info')
|
video_info_page = self._download_webpage(
|
||||||
ip = self._search_regex(r'ip:"(.+?)"', video_info_page, u'video url ip')
|
info_url, video_id, 'Downloading video url info')
|
||||||
path = self._search_regex(r'path:"(.+?)"', video_info_page, u'video url path')
|
ip = self._search_regex(r'ip:"(.+?)"', video_info_page, 'video url ip')
|
||||||
param1 = self._search_regex(r'param1:(\d+)', video_info_page, u'param1')
|
path = self._search_regex(r'path:"(.+?)"', video_info_page, 'video url path')
|
||||||
param2 = self._search_regex(r'param2:(\d+)', video_info_page, u'param2')
|
param1 = self._search_regex(r'param1:(\d+)', video_info_page, 'param1')
|
||||||
|
param2 = self._search_regex(r'param2:(\d+)', video_info_page, 'param2')
|
||||||
key = _md5('xl_mp43651' + param1 + param2)
|
key = _md5('xl_mp43651' + param1 + param2)
|
||||||
video_url = 'http://%s%s?key=%s&key1=%s' % (ip, path, key, param2)
|
video_url = 'http://%s%s?key=%s&key1=%s' % (ip, path, key, param2)
|
||||||
|
|
||||||
return {'id': video_id,
|
return {
|
||||||
'title': title,
|
'id': video_id,
|
||||||
'url': video_url,
|
'title': title,
|
||||||
'ext': determine_ext(video_url),
|
'url': video_url,
|
||||||
}
|
}
|
||||||
|
62
youtube_dl/extractor/la7.py
Normal file
62
youtube_dl/extractor/la7.py
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
parse_duration,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class LA7IE(InfoExtractor):
|
||||||
|
IE_NAME = 'la7.tv'
|
||||||
|
_VALID_URL = r'''(?x)
|
||||||
|
https?://(?:www\.)?la7\.tv/
|
||||||
|
(?:
|
||||||
|
richplayer/\?assetid=|
|
||||||
|
\?contentId=
|
||||||
|
)
|
||||||
|
(?P<id>[0-9]+)'''
|
||||||
|
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://www.la7.tv/richplayer/?assetid=50355319',
|
||||||
|
'file': '50355319.mp4',
|
||||||
|
'md5': 'ec7d1f0224d20ba293ab56cf2259651f',
|
||||||
|
'info_dict': {
|
||||||
|
'title': 'IL DIVO',
|
||||||
|
'description': 'Un film di Paolo Sorrentino con Toni Servillo, Anna Bonaiuto, Giulio Bosetti e Flavio Bucci',
|
||||||
|
'duration': 6254,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
xml_url = 'http://www.la7.tv/repliche/content/index.php?contentId=%s' % video_id
|
||||||
|
doc = self._download_xml(xml_url, video_id)
|
||||||
|
|
||||||
|
video_title = doc.find('title').text
|
||||||
|
description = doc.find('description').text
|
||||||
|
duration = parse_duration(doc.find('duration').text)
|
||||||
|
thumbnail = doc.find('img').text
|
||||||
|
view_count = int(doc.find('views').text)
|
||||||
|
|
||||||
|
prefix = doc.find('.//fqdn').text.strip().replace('auto:', 'http:')
|
||||||
|
|
||||||
|
formats = [{
|
||||||
|
'format': vnode.find('quality').text,
|
||||||
|
'tbr': int(vnode.find('quality').text),
|
||||||
|
'url': vnode.find('fms').text.strip().replace('mp4:', prefix),
|
||||||
|
} for vnode in doc.findall('.//videos/video')]
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': video_title,
|
||||||
|
'description': description,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
'duration': duration,
|
||||||
|
'formats': formats,
|
||||||
|
'view_count': view_count,
|
||||||
|
}
|
58
youtube_dl/extractor/malemotion.py
Normal file
58
youtube_dl/extractor/malemotion.py
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
compat_urllib_parse,
|
||||||
|
)
|
||||||
|
|
||||||
|
class MalemotionIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'^(?:https?://)?malemotion\.com/video/(.+?)\.(?P<id>.+?)(#|$)'
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://malemotion.com/video/bien-dur.10ew',
|
||||||
|
'file': '10ew.mp4',
|
||||||
|
'md5': 'b3cc49f953b107e4a363cdff07d100ce',
|
||||||
|
'info_dict': {
|
||||||
|
"title": "Bien dur",
|
||||||
|
"age_limit": 18,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group("id")
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
|
self.report_extraction(video_id)
|
||||||
|
|
||||||
|
# Extract video URL
|
||||||
|
video_url = compat_urllib_parse.unquote(
|
||||||
|
self._search_regex(r'<source type="video/mp4" src="(.+?)"', webpage, 'video URL'))
|
||||||
|
|
||||||
|
# Extract title
|
||||||
|
video_title = self._html_search_regex(
|
||||||
|
r'<title>(.*?)</title', webpage, 'title')
|
||||||
|
|
||||||
|
# Extract video thumbnail
|
||||||
|
video_thumbnail = self._search_regex(
|
||||||
|
r'<video .+?poster="(.+?)"', webpage, 'thumbnail', fatal=False)
|
||||||
|
|
||||||
|
formats = [{
|
||||||
|
'url': video_url,
|
||||||
|
'ext': 'mp4',
|
||||||
|
'format_id': 'mp4',
|
||||||
|
'preference': 1,
|
||||||
|
}]
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'formats': formats,
|
||||||
|
'uploader': None,
|
||||||
|
'upload_date': None,
|
||||||
|
'title': video_title,
|
||||||
|
'thumbnail': video_thumbnail,
|
||||||
|
'description': None,
|
||||||
|
'age_limit': 18,
|
||||||
|
}
|
@@ -4,7 +4,7 @@ import re
|
|||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
fix_xml_all_ampersand,
|
fix_xml_ampersands,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ class MetacriticIE(InfoExtractor):
|
|||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
# The xml is not well formatted, there are raw '&'
|
# The xml is not well formatted, there are raw '&'
|
||||||
info = self._download_xml('http://www.metacritic.com/video_data?video=' + video_id,
|
info = self._download_xml('http://www.metacritic.com/video_data?video=' + video_id,
|
||||||
video_id, 'Downloading info xml', transform_source=fix_xml_all_ampersand)
|
video_id, 'Downloading info xml', transform_source=fix_xml_ampersands)
|
||||||
|
|
||||||
clip = next(c for c in info.findall('playList/clip') if c.find('id').text == video_id)
|
clip = next(c for c in info.findall('playList/clip') if c.find('id').text == video_id)
|
||||||
formats = []
|
formats = []
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
import json
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
@@ -10,17 +11,17 @@ from ..utils import (
|
|||||||
|
|
||||||
class MixcloudIE(InfoExtractor):
|
class MixcloudIE(InfoExtractor):
|
||||||
_VALID_URL = r'^(?:https?://)?(?:www\.)?mixcloud\.com/([\w\d-]+)/([\w\d-]+)'
|
_VALID_URL = r'^(?:https?://)?(?:www\.)?mixcloud\.com/([\w\d-]+)/([\w\d-]+)'
|
||||||
IE_NAME = u'mixcloud'
|
IE_NAME = 'mixcloud'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.mixcloud.com/dholbach/cryptkeeper/',
|
'url': 'http://www.mixcloud.com/dholbach/cryptkeeper/',
|
||||||
u'file': u'dholbach-cryptkeeper.mp3',
|
'file': 'dholbach-cryptkeeper.mp3',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'Cryptkeeper',
|
'title': 'Cryptkeeper',
|
||||||
u'description': u'After quite a long silence from myself, finally another Drum\'n\'Bass mix with my favourite current dance floor bangers.',
|
'description': 'After quite a long silence from myself, finally another Drum\'n\'Bass mix with my favourite current dance floor bangers.',
|
||||||
u'uploader': u'Daniel Holbach',
|
'uploader': 'Daniel Holbach',
|
||||||
u'uploader_id': u'dholbach',
|
'uploader_id': 'dholbach',
|
||||||
u'upload_date': u'20111115',
|
'upload_date': '20111115',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,17 +43,18 @@ class MixcloudIE(InfoExtractor):
|
|||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
|
||||||
uploader = mobj.group(1)
|
uploader = mobj.group(1)
|
||||||
cloudcast_name = mobj.group(2)
|
cloudcast_name = mobj.group(2)
|
||||||
track_id = '-'.join((uploader, cloudcast_name))
|
track_id = '-'.join((uploader, cloudcast_name))
|
||||||
api_url = 'http://api.mixcloud.com/%s/%s/' % (uploader, cloudcast_name)
|
|
||||||
webpage = self._download_webpage(url, track_id)
|
|
||||||
json_data = self._download_webpage(api_url, track_id,
|
|
||||||
u'Downloading cloudcast info')
|
|
||||||
info = json.loads(json_data)
|
|
||||||
|
|
||||||
preview_url = self._search_regex(r'data-preview-url="(.+?)"', webpage, u'preview url')
|
webpage = self._download_webpage(url, track_id)
|
||||||
|
|
||||||
|
api_url = 'http://api.mixcloud.com/%s/%s/' % (uploader, cloudcast_name)
|
||||||
|
info = self._download_json(
|
||||||
|
api_url, track_id, 'Downloading cloudcast info')
|
||||||
|
|
||||||
|
preview_url = self._search_regex(
|
||||||
|
r'\s(?:data-preview-url|m-preview)="(.+?)"', webpage, 'preview url')
|
||||||
song_url = preview_url.replace('/previews/', '/c/originals/')
|
song_url = preview_url.replace('/previews/', '/c/originals/')
|
||||||
template_url = re.sub(r'(stream\d*)', 'stream%d', song_url)
|
template_url = re.sub(r'(stream\d*)', 'stream%d', song_url)
|
||||||
final_song_url = self._get_url(template_url)
|
final_song_url = self._get_url(template_url)
|
||||||
|
@@ -34,7 +34,7 @@ class MporaIE(InfoExtractor):
|
|||||||
|
|
||||||
data = json.loads(data_json)
|
data = json.loads(data_json)
|
||||||
|
|
||||||
uploader = data['info_overlay']['name']
|
uploader = data['info_overlay'].get('username')
|
||||||
duration = data['video']['duration'] // 1000
|
duration = data['video']['duration'] // 1000
|
||||||
thumbnail = data['video']['encodings']['sd']['poster']
|
thumbnail = data['video']['encodings']['sd']['poster']
|
||||||
title = data['info_overlay']['title']
|
title = data['info_overlay']['title']
|
||||||
|
@@ -1,12 +1,18 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import xml.etree.ElementTree
|
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
compat_urllib_parse,
|
compat_urllib_parse,
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
|
find_xpath_attr,
|
||||||
|
fix_xml_ampersands,
|
||||||
|
url_basename,
|
||||||
|
RegexNotFoundError,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def _media_xml_tag(tag):
|
def _media_xml_tag(tag):
|
||||||
return '{http://search.yahoo.com/mrss/}%s' % tag
|
return '{http://search.yahoo.com/mrss/}%s' % tag
|
||||||
|
|
||||||
@@ -33,10 +39,9 @@ class MTVServicesInfoExtractor(InfoExtractor):
|
|||||||
else:
|
else:
|
||||||
return thumb_node.attrib['url']
|
return thumb_node.attrib['url']
|
||||||
|
|
||||||
def _extract_video_formats(self, metadataXml):
|
def _extract_video_formats(self, mdoc):
|
||||||
if '/error_country_block.swf' in metadataXml:
|
if re.match(r'.*/error_country_block\.swf$', mdoc.find('.//src').text) is not None:
|
||||||
raise ExtractorError(u'This video is not available from your country.', expected=True)
|
raise ExtractorError('This video is not available from your country.', expected=True)
|
||||||
mdoc = xml.etree.ElementTree.fromstring(metadataXml.encode('utf-8'))
|
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
for rendition in mdoc.findall('.//rendition'):
|
for rendition in mdoc.findall('.//rendition'):
|
||||||
@@ -59,11 +64,12 @@ class MTVServicesInfoExtractor(InfoExtractor):
|
|||||||
self.report_extraction(video_id)
|
self.report_extraction(video_id)
|
||||||
mediagen_url = itemdoc.find('%s/%s' % (_media_xml_tag('group'), _media_xml_tag('content'))).attrib['url']
|
mediagen_url = itemdoc.find('%s/%s' % (_media_xml_tag('group'), _media_xml_tag('content'))).attrib['url']
|
||||||
# Remove the templates, like &device={device}
|
# Remove the templates, like &device={device}
|
||||||
mediagen_url = re.sub(r'&[^=]*?={.*?}(?=(&|$))', u'', mediagen_url)
|
mediagen_url = re.sub(r'&[^=]*?={.*?}(?=(&|$))', '', mediagen_url)
|
||||||
if 'acceptMethods' not in mediagen_url:
|
if 'acceptMethods' not in mediagen_url:
|
||||||
mediagen_url += '&acceptMethods=fms'
|
mediagen_url += '&acceptMethods=fms'
|
||||||
mediagen_page = self._download_webpage(mediagen_url, video_id,
|
|
||||||
u'Downloading video urls')
|
mediagen_doc = self._download_xml(mediagen_url, video_id,
|
||||||
|
'Downloading video urls')
|
||||||
|
|
||||||
description_node = itemdoc.find('description')
|
description_node = itemdoc.find('description')
|
||||||
if description_node is not None:
|
if description_node is not None:
|
||||||
@@ -71,9 +77,23 @@ class MTVServicesInfoExtractor(InfoExtractor):
|
|||||||
else:
|
else:
|
||||||
description = None
|
description = None
|
||||||
|
|
||||||
|
title_el = None
|
||||||
|
if title_el is None:
|
||||||
|
title_el = find_xpath_attr(
|
||||||
|
itemdoc, './/{http://search.yahoo.com/mrss/}category',
|
||||||
|
'scheme', 'urn:mtvn:video_title')
|
||||||
|
if title_el is None:
|
||||||
|
title_el = itemdoc.find('.//{http://search.yahoo.com/mrss/}title')
|
||||||
|
if title_el is None:
|
||||||
|
title_el = itemdoc.find('.//title')
|
||||||
|
title = title_el.text
|
||||||
|
if title is None:
|
||||||
|
raise ExtractorError('Could not find video title')
|
||||||
|
title = title.strip()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'title': itemdoc.find('title').text,
|
'title': title,
|
||||||
'formats': self._extract_video_formats(mediagen_page),
|
'formats': self._extract_video_formats(mediagen_doc),
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'thumbnail': self._get_thumbnail_url(uri, itemdoc),
|
'thumbnail': self._get_thumbnail_url(uri, itemdoc),
|
||||||
'description': description,
|
'description': description,
|
||||||
@@ -83,14 +103,25 @@ class MTVServicesInfoExtractor(InfoExtractor):
|
|||||||
video_id = self._id_from_uri(uri)
|
video_id = self._id_from_uri(uri)
|
||||||
data = compat_urllib_parse.urlencode({'uri': uri})
|
data = compat_urllib_parse.urlencode({'uri': uri})
|
||||||
|
|
||||||
def fix_ampersand(s):
|
|
||||||
""" Fix unencoded ampersand in XML """
|
|
||||||
return s.replace(u'& ', '& ')
|
|
||||||
idoc = self._download_xml(
|
idoc = self._download_xml(
|
||||||
self._FEED_URL + '?' + data, video_id,
|
self._FEED_URL + '?' + data, video_id,
|
||||||
u'Downloading info', transform_source=fix_ampersand)
|
'Downloading info', transform_source=fix_xml_ampersands)
|
||||||
return [self._get_video_info(item) for item in idoc.findall('.//item')]
|
return [self._get_video_info(item) for item in idoc.findall('.//item')]
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
title = url_basename(url)
|
||||||
|
webpage = self._download_webpage(url, title)
|
||||||
|
try:
|
||||||
|
# the url can be http://media.mtvnservices.com/fb/{mgid}.swf
|
||||||
|
# or http://media.mtvnservices.com/{mgid}
|
||||||
|
og_url = self._og_search_video_url(webpage)
|
||||||
|
mgid = url_basename(og_url)
|
||||||
|
if mgid.endswith('.swf'):
|
||||||
|
mgid = mgid[:-4]
|
||||||
|
except RegexNotFoundError:
|
||||||
|
mgid = self._search_regex(r'data-mgid="(.*?)"', webpage, u'mgid')
|
||||||
|
return self._get_videos_info(mgid)
|
||||||
|
|
||||||
|
|
||||||
class MTVIE(MTVServicesInfoExtractor):
|
class MTVIE(MTVServicesInfoExtractor):
|
||||||
_VALID_URL = r'''(?x)^https?://
|
_VALID_URL = r'''(?x)^https?://
|
||||||
@@ -101,25 +132,25 @@ class MTVIE(MTVServicesInfoExtractor):
|
|||||||
|
|
||||||
_TESTS = [
|
_TESTS = [
|
||||||
{
|
{
|
||||||
u'url': u'http://www.mtv.com/videos/misc/853555/ours-vh1-storytellers.jhtml',
|
'url': 'http://www.mtv.com/videos/misc/853555/ours-vh1-storytellers.jhtml',
|
||||||
u'file': u'853555.mp4',
|
'file': '853555.mp4',
|
||||||
u'md5': u'850f3f143316b1e71fa56a4edfd6e0f8',
|
'md5': '850f3f143316b1e71fa56a4edfd6e0f8',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'Taylor Swift - "Ours (VH1 Storytellers)"',
|
'title': 'Taylor Swift - "Ours (VH1 Storytellers)"',
|
||||||
u'description': u'Album: Taylor Swift performs "Ours" for VH1 Storytellers at Harvey Mudd College.',
|
'description': 'Album: Taylor Swift performs "Ours" for VH1 Storytellers at Harvey Mudd College.',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
u'add_ie': ['Vevo'],
|
'add_ie': ['Vevo'],
|
||||||
u'url': u'http://www.mtv.com/videos/taylor-swift/916187/everything-has-changed-ft-ed-sheeran.jhtml',
|
'url': 'http://www.mtv.com/videos/taylor-swift/916187/everything-has-changed-ft-ed-sheeran.jhtml',
|
||||||
u'file': u'USCJY1331283.mp4',
|
'file': 'USCJY1331283.mp4',
|
||||||
u'md5': u'73b4e7fcadd88929292fe52c3ced8caf',
|
'md5': '73b4e7fcadd88929292fe52c3ced8caf',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'Everything Has Changed',
|
'title': 'Everything Has Changed',
|
||||||
u'upload_date': u'20130606',
|
'upload_date': '20130606',
|
||||||
u'uploader': u'Taylor Swift',
|
'uploader': 'Taylor Swift',
|
||||||
},
|
},
|
||||||
u'skip': u'VEVO is only available in some countries',
|
'skip': 'VEVO is only available in some countries',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -138,8 +169,22 @@ class MTVIE(MTVServicesInfoExtractor):
|
|||||||
webpage, re.DOTALL)
|
webpage, re.DOTALL)
|
||||||
if m_vevo:
|
if m_vevo:
|
||||||
vevo_id = m_vevo.group(1);
|
vevo_id = m_vevo.group(1);
|
||||||
self.to_screen(u'Vevo video detected: %s' % vevo_id)
|
self.to_screen('Vevo video detected: %s' % vevo_id)
|
||||||
return self.url_result('vevo:%s' % vevo_id, ie='Vevo')
|
return self.url_result('vevo:%s' % vevo_id, ie='Vevo')
|
||||||
|
|
||||||
uri = self._html_search_regex(r'/uri/(.*?)\?', webpage, u'uri')
|
uri = self._html_search_regex(r'/uri/(.*?)\?', webpage, 'uri')
|
||||||
return self._get_videos_info(uri)
|
return self._get_videos_info(uri)
|
||||||
|
|
||||||
|
|
||||||
|
class MTVIggyIE(MTVServicesInfoExtractor):
|
||||||
|
IE_NAME = 'mtviggy.com'
|
||||||
|
_VALID_URL = r'https?://www\.mtviggy\.com/videos/.+'
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://www.mtviggy.com/videos/arcade-fire-behind-the-scenes-at-the-biggest-music-experiment-yet/',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '984696',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Arcade Fire: Behind the Scenes at the Biggest Music Experiment Yet',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_FEED_URL = 'http://all.mtvworldverticals.com/feed-xml/'
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import json
|
import json
|
||||||
|
|
||||||
@@ -8,41 +10,75 @@ from ..utils import (
|
|||||||
|
|
||||||
|
|
||||||
class MySpaceIE(InfoExtractor):
|
class MySpaceIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://myspace\.com/([^/]+)/video/[^/]+/(?P<id>\d+)'
|
_VALID_URL = r'https?://myspace\.com/([^/]+)/(?P<mediatype>video/[^/]+/|music/song/.*?)(?P<id>\d+)'
|
||||||
|
|
||||||
_TEST = {
|
_TESTS = [
|
||||||
u'url': u'https://myspace.com/coldplay/video/viva-la-vida/100008689',
|
{
|
||||||
u'info_dict': {
|
'url': 'https://myspace.com/coldplay/video/viva-la-vida/100008689',
|
||||||
u'id': u'100008689',
|
'info_dict': {
|
||||||
u'ext': u'flv',
|
'id': '100008689',
|
||||||
u'title': u'Viva La Vida',
|
'ext': 'flv',
|
||||||
u'description': u'The official Viva La Vida video, directed by Hype Williams',
|
'title': 'Viva La Vida',
|
||||||
u'uploader': u'Coldplay',
|
'description': 'The official Viva La Vida video, directed by Hype Williams',
|
||||||
u'uploader_id': u'coldplay',
|
'uploader': 'Coldplay',
|
||||||
|
'uploader_id': 'coldplay',
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
# rtmp download
|
||||||
|
'skip_download': True,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
u'params': {
|
# song
|
||||||
# rtmp download
|
{
|
||||||
u'skip_download': True,
|
'url': 'https://myspace.com/spiderbags/music/song/darkness-in-my-heart-39008454-27041242',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '39008454',
|
||||||
|
'ext': 'flv',
|
||||||
|
'title': 'Darkness In My Heart',
|
||||||
|
'uploader_id': 'spiderbags',
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
# rtmp download
|
||||||
|
'skip_download': True,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
video_id = mobj.group('id')
|
video_id = mobj.group('id')
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
context = json.loads(self._search_regex(r'context = ({.*?});', webpage,
|
|
||||||
u'context'))
|
|
||||||
video = context['video']
|
|
||||||
rtmp_url, play_path = video['streamUrl'].split(';', 1)
|
|
||||||
|
|
||||||
return {
|
if mobj.group('mediatype').startswith('music/song'):
|
||||||
'id': compat_str(video['mediaId']),
|
# songs don't store any useful info in the 'context' variable
|
||||||
'title': video['title'],
|
def search_data(name):
|
||||||
|
return self._search_regex(r'data-%s="(.*?)"' % name, webpage,
|
||||||
|
name)
|
||||||
|
streamUrl = search_data('stream-url')
|
||||||
|
info = {
|
||||||
|
'id': video_id,
|
||||||
|
'title': self._og_search_title(webpage),
|
||||||
|
'uploader_id': search_data('artist-username'),
|
||||||
|
'thumbnail': self._og_search_thumbnail(webpage),
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
context = json.loads(self._search_regex(r'context = ({.*?});', webpage,
|
||||||
|
u'context'))
|
||||||
|
video = context['video']
|
||||||
|
streamUrl = video['streamUrl']
|
||||||
|
info = {
|
||||||
|
'id': compat_str(video['mediaId']),
|
||||||
|
'title': video['title'],
|
||||||
|
'description': video['description'],
|
||||||
|
'thumbnail': video['imageUrl'],
|
||||||
|
'uploader': video['artistName'],
|
||||||
|
'uploader_id': video['artistUsername'],
|
||||||
|
}
|
||||||
|
|
||||||
|
rtmp_url, play_path = streamUrl.split(';', 1)
|
||||||
|
info.update({
|
||||||
'url': rtmp_url,
|
'url': rtmp_url,
|
||||||
'play_path': play_path,
|
'play_path': play_path,
|
||||||
'ext': 'flv',
|
'ext': 'flv',
|
||||||
'description': video['description'],
|
})
|
||||||
'thumbnail': video['imageUrl'],
|
return info
|
||||||
'uploader': video['artistName'],
|
|
||||||
'uploader_id': video['artistUsername'],
|
|
||||||
}
|
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
|
|
||||||
@@ -8,12 +10,12 @@ from ..utils import determine_ext
|
|||||||
class NewgroundsIE(InfoExtractor):
|
class NewgroundsIE(InfoExtractor):
|
||||||
_VALID_URL = r'(?:https?://)?(?:www\.)?newgrounds\.com/audio/listen/(?P<id>\d+)'
|
_VALID_URL = r'(?:https?://)?(?:www\.)?newgrounds\.com/audio/listen/(?P<id>\d+)'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.newgrounds.com/audio/listen/549479',
|
'url': 'http://www.newgrounds.com/audio/listen/549479',
|
||||||
u'file': u'549479.mp3',
|
'file': '549479.mp3',
|
||||||
u'md5': u'fe6033d297591288fa1c1f780386f07a',
|
'md5': 'fe6033d297591288fa1c1f780386f07a',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"title": u"B7 - BusMode",
|
"title": "B7 - BusMode",
|
||||||
u"uploader": u"Burn7",
|
"uploader": "Burn7",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,17 +24,19 @@ class NewgroundsIE(InfoExtractor):
|
|||||||
music_id = mobj.group('id')
|
music_id = mobj.group('id')
|
||||||
webpage = self._download_webpage(url, music_id)
|
webpage = self._download_webpage(url, music_id)
|
||||||
|
|
||||||
title = self._html_search_regex(r',"name":"([^"]+)",', webpage, u'music title')
|
title = self._html_search_regex(
|
||||||
uploader = self._html_search_regex(r',"artist":"([^"]+)",', webpage, u'music uploader')
|
r',"name":"([^"]+)",', webpage, 'music title')
|
||||||
|
uploader = self._html_search_regex(
|
||||||
|
r',"artist":"([^"]+)",', webpage, 'music uploader')
|
||||||
|
|
||||||
music_url_json_string = self._html_search_regex(r'({"url":"[^"]+"),', webpage, u'music url') + '}'
|
music_url_json_string = self._html_search_regex(
|
||||||
|
r'({"url":"[^"]+"),', webpage, 'music url') + '}'
|
||||||
music_url_json = json.loads(music_url_json_string)
|
music_url_json = json.loads(music_url_json_string)
|
||||||
music_url = music_url_json['url']
|
music_url = music_url_json['url']
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': music_id,
|
'id': music_id,
|
||||||
'title': title,
|
'title': title,
|
||||||
'url': music_url,
|
'url': music_url,
|
||||||
'uploader': uploader,
|
'uploader': uploader,
|
||||||
'ext': determine_ext(music_url),
|
|
||||||
}
|
}
|
||||||
|
@@ -19,7 +19,8 @@ class NovamovIE(InfoExtractor):
|
|||||||
'info_dict': {
|
'info_dict': {
|
||||||
'title': 'search engine optimization',
|
'title': 'search engine optimization',
|
||||||
'description': 'search engine optimization is used to rank the web page in the google search engine'
|
'description': 'search engine optimization is used to rank the web page in the google search engine'
|
||||||
}
|
},
|
||||||
|
'skip': '"Invalid token" errors abound (in web interface as well as youtube-dl, there is nothing we can do about it.)'
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
|
49
youtube_dl/extractor/nowness.py
Normal file
49
youtube_dl/extractor/nowness.py
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .brightcove import BrightcoveIE
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
ExtractorError,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class NownessIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?nowness\.com/[^?#]*?/(?P<id>[0-9]+)/(?P<slug>[^/]+?)(?:$|[?#])'
|
||||||
|
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://www.nowness.com/day/2013/6/27/3131/candor--the-art-of-gesticulation',
|
||||||
|
'file': '2520295746001.mp4',
|
||||||
|
'md5': '0ece2f70a7bd252c7b00f3070182d418',
|
||||||
|
'info_dict': {
|
||||||
|
'description': 'Candor: The Art of Gesticulation',
|
||||||
|
'uploader': 'Nowness',
|
||||||
|
'title': 'Candor: The Art of Gesticulation',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('slug')
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
player_url = self._search_regex(
|
||||||
|
r'"([^"]+/content/issue-[0-9.]+.js)"', webpage, 'player URL')
|
||||||
|
real_id = self._search_regex(
|
||||||
|
r'\sdata-videoId="([0-9]+)"', webpage, 'internal video ID')
|
||||||
|
|
||||||
|
player_code = self._download_webpage(
|
||||||
|
player_url, video_id,
|
||||||
|
note='Downloading player JavaScript',
|
||||||
|
errnote='Player download failed')
|
||||||
|
player_code = player_code.replace("'+d+'", real_id)
|
||||||
|
|
||||||
|
bc_url = BrightcoveIE._extract_brightcove_url(player_code)
|
||||||
|
if bc_url is None:
|
||||||
|
raise ExtractorError('Could not find player definition')
|
||||||
|
return {
|
||||||
|
'_type': 'url',
|
||||||
|
'url': bc_url,
|
||||||
|
'ie_key': 'Brightcove',
|
||||||
|
}
|
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
@@ -6,14 +8,14 @@ from .common import InfoExtractor
|
|||||||
class RedTubeIE(InfoExtractor):
|
class RedTubeIE(InfoExtractor):
|
||||||
_VALID_URL = r'http://(?:www\.)?redtube\.com/(?P<id>[0-9]+)'
|
_VALID_URL = r'http://(?:www\.)?redtube\.com/(?P<id>[0-9]+)'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.redtube.com/66418',
|
'url': 'http://www.redtube.com/66418',
|
||||||
u'file': u'66418.mp4',
|
'file': '66418.mp4',
|
||||||
# md5 varies from time to time, as in
|
# md5 varies from time to time, as in
|
||||||
# https://travis-ci.org/rg3/youtube-dl/jobs/14052463#L295
|
# https://travis-ci.org/rg3/youtube-dl/jobs/14052463#L295
|
||||||
#u'md5': u'7b8c22b5e7098a3e1c09709df1126d2d',
|
#'md5': u'7b8c22b5e7098a3e1c09709df1126d2d',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"title": u"Sucked on a toilet",
|
"title": "Sucked on a toilet",
|
||||||
u"age_limit": 18,
|
"age_limit": 18,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,14 +35,19 @@ class RedTubeIE(InfoExtractor):
|
|||||||
r'<h1 class="videoTitle[^"]*">(.+?)</h1>',
|
r'<h1 class="videoTitle[^"]*">(.+?)</h1>',
|
||||||
webpage, u'title')
|
webpage, u'title')
|
||||||
|
|
||||||
|
video_thumbnail = self._html_search_regex(
|
||||||
|
r'playerInnerHTML.+?<img\s+src="(.+?)"',
|
||||||
|
webpage, u'thumbnail', fatal=False)
|
||||||
|
|
||||||
# No self-labeling, but they describe themselves as
|
# No self-labeling, but they describe themselves as
|
||||||
# "Home of Videos Porno"
|
# "Home of Videos Porno"
|
||||||
age_limit = 18
|
age_limit = 18
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
'ext': video_extension,
|
'ext': video_extension,
|
||||||
'title': video_title,
|
'title': video_title,
|
||||||
|
'thumbnail': video_thumbnail,
|
||||||
'age_limit': age_limit,
|
'age_limit': age_limit,
|
||||||
}
|
}
|
||||||
|
@@ -1,37 +1,44 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
class RingTVIE(InfoExtractor):
|
class RingTVIE(InfoExtractor):
|
||||||
_VALID_URL = r'(?:http://)?(?:www\.)?ringtv\.craveonline\.com/videos/video/([^/]+)'
|
_VALID_URL = r'(?:http://)?(?:www\.)?ringtv\.craveonline\.com/(?P<type>news|videos/video)/(?P<id>[^/?#]+)'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u"url": u"http://ringtv.craveonline.com/videos/video/746619-canelo-alvarez-talks-about-mayweather-showdown",
|
"url": "http://ringtv.craveonline.com/news/310833-luis-collazo-says-victor-ortiz-better-not-quit-on-jan-30",
|
||||||
u"file": u"746619.mp4",
|
"file": "857645.mp4",
|
||||||
u"md5": u"7c46b4057d22de32e0a539f017e64ad3",
|
"md5": "d25945f5df41cdca2d2587165ac28720",
|
||||||
u"info_dict": {
|
"info_dict": {
|
||||||
u"title": u"Canelo Alvarez talks about Mayweather showdown",
|
"title": 'Video: Luis Collazo says Victor Ortiz "better not quit on Jan. 30" - Ring TV',
|
||||||
u"description": u"Saul \\\"Canelo\\\" Alvarez spoke to the media about his Sept. 14 showdown with Floyd Mayweather after their kick-off presser in NYC. Canelo is motivated and confident that he will have the speed and gameplan to beat the pound-for-pound king."
|
"description": 'Luis Collazo is excited about his Jan. 30 showdown with fellow former welterweight titleholder Victor Ortiz at Barclays Center in his hometown of Brooklyn. The SuperBowl week fight headlines a Golden Boy Live! card on Fox Sports 1.',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
video_id = mobj.group(1).split('-')[0]
|
video_id = mobj.group('id').split('-')[0]
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
title = self._search_regex(r'<title>(.+?)</title>',
|
|
||||||
webpage, 'video title').replace(' | RingTV','')
|
if mobj.group('type') == 'news':
|
||||||
description = self._search_regex(r'<div class="blurb">(.+?)</div>',
|
video_id = self._search_regex(
|
||||||
webpage, 'Description')
|
r'''(?x)<iframe[^>]+src="http://cms\.springboardplatform\.com/
|
||||||
final_url = "http://ringtv.craveonline.springboardplatform.com/storage/ringtv.craveonline.com/conversion/%s.mp4" %(str(video_id))
|
embed_iframe/[0-9]+/video/([0-9]+)/''',
|
||||||
thumbnail_url = "http://ringtv.craveonline.springboardplatform.com/storage/ringtv.craveonline.com/snapshots/%s.jpg" %(str(video_id))
|
webpage, 'real video ID')
|
||||||
ext = final_url.split('.')[-1]
|
title = self._og_search_title(webpage)
|
||||||
return [{
|
description = self._html_search_regex(
|
||||||
'id' : video_id,
|
r'addthis:description="([^"]+)"',
|
||||||
'url' : final_url,
|
webpage, 'description', fatal=False)
|
||||||
'ext' : ext,
|
final_url = "http://ringtv.craveonline.springboardplatform.com/storage/ringtv.craveonline.com/conversion/%s.mp4" % video_id
|
||||||
'title' : title,
|
thumbnail_url = "http://ringtv.craveonline.springboardplatform.com/storage/ringtv.craveonline.com/snapshots/%s.jpg" % video_id
|
||||||
'thumbnail' : thumbnail_url,
|
|
||||||
'description' : description,
|
return {
|
||||||
}]
|
'id': video_id,
|
||||||
|
'url': final_url,
|
||||||
|
'title': title,
|
||||||
|
'thumbnail': thumbnail_url,
|
||||||
|
'description': description,
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from .videodetective import VideoDetectiveIE
|
from .videodetective import VideoDetectiveIE
|
||||||
|
|
||||||
|
|
||||||
@@ -7,10 +9,10 @@ class RottenTomatoesIE(VideoDetectiveIE):
|
|||||||
_VALID_URL = r'https?://www\.rottentomatoes\.com/m/[^/]+/trailers/(?P<id>\d+)'
|
_VALID_URL = r'https?://www\.rottentomatoes\.com/m/[^/]+/trailers/(?P<id>\d+)'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.rottentomatoes.com/m/toy_story_3/trailers/11028566/',
|
'url': 'http://www.rottentomatoes.com/m/toy_story_3/trailers/11028566/',
|
||||||
u'file': '613340.mp4',
|
'file': '613340.mp4',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'TOY STORY 3',
|
'title': 'TOY STORY 3',
|
||||||
u'description': u'From the creators of the beloved TOY STORY films, comes a story that will reunite the gang in a whole new way.',
|
'description': 'From the creators of the beloved TOY STORY films, comes a story that will reunite the gang in a whole new way.',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,7 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
@@ -12,78 +15,77 @@ class RTLnowIE(InfoExtractor):
|
|||||||
"""Information Extractor for RTL NOW, RTL2 NOW, RTL NITRO, SUPER RTL NOW, VOX NOW and n-tv NOW"""
|
"""Information Extractor for RTL NOW, RTL2 NOW, RTL NITRO, SUPER RTL NOW, VOX NOW and n-tv NOW"""
|
||||||
_VALID_URL = r'(?:http://)?(?P<url>(?P<domain>rtl-now\.rtl\.de|rtl2now\.rtl2\.de|(?:www\.)?voxnow\.de|(?:www\.)?rtlnitronow\.de|(?:www\.)?superrtlnow\.de|(?:www\.)?n-tvnow\.de)/+[a-zA-Z0-9-]+/[a-zA-Z0-9-]+\.php\?(?:container_id|film_id)=(?P<video_id>[0-9]+)&player=1(?:&season=[0-9]+)?(?:&.*)?)'
|
_VALID_URL = r'(?:http://)?(?P<url>(?P<domain>rtl-now\.rtl\.de|rtl2now\.rtl2\.de|(?:www\.)?voxnow\.de|(?:www\.)?rtlnitronow\.de|(?:www\.)?superrtlnow\.de|(?:www\.)?n-tvnow\.de)/+[a-zA-Z0-9-]+/[a-zA-Z0-9-]+\.php\?(?:container_id|film_id)=(?P<video_id>[0-9]+)&player=1(?:&season=[0-9]+)?(?:&.*)?)'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
u'url': u'http://rtl-now.rtl.de/ahornallee/folge-1.php?film_id=90419&player=1&season=1',
|
'url': 'http://rtl-now.rtl.de/ahornallee/folge-1.php?film_id=90419&player=1&season=1',
|
||||||
u'file': u'90419.flv',
|
'file': '90419.flv',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'upload_date': u'20070416',
|
'upload_date': '20070416',
|
||||||
u'title': u'Ahornallee - Folge 1 - Der Einzug',
|
'title': 'Ahornallee - Folge 1 - Der Einzug',
|
||||||
u'description': u'Folge 1 - Der Einzug',
|
'description': 'Folge 1 - Der Einzug',
|
||||||
},
|
},
|
||||||
u'params': {
|
'params': {
|
||||||
u'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
u'skip': u'Only works from Germany',
|
'skip': 'Only works from Germany',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
u'url': u'http://rtl2now.rtl2.de/aerger-im-revier/episode-15-teil-1.php?film_id=69756&player=1&season=2&index=5',
|
'url': 'http://rtl2now.rtl2.de/aerger-im-revier/episode-15-teil-1.php?film_id=69756&player=1&season=2&index=5',
|
||||||
u'file': u'69756.flv',
|
'file': '69756.flv',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'upload_date': u'20120519',
|
'upload_date': '20120519',
|
||||||
u'title': u'Ärger im Revier - Ein junger Ladendieb, ein handfester Streit...',
|
'title': 'Ärger im Revier - Ein junger Ladendieb, ein handfester Streit...',
|
||||||
u'description': u'Ärger im Revier - Ein junger Ladendieb, ein handfester Streit u.a.',
|
'description': 'Ärger im Revier - Ein junger Ladendieb, ein handfester Streit u.a.',
|
||||||
u'thumbnail': u'http://autoimg.static-fra.de/rtl2now/219850/1500x1500/image2.jpg',
|
'thumbnail': 'http://autoimg.static-fra.de/rtl2now/219850/1500x1500/image2.jpg',
|
||||||
},
|
},
|
||||||
u'params': {
|
'params': {
|
||||||
u'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
u'skip': u'Only works from Germany',
|
'skip': 'Only works from Germany',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
u'url': u'http://www.voxnow.de/voxtours/suedafrika-reporter-ii.php?film_id=13883&player=1&season=17',
|
'url': 'http://www.voxnow.de/voxtours/suedafrika-reporter-ii.php?film_id=13883&player=1&season=17',
|
||||||
u'file': u'13883.flv',
|
'file': '13883.flv',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'upload_date': u'20090627',
|
'upload_date': '20090627',
|
||||||
u'title': u'Voxtours - Südafrika-Reporter II',
|
'title': 'Voxtours - Südafrika-Reporter II',
|
||||||
u'description': u'Südafrika-Reporter II',
|
'description': 'Südafrika-Reporter II',
|
||||||
},
|
},
|
||||||
u'params': {
|
'params': {
|
||||||
u'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
u'url': u'http://superrtlnow.de/medicopter-117/angst.php?film_id=99205&player=1',
|
'url': 'http://superrtlnow.de/medicopter-117/angst.php?film_id=99205&player=1',
|
||||||
u'file': u'99205.flv',
|
'file': '99205.flv',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'upload_date': u'20080928',
|
'upload_date': '20080928',
|
||||||
u'title': u'Medicopter 117 - Angst!',
|
'title': 'Medicopter 117 - Angst!',
|
||||||
u'description': u'Angst!',
|
'description': 'Angst!',
|
||||||
u'thumbnail': u'http://autoimg.static-fra.de/superrtlnow/287529/1500x1500/image2.jpg'
|
'thumbnail': 'http://autoimg.static-fra.de/superrtlnow/287529/1500x1500/image2.jpg'
|
||||||
},
|
},
|
||||||
u'params': {
|
'params': {
|
||||||
u'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
u'url': u'http://www.n-tvnow.de/top-gear/episode-1-2013-01-01-00-00-00.php?film_id=124903&player=1&season=10',
|
'url': 'http://www.n-tvnow.de/top-gear/episode-1-2013-01-01-00-00-00.php?film_id=124903&player=1&season=10',
|
||||||
u'file': u'124903.flv',
|
'file': '124903.flv',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'upload_date': u'20130101',
|
'upload_date': '20130101',
|
||||||
u'title': u'Top Gear vom 01.01.2013',
|
'title': 'Top Gear vom 01.01.2013',
|
||||||
u'description': u'Episode 1',
|
'description': 'Episode 1',
|
||||||
},
|
},
|
||||||
u'params': {
|
'params': {
|
||||||
u'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
u'skip': u'Only works from Germany',
|
'skip': 'Only works from Germany',
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
def _real_extract(self,url):
|
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
|
||||||
webpage_url = u'http://' + mobj.group('url')
|
webpage_url = 'http://' + mobj.group('url')
|
||||||
video_page_url = u'http://' + mobj.group('domain') + u'/'
|
video_page_url = 'http://' + mobj.group('domain') + '/'
|
||||||
video_id = mobj.group(u'video_id')
|
video_id = mobj.group('video_id')
|
||||||
|
|
||||||
webpage = self._download_webpage(webpage_url, video_id)
|
webpage = self._download_webpage(webpage_url, video_id)
|
||||||
|
|
||||||
@@ -94,51 +96,53 @@ class RTLnowIE(InfoExtractor):
|
|||||||
msg = clean_html(note_m.group(1))
|
msg = clean_html(note_m.group(1))
|
||||||
raise ExtractorError(msg)
|
raise ExtractorError(msg)
|
||||||
|
|
||||||
video_title = self._html_search_regex(r'<title>(?P<title>[^<]+?)( \| [^<]*)?</title>',
|
video_title = self._html_search_regex(
|
||||||
webpage, u'title')
|
r'<title>(?P<title>[^<]+?)( \| [^<]*)?</title>',
|
||||||
playerdata_url = self._html_search_regex(r'\'playerdata\': \'(?P<playerdata_url>[^\']+)\'',
|
webpage, 'title')
|
||||||
webpage, u'playerdata_url')
|
playerdata_url = self._html_search_regex(
|
||||||
|
r'\'playerdata\': \'(?P<playerdata_url>[^\']+)\'',
|
||||||
|
webpage, 'playerdata_url')
|
||||||
|
|
||||||
playerdata = self._download_webpage(playerdata_url, video_id)
|
playerdata = self._download_webpage(playerdata_url, video_id)
|
||||||
mobj = re.search(r'<title><!\[CDATA\[(?P<description>.+?)(?:\s+- (?:Sendung )?vom (?P<upload_date_d>[0-9]{2})\.(?P<upload_date_m>[0-9]{2})\.(?:(?P<upload_date_Y>[0-9]{4})|(?P<upload_date_y>[0-9]{2})) [0-9]{2}:[0-9]{2} Uhr)?\]\]></title>', playerdata)
|
mobj = re.search(r'<title><!\[CDATA\[(?P<description>.+?)(?:\s+- (?:Sendung )?vom (?P<upload_date_d>[0-9]{2})\.(?P<upload_date_m>[0-9]{2})\.(?:(?P<upload_date_Y>[0-9]{4})|(?P<upload_date_y>[0-9]{2})) [0-9]{2}:[0-9]{2} Uhr)?\]\]></title>', playerdata)
|
||||||
if mobj:
|
if mobj:
|
||||||
video_description = mobj.group(u'description')
|
video_description = mobj.group('description')
|
||||||
if mobj.group('upload_date_Y'):
|
if mobj.group('upload_date_Y'):
|
||||||
video_upload_date = mobj.group('upload_date_Y')
|
video_upload_date = mobj.group('upload_date_Y')
|
||||||
elif mobj.group('upload_date_y'):
|
elif mobj.group('upload_date_y'):
|
||||||
video_upload_date = u'20' + mobj.group('upload_date_y')
|
video_upload_date = '20' + mobj.group('upload_date_y')
|
||||||
else:
|
else:
|
||||||
video_upload_date = None
|
video_upload_date = None
|
||||||
if video_upload_date:
|
if video_upload_date:
|
||||||
video_upload_date += mobj.group('upload_date_m')+mobj.group('upload_date_d')
|
video_upload_date += mobj.group('upload_date_m') + mobj.group('upload_date_d')
|
||||||
else:
|
else:
|
||||||
video_description = None
|
video_description = None
|
||||||
video_upload_date = None
|
video_upload_date = None
|
||||||
self._downloader.report_warning(u'Unable to extract description and upload date')
|
self._downloader.report_warning('Unable to extract description and upload date')
|
||||||
|
|
||||||
# Thumbnail: not every video has an thumbnail
|
# Thumbnail: not every video has an thumbnail
|
||||||
mobj = re.search(r'<meta property="og:image" content="(?P<thumbnail>[^"]+)">', webpage)
|
mobj = re.search(r'<meta property="og:image" content="(?P<thumbnail>[^"]+)">', webpage)
|
||||||
if mobj:
|
if mobj:
|
||||||
video_thumbnail = mobj.group(u'thumbnail')
|
video_thumbnail = mobj.group('thumbnail')
|
||||||
else:
|
else:
|
||||||
video_thumbnail = None
|
video_thumbnail = None
|
||||||
|
|
||||||
mobj = re.search(r'<filename [^>]+><!\[CDATA\[(?P<url>rtmpe://(?:[^/]+/){2})(?P<play_path>[^\]]+)\]\]></filename>', playerdata)
|
mobj = re.search(r'<filename [^>]+><!\[CDATA\[(?P<url>rtmpe://(?:[^/]+/){2})(?P<play_path>[^\]]+)\]\]></filename>', playerdata)
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
raise ExtractorError(u'Unable to extract media URL')
|
raise ExtractorError('Unable to extract media URL')
|
||||||
video_url = mobj.group(u'url')
|
video_url = mobj.group('url')
|
||||||
video_play_path = u'mp4:' + mobj.group(u'play_path')
|
video_play_path = 'mp4:' + mobj.group('play_path')
|
||||||
video_player_url = video_page_url + u'includes/vodplayer.swf'
|
video_player_url = video_page_url + 'includes/vodplayer.swf'
|
||||||
|
|
||||||
return [{
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
'play_path': video_play_path,
|
'play_path': video_play_path,
|
||||||
'page_url': video_page_url,
|
'page_url': video_page_url,
|
||||||
'player_url': video_player_url,
|
'player_url': video_player_url,
|
||||||
'ext': 'flv',
|
'ext': 'flv',
|
||||||
'title': video_title,
|
'title': video_title,
|
||||||
'description': video_description,
|
'description': video_description,
|
||||||
'upload_date': video_upload_date,
|
'upload_date': video_upload_date,
|
||||||
'thumbnail': video_thumbnail,
|
'thumbnail': video_thumbnail,
|
||||||
}]
|
}
|
||||||
|
71
youtube_dl/extractor/servingsys.py
Normal file
71
youtube_dl/extractor/servingsys.py
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
int_or_none,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class ServingSysIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:[^.]+\.)?serving-sys\.com/BurstingPipe/adServer\.bs\?.*?&pli=(?P<id>[0-9]+)'
|
||||||
|
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://bs.serving-sys.com/BurstingPipe/adServer.bs?cn=is&c=23&pl=VAST&pli=5349193&PluID=0&pos=7135&ord=[timestamp]&cim=1?',
|
||||||
|
'playlist': [{
|
||||||
|
'file': '29955898.flv',
|
||||||
|
'md5': 'baed851342df6846eb8677a60a011a0f',
|
||||||
|
'info_dict': {
|
||||||
|
'title': 'AdAPPter_Hyundai_demo (1)',
|
||||||
|
'duration': 74,
|
||||||
|
'tbr': 1378,
|
||||||
|
'width': 640,
|
||||||
|
'height': 400,
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
'file': '29907998.flv',
|
||||||
|
'md5': '979b4da2655c4bc2d81aeb915a8c5014',
|
||||||
|
'info_dict': {
|
||||||
|
'title': 'AdAPPter_Hyundai_demo (2)',
|
||||||
|
'duration': 34,
|
||||||
|
'width': 854,
|
||||||
|
'height': 480,
|
||||||
|
'tbr': 516,
|
||||||
|
},
|
||||||
|
}],
|
||||||
|
'params': {
|
||||||
|
'playlistend': 2,
|
||||||
|
},
|
||||||
|
'skip': 'Blocked in the US [sic]',
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
pl_id = mobj.group('id')
|
||||||
|
|
||||||
|
vast_doc = self._download_xml(url, pl_id)
|
||||||
|
title = vast_doc.find('.//AdTitle').text
|
||||||
|
media = vast_doc.find('.//MediaFile').text
|
||||||
|
info_url = self._search_regex(r'&adData=([^&]+)&', media, 'info URL')
|
||||||
|
|
||||||
|
doc = self._download_xml(info_url, pl_id, 'Downloading video info')
|
||||||
|
entries = [{
|
||||||
|
'_type': 'video',
|
||||||
|
'id': a.attrib['id'],
|
||||||
|
'title': '%s (%s)' % (title, a.attrib['assetID']),
|
||||||
|
'url': a.attrib['URL'],
|
||||||
|
'duration': int_or_none(a.attrib.get('length')),
|
||||||
|
'tbr': int_or_none(a.attrib.get('bitrate')),
|
||||||
|
'height': int_or_none(a.attrib.get('height')),
|
||||||
|
'width': int_or_none(a.attrib.get('width')),
|
||||||
|
} for a in doc.findall('.//AdditionalAssets/asset')]
|
||||||
|
|
||||||
|
return {
|
||||||
|
'_type': 'playlist',
|
||||||
|
'id': pl_id,
|
||||||
|
'title': title,
|
||||||
|
'entries': entries,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@@ -1,4 +1,5 @@
|
|||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
@@ -12,21 +13,31 @@ from ..utils import (
|
|||||||
class SinaIE(InfoExtractor):
|
class SinaIE(InfoExtractor):
|
||||||
_VALID_URL = r'''https?://(.*?\.)?video\.sina\.com\.cn/
|
_VALID_URL = r'''https?://(.*?\.)?video\.sina\.com\.cn/
|
||||||
(
|
(
|
||||||
(.+?/(((?P<pseudo_id>\d+).html)|(.*?(\#|(vid=))(?P<id>\d+?)($|&))))
|
(.+?/(((?P<pseudo_id>\d+).html)|(.*?(\#|(vid=)|b/)(?P<id>\d+?)($|&|\-))))
|
||||||
|
|
|
|
||||||
# This is used by external sites like Weibo
|
# This is used by external sites like Weibo
|
||||||
(api/sinawebApi/outplay.php/(?P<token>.+?)\.swf)
|
(api/sinawebApi/outplay.php/(?P<token>.+?)\.swf)
|
||||||
)
|
)
|
||||||
'''
|
'''
|
||||||
|
|
||||||
_TEST = {
|
_TESTS = [
|
||||||
u'url': u'http://video.sina.com.cn/news/vlist/zt/chczlj2013/?opsubject_id=top12#110028898',
|
{
|
||||||
u'file': u'110028898.flv',
|
'url': 'http://video.sina.com.cn/news/vlist/zt/chczlj2013/?opsubject_id=top12#110028898',
|
||||||
u'md5': u'd65dd22ddcf44e38ce2bf58a10c3e71f',
|
'file': '110028898.flv',
|
||||||
u'info_dict': {
|
'md5': 'd65dd22ddcf44e38ce2bf58a10c3e71f',
|
||||||
u'title': u'《中国新闻》 朝鲜要求巴拿马立即释放被扣船员',
|
'info_dict': {
|
||||||
}
|
'title': '《中国新闻》 朝鲜要求巴拿马立即释放被扣船员',
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': 'http://video.sina.com.cn/v/b/101314253-1290078633.html',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '101314253',
|
||||||
|
'ext': 'flv',
|
||||||
|
'title': '军方提高对朝情报监视级别',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def suitable(cls, url):
|
def suitable(cls, url):
|
||||||
@@ -35,10 +46,10 @@ class SinaIE(InfoExtractor):
|
|||||||
def _extract_video(self, video_id):
|
def _extract_video(self, video_id):
|
||||||
data = compat_urllib_parse.urlencode({'vid': video_id})
|
data = compat_urllib_parse.urlencode({'vid': video_id})
|
||||||
url_doc = self._download_xml('http://v.iask.com/v_play.php?%s' % data,
|
url_doc = self._download_xml('http://v.iask.com/v_play.php?%s' % data,
|
||||||
video_id, u'Downloading video url')
|
video_id, 'Downloading video url')
|
||||||
image_page = self._download_webpage(
|
image_page = self._download_webpage(
|
||||||
'http://interface.video.sina.com.cn/interface/common/getVideoImage.php?%s' % data,
|
'http://interface.video.sina.com.cn/interface/common/getVideoImage.php?%s' % data,
|
||||||
video_id, u'Downloading thumbnail info')
|
video_id, 'Downloading thumbnail info')
|
||||||
|
|
||||||
return {'id': video_id,
|
return {'id': video_id,
|
||||||
'url': url_doc.find('./durl/url').text,
|
'url': url_doc.find('./durl/url').text,
|
||||||
@@ -52,7 +63,7 @@ class SinaIE(InfoExtractor):
|
|||||||
video_id = mobj.group('id')
|
video_id = mobj.group('id')
|
||||||
if mobj.group('token') is not None:
|
if mobj.group('token') is not None:
|
||||||
# The video id is in the redirected url
|
# The video id is in the redirected url
|
||||||
self.to_screen(u'Getting video id')
|
self.to_screen('Getting video id')
|
||||||
request = compat_urllib_request.Request(url)
|
request = compat_urllib_request.Request(url)
|
||||||
request.get_method = lambda: 'HEAD'
|
request.get_method = lambda: 'HEAD'
|
||||||
(_, urlh) = self._download_webpage_handle(request, 'NA', False)
|
(_, urlh) = self._download_webpage_handle(request, 'NA', False)
|
||||||
@@ -60,6 +71,6 @@ class SinaIE(InfoExtractor):
|
|||||||
elif video_id is None:
|
elif video_id is None:
|
||||||
pseudo_id = mobj.group('pseudo_id')
|
pseudo_id = mobj.group('pseudo_id')
|
||||||
webpage = self._download_webpage(url, pseudo_id)
|
webpage = self._download_webpage(url, pseudo_id)
|
||||||
video_id = self._search_regex(r'vid:\'(\d+?)\'', webpage, u'video id')
|
video_id = self._search_regex(r'vid:\'(\d+?)\'', webpage, 'video id')
|
||||||
|
|
||||||
return self._extract_video(video_id)
|
return self._extract_video(video_id)
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
import itertools
|
import itertools
|
||||||
@@ -32,58 +34,58 @@ class SoundcloudIE(InfoExtractor):
|
|||||||
|(?P<player>(?:w|player|p.)\.soundcloud\.com/player/?.*?url=.*)
|
|(?P<player>(?:w|player|p.)\.soundcloud\.com/player/?.*?url=.*)
|
||||||
)
|
)
|
||||||
'''
|
'''
|
||||||
IE_NAME = u'soundcloud'
|
IE_NAME = 'soundcloud'
|
||||||
_TESTS = [
|
_TESTS = [
|
||||||
{
|
{
|
||||||
u'url': u'http://soundcloud.com/ethmusic/lostin-powers-she-so-heavy',
|
'url': 'http://soundcloud.com/ethmusic/lostin-powers-she-so-heavy',
|
||||||
u'file': u'62986583.mp3',
|
'file': '62986583.mp3',
|
||||||
u'md5': u'ebef0a451b909710ed1d7787dddbf0d7',
|
'md5': 'ebef0a451b909710ed1d7787dddbf0d7',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"upload_date": u"20121011",
|
"upload_date": "20121011",
|
||||||
u"description": u"No Downloads untill we record the finished version this weekend, i was too pumped n i had to post it , earl is prolly gonna b hella p.o'd",
|
"description": "No Downloads untill we record the finished version this weekend, i was too pumped n i had to post it , earl is prolly gonna b hella p.o'd",
|
||||||
u"uploader": u"E.T. ExTerrestrial Music",
|
"uploader": "E.T. ExTerrestrial Music",
|
||||||
u"title": u"Lostin Powers - She so Heavy (SneakPreview) Adrian Ackers Blueprint 1"
|
"title": "Lostin Powers - She so Heavy (SneakPreview) Adrian Ackers Blueprint 1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
# not streamable song
|
# not streamable song
|
||||||
{
|
{
|
||||||
u'url': u'https://soundcloud.com/the-concept-band/goldrushed-mastered?in=the-concept-band/sets/the-royal-concept-ep',
|
'url': 'https://soundcloud.com/the-concept-band/goldrushed-mastered?in=the-concept-band/sets/the-royal-concept-ep',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'id': u'47127627',
|
'id': '47127627',
|
||||||
u'ext': u'mp3',
|
'ext': 'mp3',
|
||||||
u'title': u'Goldrushed',
|
'title': 'Goldrushed',
|
||||||
u'uploader': u'The Royal Concept',
|
'uploader': 'The Royal Concept',
|
||||||
u'upload_date': u'20120521',
|
'upload_date': '20120521',
|
||||||
},
|
},
|
||||||
u'params': {
|
'params': {
|
||||||
# rtmp
|
# rtmp
|
||||||
u'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
# private link
|
# private link
|
||||||
{
|
{
|
||||||
u'url': u'https://soundcloud.com/jaimemf/youtube-dl-test-video-a-y-baw/s-8Pjrp',
|
'url': 'https://soundcloud.com/jaimemf/youtube-dl-test-video-a-y-baw/s-8Pjrp',
|
||||||
u'md5': u'aa0dd32bfea9b0c5ef4f02aacd080604',
|
'md5': 'aa0dd32bfea9b0c5ef4f02aacd080604',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'id': u'123998367',
|
'id': '123998367',
|
||||||
u'ext': u'mp3',
|
'ext': 'mp3',
|
||||||
u'title': u'Youtube - Dl Test Video \'\' Ä↭',
|
'title': 'Youtube - Dl Test Video \'\' Ä↭',
|
||||||
u'uploader': u'jaimeMF',
|
'uploader': 'jaimeMF',
|
||||||
u'description': u'test chars: \"\'/\\ä↭',
|
'description': 'test chars: \"\'/\\ä↭',
|
||||||
u'upload_date': u'20131209',
|
'upload_date': '20131209',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
# downloadable song
|
# downloadable song
|
||||||
{
|
{
|
||||||
u'url': u'https://soundcloud.com/simgretina/just-your-problem-baby-1',
|
'url': 'https://soundcloud.com/simgretina/just-your-problem-baby-1',
|
||||||
u'md5': u'56a8b69568acaa967b4c49f9d1d52d19',
|
'md5': '56a8b69568acaa967b4c49f9d1d52d19',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'id': u'105614606',
|
'id': '105614606',
|
||||||
u'ext': u'wav',
|
'ext': 'wav',
|
||||||
u'title': u'Just Your Problem Baby (Acapella)',
|
'title': 'Just Your Problem Baby (Acapella)',
|
||||||
u'description': u'Vocals',
|
'description': 'Vocals',
|
||||||
u'uploader': u'Sim Gretina',
|
'uploader': 'Sim Gretina',
|
||||||
u'upload_date': u'20130815',
|
'upload_date': '20130815',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
@@ -112,7 +114,7 @@ class SoundcloudIE(InfoExtractor):
|
|||||||
thumbnail = info['artwork_url']
|
thumbnail = info['artwork_url']
|
||||||
if thumbnail is not None:
|
if thumbnail is not None:
|
||||||
thumbnail = thumbnail.replace('-large', '-t500x500')
|
thumbnail = thumbnail.replace('-large', '-t500x500')
|
||||||
ext = u'mp3'
|
ext = 'mp3'
|
||||||
result = {
|
result = {
|
||||||
'id': track_id,
|
'id': track_id,
|
||||||
'uploader': info['user']['username'],
|
'uploader': info['user']['username'],
|
||||||
@@ -124,11 +126,11 @@ class SoundcloudIE(InfoExtractor):
|
|||||||
if info.get('downloadable', False):
|
if info.get('downloadable', False):
|
||||||
# We can build a direct link to the song
|
# We can build a direct link to the song
|
||||||
format_url = (
|
format_url = (
|
||||||
u'https://api.soundcloud.com/tracks/{0}/download?client_id={1}'.format(
|
'https://api.soundcloud.com/tracks/{0}/download?client_id={1}'.format(
|
||||||
track_id, self._CLIENT_ID))
|
track_id, self._CLIENT_ID))
|
||||||
result['formats'] = [{
|
result['formats'] = [{
|
||||||
'format_id': 'download',
|
'format_id': 'download',
|
||||||
'ext': info.get('original_format', u'mp3'),
|
'ext': info.get('original_format', 'mp3'),
|
||||||
'url': format_url,
|
'url': format_url,
|
||||||
'vcodec': 'none',
|
'vcodec': 'none',
|
||||||
}]
|
}]
|
||||||
@@ -138,7 +140,7 @@ class SoundcloudIE(InfoExtractor):
|
|||||||
'client_id={1}&secret_token={2}'.format(track_id, self._IPHONE_CLIENT_ID, secret_token))
|
'client_id={1}&secret_token={2}'.format(track_id, self._IPHONE_CLIENT_ID, secret_token))
|
||||||
stream_json = self._download_webpage(
|
stream_json = self._download_webpage(
|
||||||
streams_url,
|
streams_url,
|
||||||
track_id, u'Downloading track url')
|
track_id, 'Downloading track url')
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
format_dict = json.loads(stream_json)
|
format_dict = json.loads(stream_json)
|
||||||
@@ -165,20 +167,19 @@ class SoundcloudIE(InfoExtractor):
|
|||||||
# We fallback to the stream_url in the original info, this
|
# We fallback to the stream_url in the original info, this
|
||||||
# cannot be always used, sometimes it can give an HTTP 404 error
|
# cannot be always used, sometimes it can give an HTTP 404 error
|
||||||
formats.append({
|
formats.append({
|
||||||
'format_id': u'fallback',
|
'format_id': 'fallback',
|
||||||
'url': info['stream_url'] + '?client_id=' + self._CLIENT_ID,
|
'url': info['stream_url'] + '?client_id=' + self._CLIENT_ID,
|
||||||
'ext': ext,
|
'ext': ext,
|
||||||
'vcodec': 'none',
|
'vcodec': 'none',
|
||||||
})
|
})
|
||||||
|
|
||||||
def format_pref(f):
|
for f in formats:
|
||||||
if f['format_id'].startswith('http'):
|
if f['format_id'].startswith('http'):
|
||||||
return 2
|
f['protocol'] = 'http'
|
||||||
if f['format_id'].startswith('rtmp'):
|
if f['format_id'].startswith('rtmp'):
|
||||||
return 1
|
f['protocol'] = 'rtmp'
|
||||||
return 0
|
|
||||||
|
|
||||||
formats.sort(key=format_pref)
|
self._sort_formats(formats)
|
||||||
result['formats'] = formats
|
result['formats'] = formats
|
||||||
|
|
||||||
return result
|
return result
|
||||||
@@ -210,14 +211,14 @@ class SoundcloudIE(InfoExtractor):
|
|||||||
|
|
||||||
url = 'http://soundcloud.com/%s' % resolve_title
|
url = 'http://soundcloud.com/%s' % resolve_title
|
||||||
info_json_url = self._resolv_url(url)
|
info_json_url = self._resolv_url(url)
|
||||||
info_json = self._download_webpage(info_json_url, full_title, u'Downloading info JSON')
|
info_json = self._download_webpage(info_json_url, full_title, 'Downloading info JSON')
|
||||||
|
|
||||||
info = json.loads(info_json)
|
info = json.loads(info_json)
|
||||||
return self._extract_info_dict(info, full_title, secret_token=token)
|
return self._extract_info_dict(info, full_title, secret_token=token)
|
||||||
|
|
||||||
class SoundcloudSetIE(SoundcloudIE):
|
class SoundcloudSetIE(SoundcloudIE):
|
||||||
_VALID_URL = r'^(?:https?://)?(?:www\.)?soundcloud\.com/([\w\d-]+)/sets/([\w\d-]+)(?:[?].*)?$'
|
_VALID_URL = r'^(?:https?://)?(?:www\.)?soundcloud\.com/([\w\d-]+)/sets/([\w\d-]+)(?:[?].*)?$'
|
||||||
IE_NAME = u'soundcloud:set'
|
IE_NAME = 'soundcloud:set'
|
||||||
# it's in tests/test_playlists.py
|
# it's in tests/test_playlists.py
|
||||||
_TESTS = []
|
_TESTS = []
|
||||||
|
|
||||||
@@ -254,7 +255,7 @@ class SoundcloudSetIE(SoundcloudIE):
|
|||||||
|
|
||||||
class SoundcloudUserIE(SoundcloudIE):
|
class SoundcloudUserIE(SoundcloudIE):
|
||||||
_VALID_URL = r'https?://(www\.)?soundcloud\.com/(?P<user>[^/]+)(/?(tracks/)?)?(\?.*)?$'
|
_VALID_URL = r'https?://(www\.)?soundcloud\.com/(?P<user>[^/]+)(/?(tracks/)?)?(\?.*)?$'
|
||||||
IE_NAME = u'soundcloud:user'
|
IE_NAME = 'soundcloud:user'
|
||||||
|
|
||||||
# it's in tests/test_playlists.py
|
# it's in tests/test_playlists.py
|
||||||
_TESTS = []
|
_TESTS = []
|
||||||
@@ -266,7 +267,7 @@ class SoundcloudUserIE(SoundcloudIE):
|
|||||||
url = 'http://soundcloud.com/%s/' % uploader
|
url = 'http://soundcloud.com/%s/' % uploader
|
||||||
resolv_url = self._resolv_url(url)
|
resolv_url = self._resolv_url(url)
|
||||||
user_json = self._download_webpage(resolv_url, uploader,
|
user_json = self._download_webpage(resolv_url, uploader,
|
||||||
u'Downloading user info')
|
'Downloading user info')
|
||||||
user = json.loads(user_json)
|
user = json.loads(user_json)
|
||||||
|
|
||||||
tracks = []
|
tracks = []
|
||||||
@@ -276,7 +277,7 @@ class SoundcloudUserIE(SoundcloudIE):
|
|||||||
})
|
})
|
||||||
tracks_url = 'http://api.soundcloud.com/users/%s/tracks.json?' % user['id'] + data
|
tracks_url = 'http://api.soundcloud.com/users/%s/tracks.json?' % user['id'] + data
|
||||||
response = self._download_webpage(tracks_url, uploader,
|
response = self._download_webpage(tracks_url, uploader,
|
||||||
u'Downloading tracks page %s' % (i+1))
|
'Downloading tracks page %s' % (i+1))
|
||||||
new_tracks = json.loads(response)
|
new_tracks = json.loads(response)
|
||||||
tracks.extend(self._extract_info_dict(track, quiet=True) for track in new_tracks)
|
tracks.extend(self._extract_info_dict(track, quiet=True) for track in new_tracks)
|
||||||
if len(new_tracks) < 50:
|
if len(new_tracks) < 50:
|
||||||
|
@@ -18,14 +18,6 @@ class SouthParkStudiosIE(MTVServicesInfoExtractor):
|
|||||||
},
|
},
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
|
||||||
mobj = re.match(self._VALID_URL, url)
|
|
||||||
url = u'http://www.' + mobj.group(u'url')
|
|
||||||
video_id = mobj.group('id')
|
|
||||||
webpage = self._download_webpage(url, video_id)
|
|
||||||
mgid = self._search_regex(r'swfobject.embedSWF\(".*?(mgid:.*?)"',
|
|
||||||
webpage, u'mgid')
|
|
||||||
return self._get_videos_info(mgid)
|
|
||||||
|
|
||||||
class SouthparkDeIE(SouthParkStudiosIE):
|
class SouthparkDeIE(SouthParkStudiosIE):
|
||||||
IE_NAME = u'southpark.de'
|
IE_NAME = u'southpark.de'
|
||||||
|
@@ -6,7 +6,7 @@ from ..utils import RegexNotFoundError, ExtractorError
|
|||||||
|
|
||||||
|
|
||||||
class SpaceIE(InfoExtractor):
|
class SpaceIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://www\.space\.com/\d+-(?P<title>[^/\.\?]*?)-video\.html'
|
_VALID_URL = r'https?://(?:(?:www|m)\.)?space\.com/\d+-(?P<title>[^/\.\?]*?)-video\.html'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'add_ie': ['Brightcove'],
|
u'add_ie': ['Brightcove'],
|
||||||
u'url': u'http://www.space.com/23373-huge-martian-landforms-detail-revealed-by-european-probe-video.html',
|
u'url': u'http://www.space.com/23373-huge-martian-landforms-detail-revealed-by-european-probe-video.html',
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
@@ -11,17 +13,18 @@ from ..aes import (
|
|||||||
aes_decrypt_text
|
aes_decrypt_text
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class SpankwireIE(InfoExtractor):
|
class SpankwireIE(InfoExtractor):
|
||||||
_VALID_URL = r'^(?:https?://)?(?:www\.)?(?P<url>spankwire\.com/[^/]*/video(?P<videoid>[0-9]+)/?)'
|
_VALID_URL = r'^(?:https?://)?(?:www\.)?(?P<url>spankwire\.com/[^/]*/video(?P<videoid>[0-9]+)/?)'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.spankwire.com/Buckcherry-s-X-Rated-Music-Video-Crazy-Bitch/video103545/',
|
'url': 'http://www.spankwire.com/Buckcherry-s-X-Rated-Music-Video-Crazy-Bitch/video103545/',
|
||||||
u'file': u'103545.mp4',
|
'file': '103545.mp4',
|
||||||
u'md5': u'1b3f55e345500552dbc252a3e9c1af43',
|
'md5': '1b3f55e345500552dbc252a3e9c1af43',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"uploader": u"oreusz",
|
"uploader": "oreusz",
|
||||||
u"title": u"Buckcherry`s X Rated Music Video Crazy Bitch",
|
"title": "Buckcherry`s X Rated Music Video Crazy Bitch",
|
||||||
u"description": u"Crazy Bitch X rated music video.",
|
"description": "Crazy Bitch X rated music video.",
|
||||||
u"age_limit": 18,
|
"age_limit": 18,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,17 +37,17 @@ class SpankwireIE(InfoExtractor):
|
|||||||
req.add_header('Cookie', 'age_verified=1')
|
req.add_header('Cookie', 'age_verified=1')
|
||||||
webpage = self._download_webpage(req, video_id)
|
webpage = self._download_webpage(req, video_id)
|
||||||
|
|
||||||
video_title = self._html_search_regex(r'<h1>([^<]+)', webpage, u'title')
|
video_title = self._html_search_regex(r'<h1>([^<]+)', webpage, 'title')
|
||||||
video_uploader = self._html_search_regex(
|
video_uploader = self._html_search_regex(
|
||||||
r'by:\s*<a [^>]*>(.+?)</a>', webpage, u'uploader', fatal=False)
|
r'by:\s*<a [^>]*>(.+?)</a>', webpage, 'uploader', fatal=False)
|
||||||
thumbnail = self._html_search_regex(
|
thumbnail = self._html_search_regex(
|
||||||
r'flashvars\.image_url = "([^"]+)', webpage, u'thumbnail', fatal=False)
|
r'flashvars\.image_url = "([^"]+)', webpage, 'thumbnail', fatal=False)
|
||||||
description = self._html_search_regex(
|
description = self._html_search_regex(
|
||||||
r'<div\s+id="descriptionContent">([^<]+)<', webpage, u'description', fatal=False)
|
r'<div\s+id="descriptionContent">([^<]+)<', webpage, 'description', fatal=False)
|
||||||
|
|
||||||
video_urls = list(map(compat_urllib_parse.unquote , re.findall(r'flashvars\.quality_[0-9]{3}p = "([^"]+)', webpage)))
|
video_urls = list(map(compat_urllib_parse.unquote , re.findall(r'flashvars\.quality_[0-9]{3}p = "([^"]+)', webpage)))
|
||||||
if webpage.find('flashvars\.encrypted = "true"') != -1:
|
if webpage.find('flashvars\.encrypted = "true"') != -1:
|
||||||
password = self._html_search_regex(r'flashvars\.video_title = "([^"]+)', webpage, u'password').replace('+', ' ')
|
password = self._html_search_regex(r'flashvars\.video_title = "([^"]+)', webpage, 'password').replace('+', ' ')
|
||||||
video_urls = list(map(lambda s: aes_decrypt_text(s, password, 32).decode('utf-8'), video_urls))
|
video_urls = list(map(lambda s: aes_decrypt_text(s, password, 32).decode('utf-8'), video_urls))
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
@@ -52,14 +55,21 @@ class SpankwireIE(InfoExtractor):
|
|||||||
path = compat_urllib_parse_urlparse(video_url).path
|
path = compat_urllib_parse_urlparse(video_url).path
|
||||||
extension = os.path.splitext(path)[1][1:]
|
extension = os.path.splitext(path)[1][1:]
|
||||||
format = path.split('/')[4].split('_')[:2]
|
format = path.split('/')[4].split('_')[:2]
|
||||||
|
resolution, bitrate_str = format
|
||||||
format = "-".join(format)
|
format = "-".join(format)
|
||||||
|
height = int(resolution.rstrip('P'))
|
||||||
|
tbr = int(bitrate_str.rstrip('K'))
|
||||||
|
|
||||||
formats.append({
|
formats.append({
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
'ext': extension,
|
'ext': extension,
|
||||||
|
'resolution': resolution,
|
||||||
'format': format,
|
'format': format,
|
||||||
|
'tbr': tbr,
|
||||||
|
'height': height,
|
||||||
'format_id': format,
|
'format_id': format,
|
||||||
})
|
})
|
||||||
formats.sort(key=lambda format: list(map(lambda s: s.zfill(6), format['format'].split('-'))))
|
self._sort_formats(formats)
|
||||||
|
|
||||||
age_limit = self._rta_search(webpage)
|
age_limit = self._rta_search(webpage)
|
||||||
|
|
||||||
|
19
youtube_dl/extractor/spike.py
Normal file
19
youtube_dl/extractor/spike.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from .mtv import MTVServicesInfoExtractor
|
||||||
|
|
||||||
|
|
||||||
|
class SpikeIE(MTVServicesInfoExtractor):
|
||||||
|
_VALID_URL = r'https?://www\.spike\.com/(video-clips|episodes)/.+'
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://www.spike.com/video-clips/lhtu8m/auction-hunters-can-allen-ride-a-hundred-year-old-motorcycle',
|
||||||
|
'md5': '1a9265f32b0c375793d6c4ce45255256',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'b9c8221a-4e50-479a-b86d-3333323e38ba',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Auction Hunters|Can Allen Ride A Hundred Year-Old Motorcycle?',
|
||||||
|
'description': 'md5:fbed7e82ed5fad493615b3094a9499cb',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
_FEED_URL = 'http://www.spike.com/feeds/mrss/'
|
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
@@ -9,61 +11,66 @@ from ..utils import (
|
|||||||
class TeamcocoIE(InfoExtractor):
|
class TeamcocoIE(InfoExtractor):
|
||||||
_VALID_URL = r'http://teamcoco\.com/video/(?P<url_title>.*)'
|
_VALID_URL = r'http://teamcoco\.com/video/(?P<url_title>.*)'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://teamcoco.com/video/louis-ck-interview-george-w-bush',
|
'url': 'http://teamcoco.com/video/louis-ck-interview-george-w-bush',
|
||||||
u'file': u'19705.mp4',
|
'file': '19705.mp4',
|
||||||
u'md5': u'cde9ba0fa3506f5f017ce11ead928f9a',
|
'md5': 'cde9ba0fa3506f5f017ce11ead928f9a',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"description": u"Louis C.K. got starstruck by George W. Bush, so what? Part one.",
|
"description": "Louis C.K. got starstruck by George W. Bush, so what? Part one.",
|
||||||
u"title": u"Louis C.K. Interview Pt. 1 11/3/11"
|
"title": "Louis C.K. Interview Pt. 1 11/3/11"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
raise ExtractorError(u'Invalid URL: %s' % url)
|
raise ExtractorError('Invalid URL: %s' % url)
|
||||||
url_title = mobj.group('url_title')
|
url_title = mobj.group('url_title')
|
||||||
webpage = self._download_webpage(url, url_title)
|
webpage = self._download_webpage(url, url_title)
|
||||||
|
|
||||||
video_id = self._html_search_regex(r'<article class="video" data-id="(\d+?)"',
|
video_id = self._html_search_regex(
|
||||||
webpage, u'video id')
|
r'<article class="video" data-id="(\d+?)"',
|
||||||
|
webpage, 'video id')
|
||||||
|
|
||||||
self.report_extraction(video_id)
|
self.report_extraction(video_id)
|
||||||
|
|
||||||
data_url = 'http://teamcoco.com/cvp/2.0/%s.xml' % video_id
|
data_url = 'http://teamcoco.com/cvp/2.0/%s.xml' % video_id
|
||||||
data = self._download_xml(data_url, video_id, 'Downloading data webpage')
|
data = self._download_xml(data_url, video_id, 'Downloading data webpage')
|
||||||
|
|
||||||
|
|
||||||
qualities = ['500k', '480p', '1000k', '720p', '1080p']
|
qualities = ['500k', '480p', '1000k', '720p', '1080p']
|
||||||
formats = []
|
formats = []
|
||||||
for file in data.findall('files/file'):
|
for filed in data.findall('files/file'):
|
||||||
if file.attrib.get('playmode') == 'all':
|
if filed.attrib.get('playmode') == 'all':
|
||||||
# it just duplicates one of the entries
|
# it just duplicates one of the entries
|
||||||
break
|
break
|
||||||
file_url = file.text
|
file_url = filed.text
|
||||||
m_format = re.search(r'(\d+(k|p))\.mp4', file_url)
|
m_format = re.search(r'(\d+(k|p))\.mp4', file_url)
|
||||||
if m_format is not None:
|
if m_format is not None:
|
||||||
format_id = m_format.group(1)
|
format_id = m_format.group(1)
|
||||||
else:
|
else:
|
||||||
format_id = file.attrib['bitrate']
|
format_id = filed.attrib['bitrate']
|
||||||
|
tbr = (
|
||||||
|
int(filed.attrib['bitrate'])
|
||||||
|
if filed.attrib['bitrate'].isdigit()
|
||||||
|
else None)
|
||||||
|
|
||||||
|
try:
|
||||||
|
quality = qualities.index(format_id)
|
||||||
|
except ValueError:
|
||||||
|
quality = -1
|
||||||
formats.append({
|
formats.append({
|
||||||
'url': file_url,
|
'url': file_url,
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
|
'tbr': tbr,
|
||||||
'format_id': format_id,
|
'format_id': format_id,
|
||||||
|
'quality': quality,
|
||||||
})
|
})
|
||||||
def sort_key(f):
|
|
||||||
try:
|
self._sort_formats(formats)
|
||||||
return qualities.index(f['format_id'])
|
|
||||||
except ValueError:
|
|
||||||
return -1
|
|
||||||
formats.sort(key=sort_key)
|
|
||||||
if not formats:
|
|
||||||
raise ExtractorError(u'Unable to extract video URL')
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'title': self._og_search_title(webpage),
|
'title': self._og_search_title(webpage),
|
||||||
'thumbnail': self._og_search_thumbnail(webpage),
|
'thumbnail': self._og_search_thumbnail(webpage),
|
||||||
'description': self._og_search_description(webpage),
|
'description': self._og_search_description(webpage),
|
||||||
}
|
}
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
|
|
||||||
@@ -7,6 +9,7 @@ from ..utils import (
|
|||||||
RegexNotFoundError,
|
RegexNotFoundError,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class TEDIE(SubtitlesInfoExtractor):
|
class TEDIE(SubtitlesInfoExtractor):
|
||||||
_VALID_URL=r'''http://www\.ted\.com/
|
_VALID_URL=r'''http://www\.ted\.com/
|
||||||
(
|
(
|
||||||
@@ -18,12 +21,12 @@ class TEDIE(SubtitlesInfoExtractor):
|
|||||||
/(?P<name>\w+) # Here goes the name and then ".html"
|
/(?P<name>\w+) # Here goes the name and then ".html"
|
||||||
'''
|
'''
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.ted.com/talks/dan_dennett_on_our_consciousness.html',
|
'url': 'http://www.ted.com/talks/dan_dennett_on_our_consciousness.html',
|
||||||
u'file': u'102.mp4',
|
'file': '102.mp4',
|
||||||
u'md5': u'2d76ee1576672e0bd8f187513267adf6',
|
'md5': '4ea1dada91e4174b53dac2bb8ace429d',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"description": u"md5:c6fa72e6eedbd938c9caf6b2702f5922",
|
"description": "md5:c6fa72e6eedbd938c9caf6b2702f5922",
|
||||||
u"title": u"Dan Dennett: The illusion of consciousness"
|
"title": "Dan Dennett: The illusion of consciousness"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,7 +50,7 @@ class TEDIE(SubtitlesInfoExtractor):
|
|||||||
'''Returns the videos of the playlist'''
|
'''Returns the videos of the playlist'''
|
||||||
|
|
||||||
webpage = self._download_webpage(
|
webpage = self._download_webpage(
|
||||||
url, playlist_id, u'Downloading playlist webpage')
|
url, playlist_id, 'Downloading playlist webpage')
|
||||||
matches = re.finditer(
|
matches = re.finditer(
|
||||||
r'<p\s+class="talk-title[^"]*"><a\s+href="(?P<talk_url>/talks/[^"]+\.html)">[^<]*</a></p>',
|
r'<p\s+class="talk-title[^"]*"><a\s+href="(?P<talk_url>/talks/[^"]+\.html)">[^<]*</a></p>',
|
||||||
webpage)
|
webpage)
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
@@ -9,11 +11,11 @@ from ..utils import (
|
|||||||
class TumblrIE(InfoExtractor):
|
class TumblrIE(InfoExtractor):
|
||||||
_VALID_URL = r'http://(?P<blog_name>.*?)\.tumblr\.com/((post)|(video))/(?P<id>\d*)/(.*?)'
|
_VALID_URL = r'http://(?P<blog_name>.*?)\.tumblr\.com/((post)|(video))/(?P<id>\d*)/(.*?)'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://tatianamaslanydaily.tumblr.com/post/54196191430/orphan-black-dvd-extra-behind-the-scenes',
|
'url': 'http://tatianamaslanydaily.tumblr.com/post/54196191430/orphan-black-dvd-extra-behind-the-scenes',
|
||||||
u'file': u'54196191430.mp4',
|
'file': '54196191430.mp4',
|
||||||
u'md5': u'479bb068e5b16462f5176a6828829767',
|
'md5': '479bb068e5b16462f5176a6828829767',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"title": u"tatiana maslany news"
|
"title": "tatiana maslany news"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,18 +30,20 @@ class TumblrIE(InfoExtractor):
|
|||||||
re_video = r'src=\\x22(?P<video_url>http://%s\.tumblr\.com/video_file/%s/(.*?))\\x22 type=\\x22video/(?P<ext>.*?)\\x22' % (blog, video_id)
|
re_video = r'src=\\x22(?P<video_url>http://%s\.tumblr\.com/video_file/%s/(.*?))\\x22 type=\\x22video/(?P<ext>.*?)\\x22' % (blog, video_id)
|
||||||
video = re.search(re_video, webpage)
|
video = re.search(re_video, webpage)
|
||||||
if video is None:
|
if video is None:
|
||||||
raise ExtractorError(u'Unable to extract video')
|
raise ExtractorError('Unable to extract video')
|
||||||
video_url = video.group('video_url')
|
video_url = video.group('video_url')
|
||||||
ext = video.group('ext')
|
ext = video.group('ext')
|
||||||
|
|
||||||
video_thumbnail = self._search_regex(r'posters(.*?)\[\\x22(?P<thumb>.*?)\\x22',
|
video_thumbnail = self._search_regex(
|
||||||
webpage, u'thumbnail', fatal=False) # We pick the first poster
|
r'posters.*?\[\\x22(.*?)\\x22',
|
||||||
if video_thumbnail: video_thumbnail = video_thumbnail.replace('\\', '')
|
webpage, 'thumbnail', fatal=False) # We pick the first poster
|
||||||
|
if video_thumbnail:
|
||||||
|
video_thumbnail = video_thumbnail.replace('\\\\/', '/')
|
||||||
|
|
||||||
# The only place where you can get a title, it's not complete,
|
# The only place where you can get a title, it's not complete,
|
||||||
# but searching in other places doesn't work for all videos
|
# but searching in other places doesn't work for all videos
|
||||||
video_title = self._html_search_regex(r'<title>(?P<title>.*?)(?: \| Tumblr)?</title>',
|
video_title = self._html_search_regex(r'<title>(?P<title>.*?)(?: \| Tumblr)?</title>',
|
||||||
webpage, u'title', flags=re.DOTALL)
|
webpage, 'title', flags=re.DOTALL)
|
||||||
|
|
||||||
return [{'id': video_id,
|
return [{'id': video_id,
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
|
@@ -291,7 +291,7 @@ class VimeoIE(InfoExtractor):
|
|||||||
|
|
||||||
class VimeoChannelIE(InfoExtractor):
|
class VimeoChannelIE(InfoExtractor):
|
||||||
IE_NAME = 'vimeo:channel'
|
IE_NAME = 'vimeo:channel'
|
||||||
_VALID_URL = r'(?:https?://)?vimeo.\com/channels/(?P<id>[^/]+)'
|
_VALID_URL = r'(?:https?://)?vimeo\.com/channels/(?P<id>[^/]+)'
|
||||||
_MORE_PAGES_INDICATOR = r'<a.+?rel="next"'
|
_MORE_PAGES_INDICATOR = r'<a.+?rel="next"'
|
||||||
_TITLE_RE = r'<link rel="alternate"[^>]+?title="(.*?)"'
|
_TITLE_RE = r'<link rel="alternate"[^>]+?title="(.*?)"'
|
||||||
|
|
||||||
@@ -327,7 +327,7 @@ class VimeoChannelIE(InfoExtractor):
|
|||||||
|
|
||||||
class VimeoUserIE(VimeoChannelIE):
|
class VimeoUserIE(VimeoChannelIE):
|
||||||
IE_NAME = 'vimeo:user'
|
IE_NAME = 'vimeo:user'
|
||||||
_VALID_URL = r'(?:https?://)?vimeo.\com/(?P<name>[^/]+)(?:/videos|[#?]|$)'
|
_VALID_URL = r'(?:https?://)?vimeo\.com/(?P<name>[^/]+)(?:/videos|[#?]|$)'
|
||||||
_TITLE_RE = r'<a[^>]+?class="user">([^<>]+?)</a>'
|
_TITLE_RE = r'<a[^>]+?class="user">([^<>]+?)</a>'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -344,7 +344,7 @@ class VimeoUserIE(VimeoChannelIE):
|
|||||||
|
|
||||||
class VimeoAlbumIE(VimeoChannelIE):
|
class VimeoAlbumIE(VimeoChannelIE):
|
||||||
IE_NAME = 'vimeo:album'
|
IE_NAME = 'vimeo:album'
|
||||||
_VALID_URL = r'(?:https?://)?vimeo.\com/album/(?P<id>\d+)'
|
_VALID_URL = r'(?:https?://)?vimeo\.com/album/(?P<id>\d+)'
|
||||||
_TITLE_RE = r'<header id="page_header">\n\s*<h1>(.*?)</h1>'
|
_TITLE_RE = r'<header id="page_header">\n\s*<h1>(.*?)</h1>'
|
||||||
|
|
||||||
def _page_url(self, base_url, pagenum):
|
def _page_url(self, base_url, pagenum):
|
||||||
@@ -358,7 +358,7 @@ class VimeoAlbumIE(VimeoChannelIE):
|
|||||||
|
|
||||||
class VimeoGroupsIE(VimeoAlbumIE):
|
class VimeoGroupsIE(VimeoAlbumIE):
|
||||||
IE_NAME = 'vimeo:group'
|
IE_NAME = 'vimeo:group'
|
||||||
_VALID_URL = r'(?:https?://)?vimeo.\com/groups/(?P<name>[^/]+)'
|
_VALID_URL = r'(?:https?://)?vimeo\.com/groups/(?P<name>[^/]+)'
|
||||||
|
|
||||||
def _extract_list_title(self, webpage):
|
def _extract_list_title(self, webpage):
|
||||||
return self._og_search_title(webpage)
|
return self._og_search_title(webpage)
|
||||||
@@ -372,7 +372,7 @@ class VimeoGroupsIE(VimeoAlbumIE):
|
|||||||
class VimeoReviewIE(InfoExtractor):
|
class VimeoReviewIE(InfoExtractor):
|
||||||
IE_NAME = 'vimeo:review'
|
IE_NAME = 'vimeo:review'
|
||||||
IE_DESC = 'Review pages on vimeo'
|
IE_DESC = 'Review pages on vimeo'
|
||||||
_VALID_URL = r'(?:https?://)?vimeo.\com/[^/]+/review/(?P<id>[^/]+)'
|
_VALID_URL = r'(?:https?://)?vimeo\.com/[^/]+/review/(?P<id>[^/]+)'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'https://vimeo.com/user21297594/review/75524534/3c257a1b5d',
|
'url': 'https://vimeo.com/user21297594/review/75524534/3c257a1b5d',
|
||||||
'file': '75524534.mp4',
|
'file': '75524534.mp4',
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import json
|
import json
|
||||||
|
|
||||||
@@ -10,19 +12,27 @@ from ..utils import (
|
|||||||
|
|
||||||
|
|
||||||
class VKIE(InfoExtractor):
|
class VKIE(InfoExtractor):
|
||||||
IE_NAME = u'vk.com'
|
IE_NAME = 'vk.com'
|
||||||
_VALID_URL = r'https?://vk\.com/(?:videos.*?\?.*?z=)?video(?P<id>.*?)(?:\?|%2F|$)'
|
_VALID_URL = r'https?://vk\.com/(?:videos.*?\?.*?z=)?video(?P<id>.*?)(?:\?|%2F|$)'
|
||||||
|
|
||||||
_TEST = {
|
_TESTS = [{
|
||||||
u'url': u'http://vk.com/videos-77521?z=video-77521_162222515%2Fclub77521',
|
'url': 'http://vk.com/videos-77521?z=video-77521_162222515%2Fclub77521',
|
||||||
u'md5': u'0deae91935c54e00003c2a00646315f0',
|
'file': '162222515.flv',
|
||||||
u'info_dict': {
|
'md5': '0deae91935c54e00003c2a00646315f0',
|
||||||
u'id': u'162222515',
|
'info_dict': {
|
||||||
u'ext': u'flv',
|
'title': 'ProtivoGunz - Хуёвая песня',
|
||||||
u'title': u'ProtivoGunz - Хуёвая песня',
|
'uploader': 'Noize MC',
|
||||||
u'uploader': u'Noize MC',
|
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
'url': 'http://vk.com/video4643923_163339118',
|
||||||
|
'file': '163339118.mp4',
|
||||||
|
'md5': 'f79bccb5cd182b1f43502ca5685b2b36',
|
||||||
|
'info_dict': {
|
||||||
|
'uploader': 'Elvira Dzhonik',
|
||||||
|
'title': 'Dream Theater - Hollow Years Live at Budokan 720*',
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
@@ -33,13 +43,21 @@ class VKIE(InfoExtractor):
|
|||||||
if m_yt is not None:
|
if m_yt is not None:
|
||||||
self.to_screen(u'Youtube video detected')
|
self.to_screen(u'Youtube video detected')
|
||||||
return self.url_result(m_yt.group(1), 'Youtube')
|
return self.url_result(m_yt.group(1), 'Youtube')
|
||||||
vars_json = self._search_regex(r'var vars = ({.*?});', info_page, u'vars')
|
data_json = self._search_regex(r'var vars = ({.*?});', info_page, 'vars')
|
||||||
vars = json.loads(vars_json)
|
data = json.loads(data_json)
|
||||||
|
|
||||||
|
formats = [{
|
||||||
|
'format_id': k,
|
||||||
|
'url': v,
|
||||||
|
'width': int(k[len('url'):]),
|
||||||
|
} for k, v in data.items()
|
||||||
|
if k.startswith('url')]
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': compat_str(vars['vid']),
|
'id': compat_str(data['vid']),
|
||||||
'url': vars['url240'],
|
'formats': formats,
|
||||||
'title': unescapeHTML(vars['md_title']),
|
'title': unescapeHTML(data['md_title']),
|
||||||
'thumbnail': vars['jpg'],
|
'thumbnail': data.get('jpg'),
|
||||||
'uploader': vars['md_author'],
|
'uploader': data.get('md_author'),
|
||||||
}
|
}
|
||||||
|
@@ -1,59 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
import re
|
|
||||||
|
|
||||||
from ..utils import (
|
|
||||||
compat_urllib_request,
|
|
||||||
compat_urllib_parse
|
|
||||||
)
|
|
||||||
|
|
||||||
from .common import InfoExtractor
|
|
||||||
|
|
||||||
class WeBSurgIE(InfoExtractor):
|
|
||||||
IE_NAME = u'websurg.com'
|
|
||||||
_VALID_URL = r'http://.*?\.websurg\.com/MEDIA/\?noheader=1&doi=(.*)'
|
|
||||||
|
|
||||||
_TEST = {
|
|
||||||
u'url': u'http://www.websurg.com/MEDIA/?noheader=1&doi=vd01en4012',
|
|
||||||
u'file': u'vd01en4012.mp4',
|
|
||||||
u'params': {
|
|
||||||
u'skip_download': True,
|
|
||||||
},
|
|
||||||
u'skip': u'Requires login information',
|
|
||||||
}
|
|
||||||
|
|
||||||
_LOGIN_URL = 'http://www.websurg.com/inc/login/login_div.ajax.php?login=1'
|
|
||||||
|
|
||||||
def _real_initialize(self):
|
|
||||||
|
|
||||||
login_form = {
|
|
||||||
'username': self._downloader.params['username'],
|
|
||||||
'password': self._downloader.params['password'],
|
|
||||||
'Submit': 1
|
|
||||||
}
|
|
||||||
|
|
||||||
request = compat_urllib_request.Request(
|
|
||||||
self._LOGIN_URL, compat_urllib_parse.urlencode(login_form))
|
|
||||||
request.add_header(
|
|
||||||
'Content-Type', 'application/x-www-form-urlencoded;charset=utf-8')
|
|
||||||
compat_urllib_request.urlopen(request).info()
|
|
||||||
webpage = self._download_webpage(self._LOGIN_URL, '', 'Logging in')
|
|
||||||
|
|
||||||
if webpage != 'OK':
|
|
||||||
self._downloader.report_error(
|
|
||||||
u'Unable to log in: bad username/password')
|
|
||||||
|
|
||||||
def _real_extract(self, url):
|
|
||||||
video_id = re.match(self._VALID_URL, url).group(1)
|
|
||||||
|
|
||||||
webpage = self._download_webpage(url, video_id)
|
|
||||||
|
|
||||||
url_info = re.search(r'streamer="(.*?)" src="(.*?)"', webpage)
|
|
||||||
|
|
||||||
return {'id': video_id,
|
|
||||||
'title': self._og_search_title(webpage),
|
|
||||||
'description': self._og_search_description(webpage),
|
|
||||||
'ext' : 'mp4',
|
|
||||||
'url' : url_info.group(1) + '/' + url_info.group(2),
|
|
||||||
'thumbnail': self._og_search_thumbnail(webpage)
|
|
||||||
}
|
|
@@ -1,5 +1,6 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import base64
|
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
|
||||||
@@ -7,12 +8,12 @@ from .common import InfoExtractor
|
|||||||
class WimpIE(InfoExtractor):
|
class WimpIE(InfoExtractor):
|
||||||
_VALID_URL = r'(?:http://)?(?:www\.)?wimp\.com/([^/]+)/'
|
_VALID_URL = r'(?:http://)?(?:www\.)?wimp\.com/([^/]+)/'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.wimp.com/deerfence/',
|
'url': 'http://www.wimp.com/deerfence/',
|
||||||
u'file': u'deerfence.flv',
|
'file': 'deerfence.flv',
|
||||||
u'md5': u'8b215e2e0168c6081a1cf84b2846a2b5',
|
'md5': '8b215e2e0168c6081a1cf84b2846a2b5',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"title": u"Watch Till End: Herd of deer jump over a fence.",
|
"title": "Watch Till End: Herd of deer jump over a fence.",
|
||||||
u"description": u"These deer look as fluid as running water when they jump over this fence as a herd. This video is one that needs to be watched until the very end for the true majesty to be witnessed, but once it comes, it's sure to take your breath away.",
|
"description": "These deer look as fluid as running water when they jump over this fence as a herd. This video is one that needs to be watched until the very end for the true majesty to be witnessed, but once it comes, it's sure to take your breath away.",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -20,13 +21,12 @@ class WimpIE(InfoExtractor):
|
|||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
video_id = mobj.group(1)
|
video_id = mobj.group(1)
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
googleString = self._search_regex("googleCode = '(.*?)'", webpage, 'file url')
|
video_url = self._search_regex(
|
||||||
googleString = base64.b64decode(googleString).decode('ascii')
|
r's1\.addVariable\("file",\s*"([^"]+)"\);', webpage, 'video URL')
|
||||||
final_url = self._search_regex('","(.*?)"', googleString, u'final video url')
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'url': final_url,
|
'url': video_url,
|
||||||
'title': self._og_search_title(webpage),
|
'title': self._og_search_title(webpage),
|
||||||
'thumbnail': self._og_search_thumbnail(webpage),
|
'thumbnail': self._og_search_thumbnail(webpage),
|
||||||
'description': self._og_search_description(webpage),
|
'description': self._og_search_description(webpage),
|
||||||
|
@@ -1,10 +1,11 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
compat_urllib_parse,
|
compat_urllib_parse,
|
||||||
unescapeHTML,
|
unescapeHTML,
|
||||||
determine_ext,
|
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -13,25 +14,25 @@ class XHamsterIE(InfoExtractor):
|
|||||||
"""Information Extractor for xHamster"""
|
"""Information Extractor for xHamster"""
|
||||||
_VALID_URL = r'(?:http://)?(?:www\.)?xhamster\.com/movies/(?P<id>[0-9]+)/(?P<seo>.+?)\.html(?:\?.*)?'
|
_VALID_URL = r'(?:http://)?(?:www\.)?xhamster\.com/movies/(?P<id>[0-9]+)/(?P<seo>.+?)\.html(?:\?.*)?'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
u'url': u'http://xhamster.com/movies/1509445/femaleagent_shy_beauty_takes_the_bait.html',
|
'url': 'http://xhamster.com/movies/1509445/femaleagent_shy_beauty_takes_the_bait.html',
|
||||||
u'file': u'1509445.flv',
|
'file': '1509445.mp4',
|
||||||
u'md5': u'9f48e0e8d58e3076bb236ff412ab62fa',
|
'md5': '8281348b8d3c53d39fffb377d24eac4e',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"upload_date": u"20121014",
|
"upload_date": "20121014",
|
||||||
u"uploader_id": u"Ruseful2011",
|
"uploader_id": "Ruseful2011",
|
||||||
u"title": u"FemaleAgent Shy beauty takes the bait",
|
"title": "FemaleAgent Shy beauty takes the bait",
|
||||||
u"age_limit": 18,
|
"age_limit": 18,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
u'url': u'http://xhamster.com/movies/2221348/britney_spears_sexy_booty.html?hd',
|
'url': 'http://xhamster.com/movies/2221348/britney_spears_sexy_booty.html?hd',
|
||||||
u'file': u'2221348.flv',
|
'file': '2221348.flv',
|
||||||
u'md5': u'e767b9475de189320f691f49c679c4c7',
|
'md5': 'e767b9475de189320f691f49c679c4c7',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"upload_date": u"20130914",
|
"upload_date": "20130914",
|
||||||
u"uploader_id": u"jojo747400",
|
"uploader_id": "jojo747400",
|
||||||
u"title": u"Britney Spears Sexy Booty",
|
"title": "Britney Spears Sexy Booty",
|
||||||
u"age_limit": 18,
|
"age_limit": 18,
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
|
|
||||||
@@ -39,14 +40,21 @@ class XHamsterIE(InfoExtractor):
|
|||||||
def extract_video_url(webpage):
|
def extract_video_url(webpage):
|
||||||
mobj = re.search(r'\'srv\': \'(?P<server>[^\']*)\',\s*\'file\': \'(?P<file>[^\']+)\',', webpage)
|
mobj = re.search(r'\'srv\': \'(?P<server>[^\']*)\',\s*\'file\': \'(?P<file>[^\']+)\',', webpage)
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
raise ExtractorError(u'Unable to extract media URL')
|
raise ExtractorError('Unable to extract media URL')
|
||||||
if len(mobj.group('server')) == 0:
|
if len(mobj.group('server')) == 0:
|
||||||
return compat_urllib_parse.unquote(mobj.group('file'))
|
return compat_urllib_parse.unquote(mobj.group('file'))
|
||||||
else:
|
else:
|
||||||
return mobj.group('server')+'/key='+mobj.group('file')
|
return mobj.group('server')+'/key='+mobj.group('file')
|
||||||
|
|
||||||
|
def extract_mp4_video_url(webpage):
|
||||||
|
mp4 = re.search(r'<a href=\"(.+?)\" class=\"mp4Play\"',webpage)
|
||||||
|
if mp4 is None:
|
||||||
|
return None
|
||||||
|
else:
|
||||||
|
return mp4.group(1)
|
||||||
|
|
||||||
def is_hd(webpage):
|
def is_hd(webpage):
|
||||||
return webpage.find('<div class=\'icon iconHD\'') != -1
|
return '<div class=\'icon iconHD\'' in webpage
|
||||||
|
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
|
||||||
@@ -55,50 +63,60 @@ class XHamsterIE(InfoExtractor):
|
|||||||
mrss_url = 'http://xhamster.com/movies/%s/%s.html' % (video_id, seo)
|
mrss_url = 'http://xhamster.com/movies/%s/%s.html' % (video_id, seo)
|
||||||
webpage = self._download_webpage(mrss_url, video_id)
|
webpage = self._download_webpage(mrss_url, video_id)
|
||||||
|
|
||||||
video_title = self._html_search_regex(r'<title>(?P<title>.+?) - xHamster\.com</title>',
|
video_title = self._html_search_regex(
|
||||||
webpage, u'title')
|
r'<title>(?P<title>.+?) - xHamster\.com</title>', webpage, 'title')
|
||||||
|
|
||||||
# Only a few videos have an description
|
# Only a few videos have an description
|
||||||
mobj = re.search('<span>Description: </span>(?P<description>[^<]+)', webpage)
|
mobj = re.search(r'<span>Description: </span>([^<]+)', webpage)
|
||||||
if mobj:
|
video_description = mobj.group(1) if mobj else None
|
||||||
video_description = unescapeHTML(mobj.group('description'))
|
|
||||||
else:
|
|
||||||
video_description = None
|
|
||||||
|
|
||||||
mobj = re.search(r'hint=\'(?P<upload_date_Y>[0-9]{4})-(?P<upload_date_m>[0-9]{2})-(?P<upload_date_d>[0-9]{2}) [0-9]{2}:[0-9]{2}:[0-9]{2} [A-Z]{3,4}\'', webpage)
|
mobj = re.search(r'hint=\'(?P<upload_date_Y>[0-9]{4})-(?P<upload_date_m>[0-9]{2})-(?P<upload_date_d>[0-9]{2}) [0-9]{2}:[0-9]{2}:[0-9]{2} [A-Z]{3,4}\'', webpage)
|
||||||
if mobj:
|
if mobj:
|
||||||
video_upload_date = mobj.group('upload_date_Y')+mobj.group('upload_date_m')+mobj.group('upload_date_d')
|
video_upload_date = mobj.group('upload_date_Y')+mobj.group('upload_date_m')+mobj.group('upload_date_d')
|
||||||
else:
|
else:
|
||||||
video_upload_date = None
|
video_upload_date = None
|
||||||
self._downloader.report_warning(u'Unable to extract upload date')
|
self._downloader.report_warning('Unable to extract upload date')
|
||||||
|
|
||||||
video_uploader_id = self._html_search_regex(r'<a href=\'/user/[^>]+>(?P<uploader_id>[^<]+)',
|
video_uploader_id = self._html_search_regex(
|
||||||
webpage, u'uploader id', default=u'anonymous')
|
r'<a href=\'/user/[^>]+>(?P<uploader_id>[^<]+)',
|
||||||
|
webpage, 'uploader id', default='anonymous')
|
||||||
|
|
||||||
video_thumbnail = self._search_regex(r'\'image\':\'(?P<thumbnail>[^\']+)\'',
|
video_thumbnail = self._search_regex(
|
||||||
webpage, u'thumbnail', fatal=False)
|
r'\'image\':\'(?P<thumbnail>[^\']+)\'',
|
||||||
|
webpage, 'thumbnail', fatal=False)
|
||||||
|
|
||||||
age_limit = self._rta_search(webpage)
|
age_limit = self._rta_search(webpage)
|
||||||
|
|
||||||
video_url = extract_video_url(webpage)
|
|
||||||
hd = is_hd(webpage)
|
hd = is_hd(webpage)
|
||||||
|
video_url = extract_video_url(webpage)
|
||||||
formats = [{
|
formats = [{
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
'ext': determine_ext(video_url),
|
|
||||||
'format': 'hd' if hd else 'sd',
|
|
||||||
'format_id': 'hd' if hd else 'sd',
|
'format_id': 'hd' if hd else 'sd',
|
||||||
|
'preference': 0,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
video_mp4_url = extract_mp4_video_url(webpage)
|
||||||
|
if video_mp4_url is not None:
|
||||||
|
formats.append({
|
||||||
|
'url': video_mp4_url,
|
||||||
|
'ext': 'mp4',
|
||||||
|
'format_id': 'mp4-hd' if hd else 'mp4-sd',
|
||||||
|
'preference': 1,
|
||||||
|
})
|
||||||
|
|
||||||
if not hd:
|
if not hd:
|
||||||
webpage = self._download_webpage(mrss_url+'?hd', video_id)
|
webpage = self._download_webpage(
|
||||||
|
mrss_url + '?hd', video_id, note='Downloading HD webpage')
|
||||||
if is_hd(webpage):
|
if is_hd(webpage):
|
||||||
video_url = extract_video_url(webpage)
|
video_url = extract_video_url(webpage)
|
||||||
formats.append({
|
formats.append({
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
'ext': determine_ext(video_url),
|
|
||||||
'format': 'hd',
|
|
||||||
'format_id': 'hd',
|
'format_id': 'hd',
|
||||||
|
'preference': 2,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': video_title,
|
'title': video_title,
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
@@ -9,12 +11,12 @@ from ..utils import (
|
|||||||
class XVideosIE(InfoExtractor):
|
class XVideosIE(InfoExtractor):
|
||||||
_VALID_URL = r'^(?:https?://)?(?:www\.)?xvideos\.com/video([0-9]+)(?:.*)'
|
_VALID_URL = r'^(?:https?://)?(?:www\.)?xvideos\.com/video([0-9]+)(?:.*)'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.xvideos.com/video939581/funny_porns_by_s_-1',
|
'url': 'http://www.xvideos.com/video939581/funny_porns_by_s_-1',
|
||||||
u'file': u'939581.flv',
|
'file': '939581.flv',
|
||||||
u'md5': u'1d0c835822f0a71a7bf011855db929d0',
|
'md5': '1d0c835822f0a71a7bf011855db929d0',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"title": u"Funny Porns By >>>>S<<<<<< -1",
|
"title": "Funny Porns By >>>>S<<<<<< -1",
|
||||||
u"age_limit": 18,
|
"age_limit": 18,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,18 +29,18 @@ class XVideosIE(InfoExtractor):
|
|||||||
self.report_extraction(video_id)
|
self.report_extraction(video_id)
|
||||||
|
|
||||||
# Extract video URL
|
# Extract video URL
|
||||||
video_url = compat_urllib_parse.unquote(self._search_regex(r'flv_url=(.+?)&',
|
video_url = compat_urllib_parse.unquote(
|
||||||
webpage, u'video URL'))
|
self._search_regex(r'flv_url=(.+?)&', webpage, 'video URL'))
|
||||||
|
|
||||||
# Extract title
|
# Extract title
|
||||||
video_title = self._html_search_regex(r'<title>(.*?)\s+-\s+XVID',
|
video_title = self._html_search_regex(
|
||||||
webpage, u'title')
|
r'<title>(.*?)\s+-\s+XVID', webpage, 'title')
|
||||||
|
|
||||||
# Extract video thumbnail
|
# Extract video thumbnail
|
||||||
video_thumbnail = self._search_regex(r'http://(?:img.*?\.)xvideos.com/videos/thumbs/[a-fA-F0-9]+/[a-fA-F0-9]+/[a-fA-F0-9]+/[a-fA-F0-9]+/([a-fA-F0-9.]+jpg)',
|
video_thumbnail = self._search_regex(
|
||||||
webpage, u'thumbnail', fatal=False)
|
r'url_bigthumb=(.+?)&', webpage, 'thumbnail', fatal=False)
|
||||||
|
|
||||||
info = {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
'uploader': None,
|
'uploader': None,
|
||||||
@@ -49,5 +51,3 @@ class XVideosIE(InfoExtractor):
|
|||||||
'description': None,
|
'description': None,
|
||||||
'age_limit': 18,
|
'age_limit': 18,
|
||||||
}
|
}
|
||||||
|
|
||||||
return [info]
|
|
||||||
|
@@ -27,6 +27,9 @@ from ..utils import (
|
|||||||
get_element_by_id,
|
get_element_by_id,
|
||||||
get_element_by_attribute,
|
get_element_by_attribute,
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
|
int_or_none,
|
||||||
|
PagedList,
|
||||||
|
RegexNotFoundError,
|
||||||
unescapeHTML,
|
unescapeHTML,
|
||||||
unified_strdate,
|
unified_strdate,
|
||||||
orderedSet,
|
orderedSet,
|
||||||
@@ -37,7 +40,7 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
|
|||||||
"""Provide base functions for Youtube extractors"""
|
"""Provide base functions for Youtube extractors"""
|
||||||
_LOGIN_URL = 'https://accounts.google.com/ServiceLogin'
|
_LOGIN_URL = 'https://accounts.google.com/ServiceLogin'
|
||||||
_LANG_URL = r'https://www.youtube.com/?hl=en&persist_hl=1&gl=US&persist_gl=1&opt_out_ackd=1'
|
_LANG_URL = r'https://www.youtube.com/?hl=en&persist_hl=1&gl=US&persist_gl=1&opt_out_ackd=1'
|
||||||
_AGE_URL = 'http://www.youtube.com/verify_age?next_url=/&gl=US&hl=en'
|
_AGE_URL = 'https://www.youtube.com/verify_age?next_url=/&gl=US&hl=en'
|
||||||
_NETRC_MACHINE = 'youtube'
|
_NETRC_MACHINE = 'youtube'
|
||||||
# If True it will raise an error if no login info is provided
|
# If True it will raise an error if no login info is provided
|
||||||
_LOGIN_REQUIRED = False
|
_LOGIN_REQUIRED = False
|
||||||
@@ -108,7 +111,8 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
|
|||||||
'next_url': '/',
|
'next_url': '/',
|
||||||
'action_confirm': 'Confirm',
|
'action_confirm': 'Confirm',
|
||||||
}
|
}
|
||||||
req = compat_urllib_request.Request(self._AGE_URL, compat_urllib_parse.urlencode(age_form))
|
req = compat_urllib_request.Request(self._AGE_URL,
|
||||||
|
compat_urllib_parse.urlencode(age_form).encode('ascii'))
|
||||||
|
|
||||||
self._download_webpage(
|
self._download_webpage(
|
||||||
req, None,
|
req, None,
|
||||||
@@ -204,6 +208,12 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
|
|||||||
'141': {'ext': 'm4a', 'format_note': 'DASH audio', 'vcodec': 'none', 'abr': 256, 'preference': -50},
|
'141': {'ext': 'm4a', 'format_note': 'DASH audio', 'vcodec': 'none', 'abr': 256, 'preference': -50},
|
||||||
|
|
||||||
# Dash webm
|
# Dash webm
|
||||||
|
'167': {'ext': 'webm', 'height': 360, 'width': 640, 'format_note': 'DASH video', 'container': 'webm', 'vcodec': 'VP8', 'acodec': 'none', 'preference': -40},
|
||||||
|
'168': {'ext': 'webm', 'height': 480, 'width': 854, 'format_note': 'DASH video', 'container': 'webm', 'vcodec': 'VP8', 'acodec': 'none', 'preference': -40},
|
||||||
|
'169': {'ext': 'webm', 'height': 720, 'width': 1280, 'format_note': 'DASH video', 'container': 'webm', 'vcodec': 'VP8', 'acodec': 'none', 'preference': -40},
|
||||||
|
'170': {'ext': 'webm', 'height': 1080, 'width': 1920, 'format_note': 'DASH video', 'container': 'webm', 'vcodec': 'VP8', 'acodec': 'none', 'preference': -40},
|
||||||
|
'218': {'ext': 'webm', 'height': 480, 'width': 854, 'format_note': 'DASH video', 'container': 'webm', 'vcodec': 'VP8', 'acodec': 'none', 'preference': -40},
|
||||||
|
'219': {'ext': 'webm', 'height': 480, 'width': 854, 'format_note': 'DASH video', 'container': 'webm', 'vcodec': 'VP8', 'acodec': 'none', 'preference': -40},
|
||||||
'242': {'ext': 'webm', 'height': 240, 'resolution': '240p', 'format_note': 'DASH webm', 'preference': -40},
|
'242': {'ext': 'webm', 'height': 240, 'resolution': '240p', 'format_note': 'DASH webm', 'preference': -40},
|
||||||
'243': {'ext': 'webm', 'height': 360, 'resolution': '360p', 'format_note': 'DASH webm', 'preference': -40},
|
'243': {'ext': 'webm', 'height': 360, 'resolution': '360p', 'format_note': 'DASH webm', 'preference': -40},
|
||||||
'244': {'ext': 'webm', 'height': 480, 'resolution': '480p', 'format_note': 'DASH webm', 'preference': -40},
|
'244': {'ext': 'webm', 'height': 480, 'resolution': '480p', 'format_note': 'DASH webm', 'preference': -40},
|
||||||
@@ -269,6 +279,22 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
|
|||||||
u"uploader_id": u"setindia"
|
u"uploader_id": u"setindia"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
u"url": u"http://www.youtube.com/watch?v=a9LDPn-MO4I",
|
||||||
|
u"file": u"a9LDPn-MO4I.m4a",
|
||||||
|
u"note": u"256k DASH audio (format 141) via DASH manifest",
|
||||||
|
u"info_dict": {
|
||||||
|
u"upload_date": "20121002",
|
||||||
|
u"uploader_id": "8KVIDEO",
|
||||||
|
u"description": "No description available.",
|
||||||
|
u"uploader": "8KVIDEO",
|
||||||
|
u"title": "UHDTV TEST 8K VIDEO.mp4"
|
||||||
|
},
|
||||||
|
u"params": {
|
||||||
|
u"youtube_include_dash_manifest": True,
|
||||||
|
u"format": "141",
|
||||||
|
},
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@@ -989,7 +1015,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
|
|||||||
def _get_available_subtitles(self, video_id, webpage):
|
def _get_available_subtitles(self, video_id, webpage):
|
||||||
try:
|
try:
|
||||||
sub_list = self._download_webpage(
|
sub_list = self._download_webpage(
|
||||||
'http://video.google.com/timedtext?hl=en&type=list&v=%s' % video_id,
|
'https://video.google.com/timedtext?hl=en&type=list&v=%s' % video_id,
|
||||||
video_id, note=False)
|
video_id, note=False)
|
||||||
except ExtractorError as err:
|
except ExtractorError as err:
|
||||||
self._downloader.report_warning(u'unable to download video subtitles: %s' % compat_str(err))
|
self._downloader.report_warning(u'unable to download video subtitles: %s' % compat_str(err))
|
||||||
@@ -1005,7 +1031,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
|
|||||||
'fmt': self._downloader.params.get('subtitlesformat', 'srt'),
|
'fmt': self._downloader.params.get('subtitlesformat', 'srt'),
|
||||||
'name': unescapeHTML(l[0]).encode('utf-8'),
|
'name': unescapeHTML(l[0]).encode('utf-8'),
|
||||||
})
|
})
|
||||||
url = u'http://www.youtube.com/api/timedtext?' + params
|
url = u'https://www.youtube.com/api/timedtext?' + params
|
||||||
sub_lang_list[lang] = url
|
sub_lang_list[lang] = url
|
||||||
if not sub_lang_list:
|
if not sub_lang_list:
|
||||||
self._downloader.report_warning(u'video doesn\'t have subtitles')
|
self._downloader.report_warning(u'video doesn\'t have subtitles')
|
||||||
@@ -1066,18 +1092,6 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
|
|||||||
video_id = mobj.group(2)
|
video_id = mobj.group(2)
|
||||||
return video_id
|
return video_id
|
||||||
|
|
||||||
def _get_video_url_list(self, url_map):
|
|
||||||
"""
|
|
||||||
Transform a dictionary in the format {itag:url} to a list of (itag, url)
|
|
||||||
with the requested formats.
|
|
||||||
"""
|
|
||||||
existing_formats = [x for x in self._formats if x in url_map]
|
|
||||||
if len(existing_formats) == 0:
|
|
||||||
raise ExtractorError(u'no known formats available for video')
|
|
||||||
video_url_list = [(f, url_map[f]) for f in existing_formats] # All formats
|
|
||||||
video_url_list.reverse() # order worst to best
|
|
||||||
return video_url_list
|
|
||||||
|
|
||||||
def _extract_from_m3u8(self, manifest_url, video_id):
|
def _extract_from_m3u8(self, manifest_url, video_id):
|
||||||
url_map = {}
|
url_map = {}
|
||||||
def _get_urls(_manifest):
|
def _get_urls(_manifest):
|
||||||
@@ -1251,7 +1265,6 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
|
|||||||
video_annotations = self._extract_annotations(video_id)
|
video_annotations = self._extract_annotations(video_id)
|
||||||
|
|
||||||
# Decide which formats to download
|
# Decide which formats to download
|
||||||
|
|
||||||
try:
|
try:
|
||||||
mobj = re.search(r';ytplayer.config = ({.*?});', video_webpage)
|
mobj = re.search(r';ytplayer.config = ({.*?});', video_webpage)
|
||||||
if not mobj:
|
if not mobj:
|
||||||
@@ -1276,9 +1289,27 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def _map_to_format_list(urlmap):
|
||||||
|
formats = []
|
||||||
|
for itag, video_real_url in urlmap.items():
|
||||||
|
dct = {
|
||||||
|
'format_id': itag,
|
||||||
|
'url': video_real_url,
|
||||||
|
'player_url': player_url,
|
||||||
|
}
|
||||||
|
if itag in self._formats:
|
||||||
|
dct.update(self._formats[itag])
|
||||||
|
formats.append(dct)
|
||||||
|
return formats
|
||||||
|
|
||||||
if 'conn' in video_info and video_info['conn'][0].startswith('rtmp'):
|
if 'conn' in video_info and video_info['conn'][0].startswith('rtmp'):
|
||||||
self.report_rtmp_download()
|
self.report_rtmp_download()
|
||||||
video_url_list = [('_rtmp', video_info['conn'][0])]
|
formats = [{
|
||||||
|
'format_id': '_rtmp',
|
||||||
|
'protocol': 'rtmp',
|
||||||
|
'url': video_info['conn'][0],
|
||||||
|
'player_url': player_url,
|
||||||
|
}]
|
||||||
elif len(video_info.get('url_encoded_fmt_stream_map', [])) >= 1 or len(video_info.get('adaptive_fmts', [])) >= 1:
|
elif len(video_info.get('url_encoded_fmt_stream_map', [])) >= 1 or len(video_info.get('adaptive_fmts', [])) >= 1:
|
||||||
encoded_url_map = video_info.get('url_encoded_fmt_stream_map', [''])[0] + ',' + video_info.get('adaptive_fmts',[''])[0]
|
encoded_url_map = video_info.get('url_encoded_fmt_stream_map', [''])[0] + ',' + video_info.get('adaptive_fmts',[''])[0]
|
||||||
if 'rtmpe%3Dyes' in encoded_url_map:
|
if 'rtmpe%3Dyes' in encoded_url_map:
|
||||||
@@ -1323,23 +1354,50 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
|
|||||||
if 'ratebypass' not in url:
|
if 'ratebypass' not in url:
|
||||||
url += '&ratebypass=yes'
|
url += '&ratebypass=yes'
|
||||||
url_map[url_data['itag'][0]] = url
|
url_map[url_data['itag'][0]] = url
|
||||||
video_url_list = self._get_video_url_list(url_map)
|
formats = _map_to_format_list(url_map)
|
||||||
elif video_info.get('hlsvp'):
|
elif video_info.get('hlsvp'):
|
||||||
manifest_url = video_info['hlsvp'][0]
|
manifest_url = video_info['hlsvp'][0]
|
||||||
url_map = self._extract_from_m3u8(manifest_url, video_id)
|
url_map = self._extract_from_m3u8(manifest_url, video_id)
|
||||||
video_url_list = self._get_video_url_list(url_map)
|
formats = _map_to_format_list(url_map)
|
||||||
else:
|
else:
|
||||||
raise ExtractorError(u'no conn, hlsvp or url_encoded_fmt_stream_map information found in video info')
|
raise ExtractorError(u'no conn, hlsvp or url_encoded_fmt_stream_map information found in video info')
|
||||||
|
|
||||||
formats = []
|
# Look for the DASH manifest
|
||||||
for itag, video_real_url in video_url_list:
|
dash_manifest_url_lst = video_info.get('dashmpd')
|
||||||
dct = {
|
if (dash_manifest_url_lst and dash_manifest_url_lst[0] and
|
||||||
'format_id': itag,
|
self._downloader.params.get('youtube_include_dash_manifest', False)):
|
||||||
'url': video_real_url,
|
try:
|
||||||
'player_url': player_url,
|
dash_doc = self._download_xml(
|
||||||
}
|
dash_manifest_url_lst[0], video_id,
|
||||||
dct.update(self._formats[itag])
|
note=u'Downloading DASH manifest',
|
||||||
formats.append(dct)
|
errnote=u'Could not download DASH manifest')
|
||||||
|
for r in dash_doc.findall(u'.//{urn:mpeg:DASH:schema:MPD:2011}Representation'):
|
||||||
|
url_el = r.find('{urn:mpeg:DASH:schema:MPD:2011}BaseURL')
|
||||||
|
if url_el is None:
|
||||||
|
continue
|
||||||
|
format_id = r.attrib['id']
|
||||||
|
video_url = url_el.text
|
||||||
|
filesize = int_or_none(url_el.attrib.get('{http://youtube.com/yt/2012/10/10}contentLength'))
|
||||||
|
f = {
|
||||||
|
'format_id': format_id,
|
||||||
|
'url': video_url,
|
||||||
|
'width': int_or_none(r.attrib.get('width')),
|
||||||
|
'tbr': int_or_none(r.attrib.get('bandwidth'), 1000),
|
||||||
|
'asr': int_or_none(r.attrib.get('audioSamplingRate')),
|
||||||
|
'filesize': filesize,
|
||||||
|
}
|
||||||
|
try:
|
||||||
|
existing_format = next(
|
||||||
|
fo for fo in formats
|
||||||
|
if fo['format_id'] == format_id)
|
||||||
|
except StopIteration:
|
||||||
|
f.update(self._formats.get(format_id, {}))
|
||||||
|
formats.append(f)
|
||||||
|
else:
|
||||||
|
existing_format.update(f)
|
||||||
|
|
||||||
|
except (ExtractorError, KeyError) as e:
|
||||||
|
self.report_warning(u'Skipping DASH manifest: %s' % e, video_id)
|
||||||
|
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
@@ -1448,7 +1506,14 @@ class YoutubePlaylistIE(YoutubeBaseInfoExtractor):
|
|||||||
if re.search(self._MORE_PAGES_INDICATOR, page) is None:
|
if re.search(self._MORE_PAGES_INDICATOR, page) is None:
|
||||||
break
|
break
|
||||||
|
|
||||||
playlist_title = self._og_search_title(page)
|
try:
|
||||||
|
playlist_title = self._og_search_title(page)
|
||||||
|
except RegexNotFoundError:
|
||||||
|
self.report_warning(
|
||||||
|
u'Playlist page is missing OpenGraph title, falling back ...',
|
||||||
|
playlist_id)
|
||||||
|
playlist_title = self._html_search_regex(
|
||||||
|
r'<h1 class="pl-header-title">(.*?)</h1>', page, u'title')
|
||||||
|
|
||||||
url_results = self._ids_to_results(ids)
|
url_results = self._ids_to_results(ids)
|
||||||
return self.playlist_result(url_results, playlist_id, playlist_title)
|
return self.playlist_result(url_results, playlist_id, playlist_title)
|
||||||
@@ -1465,7 +1530,7 @@ class YoutubeTopListIE(YoutubePlaylistIE):
|
|||||||
channel = mobj.group('chann')
|
channel = mobj.group('chann')
|
||||||
title = mobj.group('title')
|
title = mobj.group('title')
|
||||||
query = compat_urllib_parse.urlencode({'title': title})
|
query = compat_urllib_parse.urlencode({'title': title})
|
||||||
playlist_re = 'href="([^"]+?%s[^"]+?)"' % re.escape(query)
|
playlist_re = 'href="([^"]+?%s.*?)"' % re.escape(query)
|
||||||
channel_page = self._download_webpage('https://www.youtube.com/%s' % channel, title)
|
channel_page = self._download_webpage('https://www.youtube.com/%s' % channel, title)
|
||||||
link = self._html_search_regex(playlist_re, channel_page, u'list')
|
link = self._html_search_regex(playlist_re, channel_page, u'list')
|
||||||
url = compat_urlparse.urljoin('https://www.youtube.com/', link)
|
url = compat_urlparse.urljoin('https://www.youtube.com/', link)
|
||||||
@@ -1490,7 +1555,7 @@ class YoutubeChannelIE(InfoExtractor):
|
|||||||
IE_DESC = u'YouTube.com channels'
|
IE_DESC = u'YouTube.com channels'
|
||||||
_VALID_URL = r"^(?:https?://)?(?:youtu\.be|(?:\w+\.)?youtube(?:-nocookie)?\.com)/channel/([0-9A-Za-z_-]+)"
|
_VALID_URL = r"^(?:https?://)?(?:youtu\.be|(?:\w+\.)?youtube(?:-nocookie)?\.com)/channel/([0-9A-Za-z_-]+)"
|
||||||
_MORE_PAGES_INDICATOR = 'yt-uix-load-more'
|
_MORE_PAGES_INDICATOR = 'yt-uix-load-more'
|
||||||
_MORE_PAGES_URL = 'http://www.youtube.com/c4_browse_ajax?action_load_more_videos=1&flow=list&paging=%s&view=0&sort=da&channel_id=%s'
|
_MORE_PAGES_URL = 'https://www.youtube.com/c4_browse_ajax?action_load_more_videos=1&flow=list&paging=%s&view=0&sort=da&channel_id=%s'
|
||||||
IE_NAME = u'youtube:channel'
|
IE_NAME = u'youtube:channel'
|
||||||
|
|
||||||
def extract_videos_from_page(self, page):
|
def extract_videos_from_page(self, page):
|
||||||
@@ -1546,9 +1611,9 @@ class YoutubeChannelIE(InfoExtractor):
|
|||||||
class YoutubeUserIE(InfoExtractor):
|
class YoutubeUserIE(InfoExtractor):
|
||||||
IE_DESC = u'YouTube.com user videos (URL or "ytuser" keyword)'
|
IE_DESC = u'YouTube.com user videos (URL or "ytuser" keyword)'
|
||||||
_VALID_URL = r'(?:(?:(?:https?://)?(?:\w+\.)?youtube\.com/(?:user/)?(?!(?:attribution_link|watch)(?:$|[^a-z_A-Z0-9-])))|ytuser:)(?!feed/)([A-Za-z0-9_-]+)'
|
_VALID_URL = r'(?:(?:(?:https?://)?(?:\w+\.)?youtube\.com/(?:user/)?(?!(?:attribution_link|watch)(?:$|[^a-z_A-Z0-9-])))|ytuser:)(?!feed/)([A-Za-z0-9_-]+)'
|
||||||
_TEMPLATE_URL = 'http://gdata.youtube.com/feeds/api/users/%s'
|
_TEMPLATE_URL = 'https://gdata.youtube.com/feeds/api/users/%s'
|
||||||
_GDATA_PAGE_SIZE = 50
|
_GDATA_PAGE_SIZE = 50
|
||||||
_GDATA_URL = 'http://gdata.youtube.com/feeds/api/users/%s/uploads?max-results=%d&start-index=%d&alt=json'
|
_GDATA_URL = 'https://gdata.youtube.com/feeds/api/users/%s/uploads?max-results=%d&start-index=%d&alt=json'
|
||||||
IE_NAME = u'youtube:user'
|
IE_NAME = u'youtube:user'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -1572,44 +1637,35 @@ class YoutubeUserIE(InfoExtractor):
|
|||||||
# page by page until there are no video ids - it means we got
|
# page by page until there are no video ids - it means we got
|
||||||
# all of them.
|
# all of them.
|
||||||
|
|
||||||
url_results = []
|
def download_page(pagenum):
|
||||||
|
|
||||||
for pagenum in itertools.count(0):
|
|
||||||
start_index = pagenum * self._GDATA_PAGE_SIZE + 1
|
start_index = pagenum * self._GDATA_PAGE_SIZE + 1
|
||||||
|
|
||||||
gdata_url = self._GDATA_URL % (username, self._GDATA_PAGE_SIZE, start_index)
|
gdata_url = self._GDATA_URL % (username, self._GDATA_PAGE_SIZE, start_index)
|
||||||
page = self._download_webpage(gdata_url, username,
|
page = self._download_webpage(
|
||||||
u'Downloading video ids from %d to %d' % (start_index, start_index + self._GDATA_PAGE_SIZE))
|
gdata_url, username,
|
||||||
|
u'Downloading video ids from %d to %d' % (
|
||||||
|
start_index, start_index + self._GDATA_PAGE_SIZE))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = json.loads(page)
|
response = json.loads(page)
|
||||||
except ValueError as err:
|
except ValueError as err:
|
||||||
raise ExtractorError(u'Invalid JSON in API response: ' + compat_str(err))
|
raise ExtractorError(u'Invalid JSON in API response: ' + compat_str(err))
|
||||||
if 'entry' not in response['feed']:
|
if 'entry' not in response['feed']:
|
||||||
# Number of videos is a multiple of self._MAX_RESULTS
|
return
|
||||||
break
|
|
||||||
|
|
||||||
# Extract video identifiers
|
# Extract video identifiers
|
||||||
entries = response['feed']['entry']
|
entries = response['feed']['entry']
|
||||||
for entry in entries:
|
for entry in entries:
|
||||||
title = entry['title']['$t']
|
title = entry['title']['$t']
|
||||||
video_id = entry['id']['$t'].split('/')[-1]
|
video_id = entry['id']['$t'].split('/')[-1]
|
||||||
url_results.append({
|
yield {
|
||||||
'_type': 'url',
|
'_type': 'url',
|
||||||
'url': video_id,
|
'url': video_id,
|
||||||
'ie_key': 'Youtube',
|
'ie_key': 'Youtube',
|
||||||
'id': 'video_id',
|
'id': 'video_id',
|
||||||
'title': title,
|
'title': title,
|
||||||
})
|
}
|
||||||
|
url_results = PagedList(download_page, self._GDATA_PAGE_SIZE)
|
||||||
# A little optimization - if current page is not
|
|
||||||
# "full", ie. does not contain PAGE_SIZE video ids then
|
|
||||||
# we can assume that this page is the last one - there
|
|
||||||
# are no more ids on further pages - no need to query
|
|
||||||
# again.
|
|
||||||
|
|
||||||
if len(entries) < self._GDATA_PAGE_SIZE:
|
|
||||||
break
|
|
||||||
|
|
||||||
return self.playlist_result(url_results, playlist_title=username)
|
return self.playlist_result(url_results, playlist_title=username)
|
||||||
|
|
||||||
@@ -1688,7 +1744,7 @@ class YoutubeFeedsInfoExtractor(YoutubeBaseInfoExtractor):
|
|||||||
action = 'action_load_system_feed'
|
action = 'action_load_system_feed'
|
||||||
if self._PERSONAL_FEED:
|
if self._PERSONAL_FEED:
|
||||||
action = 'action_load_personal_feed'
|
action = 'action_load_personal_feed'
|
||||||
return 'http://www.youtube.com/feed_ajax?%s=1&feed_name=%s&paging=%%s' % (action, self._FEED_NAME)
|
return 'https://www.youtube.com/feed_ajax?%s=1&feed_name=%s&paging=%%s' % (action, self._FEED_NAME)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def IE_NAME(self):
|
def IE_NAME(self):
|
||||||
@@ -1757,7 +1813,10 @@ class YoutubeFavouritesIE(YoutubeBaseInfoExtractor):
|
|||||||
class YoutubeTruncatedURLIE(InfoExtractor):
|
class YoutubeTruncatedURLIE(InfoExtractor):
|
||||||
IE_NAME = 'youtube:truncated_url'
|
IE_NAME = 'youtube:truncated_url'
|
||||||
IE_DESC = False # Do not list
|
IE_DESC = False # Do not list
|
||||||
_VALID_URL = r'(?:https?://)?[^/]+/watch\?feature=[a-z_]+$'
|
_VALID_URL = r'''(?x)
|
||||||
|
(?:https?://)?[^/]+/watch\?feature=[a-z_]+$|
|
||||||
|
(?:https?://)?(?:www\.)?youtube\.com/attribution_link\?a=[^&]+$
|
||||||
|
'''
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
raise ExtractorError(
|
raise ExtractorError(
|
||||||
|
@@ -479,6 +479,7 @@ class FFmpegMergerPP(FFmpegPostProcessor):
|
|||||||
def run(self, info):
|
def run(self, info):
|
||||||
filename = info['filepath']
|
filename = info['filepath']
|
||||||
args = ['-c', 'copy']
|
args = ['-c', 'copy']
|
||||||
|
self._downloader.to_screen(u'[ffmpeg] Merging formats into "%s"' % filename)
|
||||||
self.run_ffmpeg_multiple_files(info['__files_to_merge'], filename, args)
|
self.run_ffmpeg_multiple_files(info['__files_to_merge'], filename, args)
|
||||||
return True, info
|
return True, info
|
||||||
|
|
||||||
|
@@ -90,7 +90,7 @@ def update_self(to_screen, verbose):
|
|||||||
to_screen(u'youtube-dl is up to date (%s)' % __version__)
|
to_screen(u'youtube-dl is up to date (%s)' % __version__)
|
||||||
return
|
return
|
||||||
|
|
||||||
to_screen(u'Updating to version ' + version_id + '...')
|
to_screen(u'Updating to version ' + version_id + ' ...')
|
||||||
version = versions_info['versions'][version_id]
|
version = versions_info['versions'][version_id]
|
||||||
|
|
||||||
print_notes(to_screen, versions_info['versions'])
|
print_notes(to_screen, versions_info['versions'])
|
||||||
|
@@ -6,6 +6,7 @@ import datetime
|
|||||||
import email.utils
|
import email.utils
|
||||||
import errno
|
import errno
|
||||||
import gzip
|
import gzip
|
||||||
|
import itertools
|
||||||
import io
|
import io
|
||||||
import json
|
import json
|
||||||
import locale
|
import locale
|
||||||
@@ -224,7 +225,7 @@ if sys.version_info >= (2,7):
|
|||||||
def find_xpath_attr(node, xpath, key, val):
|
def find_xpath_attr(node, xpath, key, val):
|
||||||
""" Find the xpath xpath[@key=val] """
|
""" Find the xpath xpath[@key=val] """
|
||||||
assert re.match(r'^[a-zA-Z]+$', key)
|
assert re.match(r'^[a-zA-Z]+$', key)
|
||||||
assert re.match(r'^[a-zA-Z0-9@\s]*$', val)
|
assert re.match(r'^[a-zA-Z0-9@\s:._]*$', val)
|
||||||
expr = xpath + u"[@%s='%s']" % (key, val)
|
expr = xpath + u"[@%s='%s']" % (key, val)
|
||||||
return node.find(expr)
|
return node.find(expr)
|
||||||
else:
|
else:
|
||||||
@@ -1092,9 +1093,12 @@ def month_by_name(name):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def fix_xml_all_ampersand(xml_str):
|
def fix_xml_ampersands(xml_str):
|
||||||
"""Replace all the '&' by '&' in XML"""
|
"""Replace all the '&' by '&' in XML"""
|
||||||
return xml_str.replace(u'&', u'&')
|
return re.sub(
|
||||||
|
r'&(?!amp;|lt;|gt;|apos;|quot;|#x[0-9a-fA-F]{,4};|#[0-9]{,4};)',
|
||||||
|
u'&',
|
||||||
|
xml_str)
|
||||||
|
|
||||||
|
|
||||||
def setproctitle(title):
|
def setproctitle(title):
|
||||||
@@ -1128,8 +1132,8 @@ class HEADRequest(compat_urllib_request.Request):
|
|||||||
return "HEAD"
|
return "HEAD"
|
||||||
|
|
||||||
|
|
||||||
def int_or_none(v):
|
def int_or_none(v, scale=1):
|
||||||
return v if v is None else int(v)
|
return v if v is None else (int(v) // scale)
|
||||||
|
|
||||||
|
|
||||||
def parse_duration(s):
|
def parse_duration(s):
|
||||||
@@ -1161,3 +1165,50 @@ def check_executable(exe, args=[]):
|
|||||||
except OSError:
|
except OSError:
|
||||||
return False
|
return False
|
||||||
return exe
|
return exe
|
||||||
|
|
||||||
|
|
||||||
|
class PagedList(object):
|
||||||
|
def __init__(self, pagefunc, pagesize):
|
||||||
|
self._pagefunc = pagefunc
|
||||||
|
self._pagesize = pagesize
|
||||||
|
|
||||||
|
def __len__(self):
|
||||||
|
# This is only useful for tests
|
||||||
|
return len(self.getslice())
|
||||||
|
|
||||||
|
def getslice(self, start=0, end=None):
|
||||||
|
res = []
|
||||||
|
for pagenum in itertools.count(start // self._pagesize):
|
||||||
|
firstid = pagenum * self._pagesize
|
||||||
|
nextfirstid = pagenum * self._pagesize + self._pagesize
|
||||||
|
if start >= nextfirstid:
|
||||||
|
continue
|
||||||
|
|
||||||
|
page_results = list(self._pagefunc(pagenum))
|
||||||
|
|
||||||
|
startv = (
|
||||||
|
start % self._pagesize
|
||||||
|
if firstid <= start < nextfirstid
|
||||||
|
else 0)
|
||||||
|
|
||||||
|
endv = (
|
||||||
|
((end - 1) % self._pagesize) + 1
|
||||||
|
if (end is not None and firstid <= end <= nextfirstid)
|
||||||
|
else None)
|
||||||
|
|
||||||
|
if startv != 0 or endv is not None:
|
||||||
|
page_results = page_results[startv:endv]
|
||||||
|
res.extend(page_results)
|
||||||
|
|
||||||
|
# A little optimization - if current page is not "full", ie. does
|
||||||
|
# not contain page_size videos then we can assume that this page
|
||||||
|
# is the last one - there are no more ids on further pages -
|
||||||
|
# i.e. no need to query again.
|
||||||
|
if len(page_results) + startv < self._pagesize:
|
||||||
|
break
|
||||||
|
|
||||||
|
# If we got the whole page, but the next page is not interesting,
|
||||||
|
# break out early as well
|
||||||
|
if end == nextfirstid:
|
||||||
|
break
|
||||||
|
return res
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
|
|
||||||
__version__ = '2013.01.17.1'
|
__version__ = '2014.01.27.2'
|
||||||
|
Reference in New Issue
Block a user