Compare commits
176 Commits
2014.01.07
...
2014.01.23
Author | SHA1 | Date | |
---|---|---|---|
|
f265fc1238 | ||
|
1394ce65b4 | ||
|
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 | ||
|
9eea4fb835 | ||
|
484aaeb204 | ||
|
8e589a8a47 | ||
|
2f21eb2db6 | ||
|
c11529618a | ||
|
58c3c7ae38 | ||
|
c8650f7ecd | ||
|
14e7543a5a | ||
|
bf6705f584 | ||
|
a9f53ce7ea | ||
|
a45ea17042 | ||
|
4950f30890 | ||
|
7df7f00385 | ||
|
d2250ea7fd | ||
|
17093b83ca | ||
|
5d8683a5cd | ||
|
cede88e5bb | ||
|
aadc71642a | ||
|
67d28bff12 | ||
|
7ee40b5d1c | ||
|
db22af36ec | ||
|
f8b5ab8cfa | ||
|
298f16f954 | ||
|
3d97cbbdaf | ||
|
ce6b9a2dba | ||
|
c3197e3e5c | ||
|
d420d8dd1b | ||
|
3fabeaa1f4 | ||
|
35aa7098cd | ||
|
9d6192a5b8 | ||
|
76b1bd672d | ||
|
469ec9416a | ||
|
70af3439e9 | ||
|
bb3c20965e | ||
|
5f59ee7942 | ||
|
8f89e68781 | ||
|
10bff13a66 | ||
|
166ff8a3c7 | ||
|
b4622a328b | ||
|
cc253000e4 | ||
|
42e4fcf23a | ||
|
9c63128668 | ||
|
9933b57430 | ||
|
84c92dc00f | ||
|
42154ad5bc | ||
|
96f1b0741c | ||
|
bac268e243 | ||
|
3798eadccd | ||
|
2537186d43 | ||
|
0eecc6a417 | ||
|
0dc13f4c4a | ||
|
f577e0ce15 | ||
|
bd1b906527 | ||
|
ecfef3e5bf | ||
|
3d3538e422 |
296
README.md
296
README.md
@@ -16,113 +16,139 @@ 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
|
||||||
|
occurs
|
||||||
--dump-user-agent display the current browser identification
|
--dump-user-agent display the current browser identification
|
||||||
--user-agent UA specify a custom user agent
|
--user-agent UA specify a custom user agent
|
||||||
--referer REF specify a custom referer, use if the video access
|
--referer REF specify a custom referer, use if the video
|
||||||
is restricted to one domain
|
access is restricted to one domain
|
||||||
--list-extractors List all supported extractors and the URLs they
|
--list-extractors List all supported extractors and the URLs
|
||||||
would handle
|
they would handle
|
||||||
--extractor-descriptions Output descriptions of all supported extractors
|
--extractor-descriptions Output descriptions of all supported
|
||||||
--proxy URL Use the specified HTTP/HTTPS proxy. Pass in an
|
extractors
|
||||||
empty string (--proxy "") for direct connection
|
--proxy URL Use the specified HTTP/HTTPS proxy. Pass in
|
||||||
|
an empty string (--proxy "") for direct
|
||||||
|
connection
|
||||||
--no-check-certificate Suppress HTTPS certificate validation.
|
--no-check-certificate Suppress HTTPS certificate validation.
|
||||||
--cache-dir DIR Location in the filesystem where youtube-dl can
|
--cache-dir DIR Location in the filesystem where youtube-dl
|
||||||
store some downloaded information permanently. By
|
can store some downloaded information
|
||||||
default $XDG_CACHE_HOME/youtube-dl or ~/.cache
|
permanently. By default $XDG_CACHE_HOME
|
||||||
/youtube-dl . At the moment, only YouTube player
|
/youtube-dl or ~/.cache/youtube-dl . At the
|
||||||
files (for videos with obfuscated signatures) are
|
moment, only YouTube player files (for
|
||||||
|
videos with obfuscated signatures) are
|
||||||
cached, but that may change.
|
cached, but that may change.
|
||||||
--no-cache-dir Disable filesystem caching
|
--no-cache-dir Disable filesystem caching
|
||||||
--socket-timeout None Time to wait before giving up, in seconds
|
--socket-timeout None Time to wait before giving up, in seconds
|
||||||
--bidi-workaround Work around terminals that lack bidirectional
|
--bidi-workaround Work around terminals that lack
|
||||||
text support. Requires bidiv or fribidi
|
bidirectional text support. Requires bidiv
|
||||||
executable in PATH
|
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
|
||||||
|
SIZE (e.g. 50k or 44.6m)
|
||||||
|
--max-filesize SIZE Do not download any videos larger than SIZE
|
||||||
(e.g. 50k or 44.6m)
|
(e.g. 50k or 44.6m)
|
||||||
--max-filesize SIZE Do not download any videos larger than SIZE (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 before this date
|
--datebefore DATE download only videos uploaded on or before
|
||||||
--dateafter DATE download only videos uploaded after this date
|
this date (i.e. inclusive)
|
||||||
--min-views COUNT Do not download any videos with less than COUNT
|
--dateafter DATE download only videos uploaded on or after
|
||||||
views
|
this date (i.e. inclusive)
|
||||||
--max-views COUNT Do not download any videos with more 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 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 date
|
"HD"), %(format_id)s for the unique id of
|
||||||
|
the format (like Youtube's itags: "137"),
|
||||||
|
%(upload_date)s for the upload date
|
||||||
(YYYYMMDD), %(extractor)s for the provider
|
(YYYYMMDD), %(extractor)s for the provider
|
||||||
(youtube, metacafe, etc), %(id)s for the video id
|
(youtube, metacafe, etc), %(id)s for the
|
||||||
, %(playlist)s for the playlist the video is in,
|
video id, %(playlist)s for the playlist the
|
||||||
%(playlist_index)s for the position in the
|
video is in, %(playlist_index)s for the
|
||||||
playlist and %% for a literal percent. Use - to
|
position in the playlist and %% for a
|
||||||
output to stdout. Can also be used to download to
|
literal percent. Use - to output to stdout.
|
||||||
a different directory, for example with -o '/my/d
|
Can also be used to download to a different
|
||||||
ownloads/%(uploader)s/%(title)s-%(id)s.%(ext)s' .
|
directory, for example with -o '/my/downloa
|
||||||
--autonumber-size NUMBER Specifies the number of digits in %(autonumber)s
|
ds/%(uploader)s/%(title)s-%(id)s.%(ext)s' .
|
||||||
when it is present in output filename template or
|
--autonumber-size NUMBER Specifies the number of digits in
|
||||||
--auto-number option is given
|
%(autonumber)s when it is present in output
|
||||||
--restrict-filenames Restrict filenames to only ASCII characters, and
|
filename template or --auto-number option
|
||||||
avoid "&" and spaces in filenames
|
is given
|
||||||
-a, --batch-file FILE file containing URLs to download ('-' for stdin)
|
--restrict-filenames Restrict filenames to only ASCII
|
||||||
|
characters, and avoid "&" and spaces in
|
||||||
|
filenames
|
||||||
|
-a, --batch-file FILE file containing URLs to download ('-' for
|
||||||
|
stdin)
|
||||||
--load-info FILE json file containing the video information
|
--load-info FILE json file containing the video information
|
||||||
(created with the "--write-json" option
|
(created with the "--write-json" option)
|
||||||
-w, --no-overwrites do not overwrite files
|
-w, --no-overwrites do not overwrite files
|
||||||
-c, --continue force resume of partially downloaded files. By
|
-c, --continue force resume of partially downloaded files.
|
||||||
default, youtube-dl will resume downloads if
|
By default, youtube-dl will resume
|
||||||
possible.
|
downloads if possible.
|
||||||
--no-continue do not resume partially downloaded files (restart
|
--no-continue do not resume partially downloaded files
|
||||||
from beginning)
|
(restart from beginning)
|
||||||
--cookies FILE file to read cookies from and dump cookie jar in
|
--cookies FILE file to read cookies from and dump cookie
|
||||||
|
jar in
|
||||||
--no-part do not use .part files
|
--no-part do not use .part files
|
||||||
--no-mtime do not use the Last-modified header to set the
|
--no-mtime do not use the Last-modified header to set
|
||||||
file modification time
|
the file modification time
|
||||||
--write-description write video description to a .description file
|
--write-description write video description to a .description
|
||||||
|
file
|
||||||
--write-info-json write video metadata to a .info.json file
|
--write-info-json write video metadata to a .info.json file
|
||||||
--write-annotations write video annotations to a .annotation file
|
--write-annotations write video annotations to a .annotation
|
||||||
|
file
|
||||||
--write-thumbnail write thumbnail image to disk
|
--write-thumbnail write thumbnail image to disk
|
||||||
|
|
||||||
## Verbosity / Simulation Options:
|
## Verbosity / Simulation Options:
|
||||||
@@ -143,59 +169,74 @@ which means you can modify it, redistribute it or use it however you like.
|
|||||||
--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.
|
||||||
|
You can also use the special names "best",
|
||||||
|
"bestaudio", "worst", and "worstaudio". By
|
||||||
|
default, youtube-dl will pick the best
|
||||||
|
quality.
|
||||||
--all-formats download all available video formats
|
--all-formats download all available video formats
|
||||||
--prefer-free-formats prefer free video formats unless a specific one
|
--prefer-free-formats prefer free video formats unless a specific
|
||||||
is requested
|
one is requested
|
||||||
--max-quality FORMAT highest quality format to download
|
--max-quality FORMAT highest quality format to download
|
||||||
-F, --list-formats list all available formats (currently youtube
|
-F, --list-formats list all available formats
|
||||||
only)
|
|
||||||
|
|
||||||
## 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
|
|
||||||
video
|
|
||||||
--list-subs lists all available subtitles for the video
|
|
||||||
--sub-format FORMAT subtitle format (default=srt) ([sbv/vtt] youtube
|
|
||||||
only)
|
only)
|
||||||
--sub-lang LANGS languages of the subtitles to download (optional)
|
--all-subs downloads all the available subtitles of
|
||||||
separated by commas, use IETF language tags like
|
the video
|
||||||
'en,pt'
|
--list-subs lists all available subtitles for the video
|
||||||
|
--sub-format FORMAT subtitle format (default=srt) ([sbv/vtt]
|
||||||
|
youtube only)
|
||||||
|
--sub-lang LANGS languages of the subtitles to download
|
||||||
|
(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 only)
|
--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
|
||||||
|
post-processing; the video is erased by
|
||||||
|
default
|
||||||
|
--no-post-overwrites do not overwrite post-processed files; the
|
||||||
|
post-processed files are overwritten by
|
||||||
|
default
|
||||||
--embed-subs embed subtitles in the video (only for mp4
|
--embed-subs embed subtitles in the video (only for mp4
|
||||||
videos)
|
videos)
|
||||||
--add-metadata write metadata to the video file
|
--add-metadata write metadata to the video file
|
||||||
--xattrs write metadata to the video file's xattrs (using
|
--xattrs write metadata to the video file's xattrs
|
||||||
dublin core and xdg standards)
|
(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
|
||||||
|
|
||||||
@@ -234,9 +275,12 @@ Videos can be filtered by their upload date using the options `--date`, `--dateb
|
|||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
$ youtube-dl --dateafter now-6months #will only download the videos uploaded in the last 6 months
|
$ # Download only the videos uploaded in the last 6 months
|
||||||
$ youtube-dl --date 19700101 #will only download the videos uploaded in January 1, 1970
|
$ youtube-dl --dateafter now-6months
|
||||||
$ youtube-dl --dateafter 20000101 --datebefore 20100101 #will only download the videos uploaded between 2000 and 2010
|
$ # Download only the videos uploaded on January 1, 1970
|
||||||
|
$ youtube-dl --date 19700101
|
||||||
|
$ # will only download the videos uploaded in the 200x decade
|
||||||
|
$ youtube-dl --dateafter 20000101 --datebefore 20091231
|
||||||
|
|
||||||
# FAQ
|
# FAQ
|
||||||
|
|
||||||
@@ -281,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
|
||||||
|
|
||||||
@@ -315,7 +375,7 @@ Site support requests must contain an example URL. An example URL is a URL you m
|
|||||||
|
|
||||||
### Are you using the latest version?
|
### Are you using the latest version?
|
||||||
|
|
||||||
Before reporting any issue, type youtube-dl -U. This should report that you're up-to-date. Ábout 20% of the reports we receive are already fixed, but people are using outdated versions. This goes for feature requests as well.
|
Before reporting any issue, type youtube-dl -U. This should report that you're up-to-date. About 20% of the reports we receive are already fixed, but people are using outdated versions. This goes for feature requests as well.
|
||||||
|
|
||||||
### Is the issue already documented?
|
### Is the issue already documented?
|
||||||
|
|
||||||
@@ -344,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.
|
||||||
|
@@ -3,6 +3,9 @@
|
|||||||
"""
|
"""
|
||||||
This script employs a VERY basic heuristic ('porn' in webpage.lower()) to check
|
This script employs a VERY basic heuristic ('porn' in webpage.lower()) to check
|
||||||
if we are not 'age_limit' tagging some porn site
|
if we are not 'age_limit' tagging some porn site
|
||||||
|
|
||||||
|
A second approach implemented relies on a list of porn domains, to activate it
|
||||||
|
pass the list filename as the only argument
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Allow direct execution
|
# Allow direct execution
|
||||||
@@ -11,9 +14,17 @@ import sys
|
|||||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
||||||
from test.helper import get_testcases
|
from test.helper import get_testcases
|
||||||
|
from youtube_dl.utils import compat_urllib_parse_urlparse
|
||||||
from youtube_dl.utils import compat_urllib_request
|
from youtube_dl.utils import compat_urllib_request
|
||||||
|
|
||||||
|
if len(sys.argv) > 1:
|
||||||
|
METHOD = 'LIST'
|
||||||
|
LIST = open(sys.argv[1]).read().decode('utf8').strip()
|
||||||
|
else:
|
||||||
|
METHOD = 'EURISTIC'
|
||||||
|
|
||||||
for test in get_testcases():
|
for test in get_testcases():
|
||||||
|
if METHOD == 'EURISTIC':
|
||||||
try:
|
try:
|
||||||
webpage = compat_urllib_request.urlopen(test['url'], timeout=10).read()
|
webpage = compat_urllib_request.urlopen(test['url'], timeout=10).read()
|
||||||
except:
|
except:
|
||||||
@@ -22,14 +33,23 @@ for test in get_testcases():
|
|||||||
|
|
||||||
webpage = webpage.decode('utf8', 'replace')
|
webpage = webpage.decode('utf8', 'replace')
|
||||||
|
|
||||||
if 'porn' in webpage.lower() and ('info_dict' not in test
|
RESULT = 'porn' in webpage.lower()
|
||||||
or 'age_limit' not in test['info_dict']
|
|
||||||
|
elif METHOD == 'LIST':
|
||||||
|
domain = compat_urllib_parse_urlparse(test['url']).netloc
|
||||||
|
if not domain:
|
||||||
|
print('\nFail: {0}'.format(test['name']))
|
||||||
|
continue
|
||||||
|
domain = '.'.join(domain.split('.')[-2:])
|
||||||
|
|
||||||
|
RESULT = ('.' + domain + '\n' in LIST or '\n' + domain + '\n' in LIST)
|
||||||
|
|
||||||
|
if RESULT and ('info_dict' not in test or 'age_limit' not in test['info_dict']
|
||||||
or test['info_dict']['age_limit'] != 18):
|
or test['info_dict']['age_limit'] != 18):
|
||||||
print('\nPotential missing age_limit check: {0}'.format(test['name']))
|
print('\nPotential missing age_limit check: {0}'.format(test['name']))
|
||||||
|
|
||||||
elif 'porn' not in webpage.lower() and ('info_dict' in test and
|
elif not RESULT and ('info_dict' in test and 'age_limit' in test['info_dict']
|
||||||
'age_limit' in test['info_dict'] and
|
and test['info_dict']['age_limit'] == 18):
|
||||||
test['info_dict']['age_limit'] == 18):
|
|
||||||
print('\nPotential false negative: {0}'.format(test['name']))
|
print('\nPotential false negative: {0}'.format(test['name']))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@@ -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__':
|
||||||
|
@@ -148,7 +148,7 @@ def generator(test_case):
|
|||||||
for key, value in info_dict.items()
|
for key, value in info_dict.items()
|
||||||
if value and key in ('title', 'description', 'uploader', 'upload_date', 'uploader_id', 'location'))
|
if value and key in ('title', 'description', 'uploader', 'upload_date', 'uploader_id', 'location'))
|
||||||
if not all(key in tc.get('info_dict', {}).keys() for key in test_info_dict.keys()):
|
if not all(key in tc.get('info_dict', {}).keys() for key in test_info_dict.keys()):
|
||||||
sys.stderr.write(u'\n"info_dict": ' + json.dumps(test_info_dict, ensure_ascii=False, indent=2) + u'\n')
|
sys.stderr.write(u'\n"info_dict": ' + json.dumps(test_info_dict, ensure_ascii=False, indent=4) + u'\n')
|
||||||
|
|
||||||
# Check for the presence of mandatory fields
|
# Check for the presence of mandatory fields
|
||||||
for key in ('id', 'url', 'title', 'ext'):
|
for key in ('id', 'url', 'title', 'ext'):
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
# Allow direct execution
|
# Allow direct execution
|
||||||
import os
|
import os
|
||||||
@@ -30,6 +31,8 @@ from youtube_dl.extractor import (
|
|||||||
SmotriUserIE,
|
SmotriUserIE,
|
||||||
IviCompilationIE,
|
IviCompilationIE,
|
||||||
ImdbListIE,
|
ImdbListIE,
|
||||||
|
KhanAcademyIE,
|
||||||
|
EveryonesMixtapeIE,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -43,7 +46,7 @@ class TestPlaylists(unittest.TestCase):
|
|||||||
ie = DailymotionPlaylistIE(dl)
|
ie = DailymotionPlaylistIE(dl)
|
||||||
result = ie.extract('http://www.dailymotion.com/playlist/xv4bw_nqtv_sport/1#video=xl8v3q')
|
result = ie.extract('http://www.dailymotion.com/playlist/xv4bw_nqtv_sport/1#video=xl8v3q')
|
||||||
self.assertIsPlaylist(result)
|
self.assertIsPlaylist(result)
|
||||||
self.assertEqual(result['title'], u'SPORT')
|
self.assertEqual(result['title'], 'SPORT')
|
||||||
self.assertTrue(len(result['entries']) > 20)
|
self.assertTrue(len(result['entries']) > 20)
|
||||||
|
|
||||||
def test_dailymotion_user(self):
|
def test_dailymotion_user(self):
|
||||||
@@ -51,7 +54,7 @@ class TestPlaylists(unittest.TestCase):
|
|||||||
ie = DailymotionUserIE(dl)
|
ie = DailymotionUserIE(dl)
|
||||||
result = ie.extract('http://www.dailymotion.com/user/generation-quoi/')
|
result = ie.extract('http://www.dailymotion.com/user/generation-quoi/')
|
||||||
self.assertIsPlaylist(result)
|
self.assertIsPlaylist(result)
|
||||||
self.assertEqual(result['title'], u'Génération Quoi')
|
self.assertEqual(result['title'], 'Génération Quoi')
|
||||||
self.assertTrue(len(result['entries']) >= 26)
|
self.assertTrue(len(result['entries']) >= 26)
|
||||||
|
|
||||||
def test_vimeo_channel(self):
|
def test_vimeo_channel(self):
|
||||||
@@ -59,7 +62,7 @@ class TestPlaylists(unittest.TestCase):
|
|||||||
ie = VimeoChannelIE(dl)
|
ie = VimeoChannelIE(dl)
|
||||||
result = ie.extract('http://vimeo.com/channels/tributes')
|
result = ie.extract('http://vimeo.com/channels/tributes')
|
||||||
self.assertIsPlaylist(result)
|
self.assertIsPlaylist(result)
|
||||||
self.assertEqual(result['title'], u'Vimeo Tributes')
|
self.assertEqual(result['title'], 'Vimeo Tributes')
|
||||||
self.assertTrue(len(result['entries']) > 24)
|
self.assertTrue(len(result['entries']) > 24)
|
||||||
|
|
||||||
def test_vimeo_user(self):
|
def test_vimeo_user(self):
|
||||||
@@ -67,7 +70,7 @@ class TestPlaylists(unittest.TestCase):
|
|||||||
ie = VimeoUserIE(dl)
|
ie = VimeoUserIE(dl)
|
||||||
result = ie.extract('http://vimeo.com/nkistudio/videos')
|
result = ie.extract('http://vimeo.com/nkistudio/videos')
|
||||||
self.assertIsPlaylist(result)
|
self.assertIsPlaylist(result)
|
||||||
self.assertEqual(result['title'], u'Nki')
|
self.assertEqual(result['title'], 'Nki')
|
||||||
self.assertTrue(len(result['entries']) > 65)
|
self.assertTrue(len(result['entries']) > 65)
|
||||||
|
|
||||||
def test_vimeo_album(self):
|
def test_vimeo_album(self):
|
||||||
@@ -75,7 +78,7 @@ class TestPlaylists(unittest.TestCase):
|
|||||||
ie = VimeoAlbumIE(dl)
|
ie = VimeoAlbumIE(dl)
|
||||||
result = ie.extract('http://vimeo.com/album/2632481')
|
result = ie.extract('http://vimeo.com/album/2632481')
|
||||||
self.assertIsPlaylist(result)
|
self.assertIsPlaylist(result)
|
||||||
self.assertEqual(result['title'], u'Staff Favorites: November 2013')
|
self.assertEqual(result['title'], 'Staff Favorites: November 2013')
|
||||||
self.assertTrue(len(result['entries']) > 12)
|
self.assertTrue(len(result['entries']) > 12)
|
||||||
|
|
||||||
def test_vimeo_groups(self):
|
def test_vimeo_groups(self):
|
||||||
@@ -83,7 +86,7 @@ class TestPlaylists(unittest.TestCase):
|
|||||||
ie = VimeoGroupsIE(dl)
|
ie = VimeoGroupsIE(dl)
|
||||||
result = ie.extract('http://vimeo.com/groups/rolexawards')
|
result = ie.extract('http://vimeo.com/groups/rolexawards')
|
||||||
self.assertIsPlaylist(result)
|
self.assertIsPlaylist(result)
|
||||||
self.assertEqual(result['title'], u'Rolex Awards for Enterprise')
|
self.assertEqual(result['title'], 'Rolex Awards for Enterprise')
|
||||||
self.assertTrue(len(result['entries']) > 72)
|
self.assertTrue(len(result['entries']) > 72)
|
||||||
|
|
||||||
def test_ustream_channel(self):
|
def test_ustream_channel(self):
|
||||||
@@ -91,7 +94,7 @@ class TestPlaylists(unittest.TestCase):
|
|||||||
ie = UstreamChannelIE(dl)
|
ie = UstreamChannelIE(dl)
|
||||||
result = ie.extract('http://www.ustream.tv/channel/young-americans-for-liberty')
|
result = ie.extract('http://www.ustream.tv/channel/young-americans-for-liberty')
|
||||||
self.assertIsPlaylist(result)
|
self.assertIsPlaylist(result)
|
||||||
self.assertEqual(result['id'], u'5124905')
|
self.assertEqual(result['id'], '5124905')
|
||||||
self.assertTrue(len(result['entries']) >= 11)
|
self.assertTrue(len(result['entries']) >= 11)
|
||||||
|
|
||||||
def test_soundcloud_set(self):
|
def test_soundcloud_set(self):
|
||||||
@@ -99,7 +102,7 @@ class TestPlaylists(unittest.TestCase):
|
|||||||
ie = SoundcloudSetIE(dl)
|
ie = SoundcloudSetIE(dl)
|
||||||
result = ie.extract('https://soundcloud.com/the-concept-band/sets/the-royal-concept-ep')
|
result = ie.extract('https://soundcloud.com/the-concept-band/sets/the-royal-concept-ep')
|
||||||
self.assertIsPlaylist(result)
|
self.assertIsPlaylist(result)
|
||||||
self.assertEqual(result['title'], u'The Royal Concept EP')
|
self.assertEqual(result['title'], 'The Royal Concept EP')
|
||||||
self.assertTrue(len(result['entries']) >= 6)
|
self.assertTrue(len(result['entries']) >= 6)
|
||||||
|
|
||||||
def test_soundcloud_user(self):
|
def test_soundcloud_user(self):
|
||||||
@@ -107,7 +110,7 @@ class TestPlaylists(unittest.TestCase):
|
|||||||
ie = SoundcloudUserIE(dl)
|
ie = SoundcloudUserIE(dl)
|
||||||
result = ie.extract('https://soundcloud.com/the-concept-band')
|
result = ie.extract('https://soundcloud.com/the-concept-band')
|
||||||
self.assertIsPlaylist(result)
|
self.assertIsPlaylist(result)
|
||||||
self.assertEqual(result['id'], u'9615865')
|
self.assertEqual(result['id'], '9615865')
|
||||||
self.assertTrue(len(result['entries']) >= 12)
|
self.assertTrue(len(result['entries']) >= 12)
|
||||||
|
|
||||||
def test_livestream_event(self):
|
def test_livestream_event(self):
|
||||||
@@ -115,7 +118,7 @@ class TestPlaylists(unittest.TestCase):
|
|||||||
ie = LivestreamIE(dl)
|
ie = LivestreamIE(dl)
|
||||||
result = ie.extract('http://new.livestream.com/tedx/cityenglish')
|
result = ie.extract('http://new.livestream.com/tedx/cityenglish')
|
||||||
self.assertIsPlaylist(result)
|
self.assertIsPlaylist(result)
|
||||||
self.assertEqual(result['title'], u'TEDCity2.0 (English)')
|
self.assertEqual(result['title'], 'TEDCity2.0 (English)')
|
||||||
self.assertTrue(len(result['entries']) >= 4)
|
self.assertTrue(len(result['entries']) >= 4)
|
||||||
|
|
||||||
def test_nhl_videocenter(self):
|
def test_nhl_videocenter(self):
|
||||||
@@ -123,8 +126,8 @@ class TestPlaylists(unittest.TestCase):
|
|||||||
ie = NHLVideocenterIE(dl)
|
ie = NHLVideocenterIE(dl)
|
||||||
result = ie.extract('http://video.canucks.nhl.com/videocenter/console?catid=999')
|
result = ie.extract('http://video.canucks.nhl.com/videocenter/console?catid=999')
|
||||||
self.assertIsPlaylist(result)
|
self.assertIsPlaylist(result)
|
||||||
self.assertEqual(result['id'], u'999')
|
self.assertEqual(result['id'], '999')
|
||||||
self.assertEqual(result['title'], u'Highlights')
|
self.assertEqual(result['title'], 'Highlights')
|
||||||
self.assertEqual(len(result['entries']), 12)
|
self.assertEqual(len(result['entries']), 12)
|
||||||
|
|
||||||
def test_bambuser_channel(self):
|
def test_bambuser_channel(self):
|
||||||
@@ -132,7 +135,7 @@ class TestPlaylists(unittest.TestCase):
|
|||||||
ie = BambuserChannelIE(dl)
|
ie = BambuserChannelIE(dl)
|
||||||
result = ie.extract('http://bambuser.com/channel/pixelversity')
|
result = ie.extract('http://bambuser.com/channel/pixelversity')
|
||||||
self.assertIsPlaylist(result)
|
self.assertIsPlaylist(result)
|
||||||
self.assertEqual(result['title'], u'pixelversity')
|
self.assertEqual(result['title'], 'pixelversity')
|
||||||
self.assertTrue(len(result['entries']) >= 60)
|
self.assertTrue(len(result['entries']) >= 60)
|
||||||
|
|
||||||
def test_bandcamp_album(self):
|
def test_bandcamp_album(self):
|
||||||
@@ -140,7 +143,7 @@ class TestPlaylists(unittest.TestCase):
|
|||||||
ie = BandcampAlbumIE(dl)
|
ie = BandcampAlbumIE(dl)
|
||||||
result = ie.extract('http://mpallante.bandcamp.com/album/nightmare-night-ep')
|
result = ie.extract('http://mpallante.bandcamp.com/album/nightmare-night-ep')
|
||||||
self.assertIsPlaylist(result)
|
self.assertIsPlaylist(result)
|
||||||
self.assertEqual(result['title'], u'Nightmare Night EP')
|
self.assertEqual(result['title'], 'Nightmare Night EP')
|
||||||
self.assertTrue(len(result['entries']) >= 4)
|
self.assertTrue(len(result['entries']) >= 4)
|
||||||
|
|
||||||
def test_smotri_community(self):
|
def test_smotri_community(self):
|
||||||
@@ -148,8 +151,8 @@ class TestPlaylists(unittest.TestCase):
|
|||||||
ie = SmotriCommunityIE(dl)
|
ie = SmotriCommunityIE(dl)
|
||||||
result = ie.extract('http://smotri.com/community/video/kommuna')
|
result = ie.extract('http://smotri.com/community/video/kommuna')
|
||||||
self.assertIsPlaylist(result)
|
self.assertIsPlaylist(result)
|
||||||
self.assertEqual(result['id'], u'kommuna')
|
self.assertEqual(result['id'], 'kommuna')
|
||||||
self.assertEqual(result['title'], u'КПРФ')
|
self.assertEqual(result['title'], 'КПРФ')
|
||||||
self.assertTrue(len(result['entries']) >= 4)
|
self.assertTrue(len(result['entries']) >= 4)
|
||||||
|
|
||||||
def test_smotri_user(self):
|
def test_smotri_user(self):
|
||||||
@@ -157,17 +160,17 @@ class TestPlaylists(unittest.TestCase):
|
|||||||
ie = SmotriUserIE(dl)
|
ie = SmotriUserIE(dl)
|
||||||
result = ie.extract('http://smotri.com/user/inspector')
|
result = ie.extract('http://smotri.com/user/inspector')
|
||||||
self.assertIsPlaylist(result)
|
self.assertIsPlaylist(result)
|
||||||
self.assertEqual(result['id'], u'inspector')
|
self.assertEqual(result['id'], 'inspector')
|
||||||
self.assertEqual(result['title'], u'Inspector')
|
self.assertEqual(result['title'], 'Inspector')
|
||||||
self.assertTrue(len(result['entries']) >= 9)
|
self.assertTrue(len(result['entries']) >= 9)
|
||||||
|
|
||||||
def test_AcademicEarthCourse(self):
|
def test_AcademicEarthCourse(self):
|
||||||
dl = FakeYDL()
|
dl = FakeYDL()
|
||||||
ie = AcademicEarthCourseIE(dl)
|
ie = AcademicEarthCourseIE(dl)
|
||||||
result = ie.extract(u'http://academicearth.org/courses/building-dynamic-websites/')
|
result = ie.extract('http://academicearth.org/courses/building-dynamic-websites/')
|
||||||
self.assertIsPlaylist(result)
|
self.assertIsPlaylist(result)
|
||||||
self.assertEqual(result['id'], u'building-dynamic-websites')
|
self.assertEqual(result['id'], 'building-dynamic-websites')
|
||||||
self.assertEqual(result['title'], u'Building Dynamic Websites')
|
self.assertEqual(result['title'], 'Building Dynamic Websites')
|
||||||
self.assertEqual(result['description'], u"Today's websites are increasingly dynamic. Pages are no longer static HTML files but instead generated by scripts and database calls. User interfaces are more seamless, with technologies like Ajax replacing traditional page reloads. This course teaches students how to build dynamic websites with Ajax and with Linux, Apache, MySQL, and PHP (LAMP), one of today's most popular frameworks. Students learn how to set up domain names with DNS, how to structure pages with XHTML and CSS, how to program in JavaScript and PHP, how to configure Apache and MySQL, how to design and query databases with SQL, how to use Ajax with both XML and JSON, and how to build mashups. The course explores issues of security, scalability, and cross-browser support and also discusses enterprise-level deployments of websites, including third-party hosting, virtualization, colocation in data centers, firewalling, and load-balancing.")
|
self.assertEqual(result['description'], u"Today's websites are increasingly dynamic. Pages are no longer static HTML files but instead generated by scripts and database calls. User interfaces are more seamless, with technologies like Ajax replacing traditional page reloads. This course teaches students how to build dynamic websites with Ajax and with Linux, Apache, MySQL, and PHP (LAMP), one of today's most popular frameworks. Students learn how to set up domain names with DNS, how to structure pages with XHTML and CSS, how to program in JavaScript and PHP, how to configure Apache and MySQL, how to design and query databases with SQL, how to use Ajax with both XML and JSON, and how to build mashups. The course explores issues of security, scalability, and cross-browser support and also discusses enterprise-level deployments of websites, including third-party hosting, virtualization, colocation in data centers, firewalling, and load-balancing.")
|
||||||
self.assertEqual(len(result['entries']), 10)
|
self.assertEqual(len(result['entries']), 10)
|
||||||
|
|
||||||
@@ -176,8 +179,8 @@ class TestPlaylists(unittest.TestCase):
|
|||||||
ie = IviCompilationIE(dl)
|
ie = IviCompilationIE(dl)
|
||||||
result = ie.extract('http://www.ivi.ru/watch/dezhurnyi_angel')
|
result = ie.extract('http://www.ivi.ru/watch/dezhurnyi_angel')
|
||||||
self.assertIsPlaylist(result)
|
self.assertIsPlaylist(result)
|
||||||
self.assertEqual(result['id'], u'dezhurnyi_angel')
|
self.assertEqual(result['id'], 'dezhurnyi_angel')
|
||||||
self.assertEqual(result['title'], u'Дежурный ангел (2010 - 2012)')
|
self.assertEqual(result['title'], 'Дежурный ангел (2010 - 2012)')
|
||||||
self.assertTrue(len(result['entries']) >= 36)
|
self.assertTrue(len(result['entries']) >= 36)
|
||||||
|
|
||||||
def test_ivi_compilation_season(self):
|
def test_ivi_compilation_season(self):
|
||||||
@@ -185,8 +188,8 @@ class TestPlaylists(unittest.TestCase):
|
|||||||
ie = IviCompilationIE(dl)
|
ie = IviCompilationIE(dl)
|
||||||
result = ie.extract('http://www.ivi.ru/watch/dezhurnyi_angel/season2')
|
result = ie.extract('http://www.ivi.ru/watch/dezhurnyi_angel/season2')
|
||||||
self.assertIsPlaylist(result)
|
self.assertIsPlaylist(result)
|
||||||
self.assertEqual(result['id'], u'dezhurnyi_angel/season2')
|
self.assertEqual(result['id'], 'dezhurnyi_angel/season2')
|
||||||
self.assertEqual(result['title'], u'Дежурный ангел (2010 - 2012) 2 сезон')
|
self.assertEqual(result['title'], 'Дежурный ангел (2010 - 2012) 2 сезон')
|
||||||
self.assertTrue(len(result['entries']) >= 20)
|
self.assertTrue(len(result['entries']) >= 20)
|
||||||
|
|
||||||
def test_imdb_list(self):
|
def test_imdb_list(self):
|
||||||
@@ -194,10 +197,29 @@ class TestPlaylists(unittest.TestCase):
|
|||||||
ie = ImdbListIE(dl)
|
ie = ImdbListIE(dl)
|
||||||
result = ie.extract('http://www.imdb.com/list/sMjedvGDd8U')
|
result = ie.extract('http://www.imdb.com/list/sMjedvGDd8U')
|
||||||
self.assertIsPlaylist(result)
|
self.assertIsPlaylist(result)
|
||||||
self.assertEqual(result['id'], u'sMjedvGDd8U')
|
self.assertEqual(result['id'], 'sMjedvGDd8U')
|
||||||
self.assertEqual(result['title'], u'Animated and Family Films')
|
self.assertEqual(result['title'], 'Animated and Family Films')
|
||||||
self.assertTrue(len(result['entries']) >= 48)
|
self.assertTrue(len(result['entries']) >= 48)
|
||||||
|
|
||||||
|
def test_khanacademy_topic(self):
|
||||||
|
dl = FakeYDL()
|
||||||
|
ie = KhanAcademyIE(dl)
|
||||||
|
result = ie.extract('https://www.khanacademy.org/math/applied-math/cryptography')
|
||||||
|
self.assertIsPlaylist(result)
|
||||||
|
self.assertEqual(result['id'], 'cryptography')
|
||||||
|
self.assertEqual(result['title'], 'Journey into cryptography')
|
||||||
|
self.assertEqual(result['description'], 'How have humans protected their secret messages through history? What has changed today?')
|
||||||
|
self.assertTrue(len(result['entries']) >= 3)
|
||||||
|
|
||||||
|
def test_EveryonesMixtape(self):
|
||||||
|
dl = FakeYDL()
|
||||||
|
ie = EveryonesMixtapeIE(dl)
|
||||||
|
result = ie.extract('http://everyonesmixtape.com/#/mix/m7m0jJAbMQi')
|
||||||
|
self.assertIsPlaylist(result)
|
||||||
|
self.assertEqual(result['id'], 'm7m0jJAbMQi')
|
||||||
|
self.assertEqual(result['title'], 'Driving')
|
||||||
|
self.assertEqual(len(result['entries']), 24)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.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()
|
||||||
|
@@ -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,11 +152,18 @@ 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:
|
||||||
nopart, updatetime, buffersize, ratelimit, min_filesize, max_filesize, test,
|
nopart, updatetime, buffersize, ratelimit, min_filesize, max_filesize, test,
|
||||||
noresizebuffer, retries, continuedl, noprogress, consoletitle
|
noresizebuffer, retries, continuedl, noprogress, consoletitle
|
||||||
|
|
||||||
|
The following options are used by the post processors:
|
||||||
|
prefer_ffmpeg: If True, use ffmpeg instead of avconv if both are available,
|
||||||
|
otherwise prefer avconv.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
params = None
|
params = None
|
||||||
@@ -388,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:
|
||||||
@@ -509,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()))
|
||||||
@@ -571,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
|
||||||
|
|
||||||
|
if isinstance(ie_result['entries'], list):
|
||||||
|
n_all_entries = len(ie_result['entries'])
|
||||||
entries = ie_result['entries'][playliststart:playlistend]
|
entries = ie_result['entries'][playliststart:playlistend]
|
||||||
n_entries = len(entries)
|
n_entries = len(entries)
|
||||||
|
|
||||||
self.to_screen(
|
self.to_screen(
|
||||||
"[%s] playlist '%s': Collected %d video ids (downloading %d of them)" %
|
"[%s] playlist %s: Collected %d video ids (downloading %d of them)" %
|
||||||
(ie_result['extractor'], playlist, n_all_entries, n_entries))
|
(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))
|
||||||
@@ -630,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:
|
||||||
@@ -694,7 +720,7 @@ class YoutubeDL(object):
|
|||||||
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 = []
|
||||||
@@ -743,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:
|
||||||
@@ -761,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)
|
||||||
|
|
||||||
@@ -904,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)
|
||||||
@@ -912,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
|
||||||
@@ -1060,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:
|
||||||
@@ -1072,6 +1112,9 @@ class YoutubeDL(object):
|
|||||||
if fdict.get('acodec') is not None:
|
if fdict.get('acodec') is not None:
|
||||||
if res:
|
if res:
|
||||||
res += ', '
|
res += ', '
|
||||||
|
if fdict['acodec'] == 'none':
|
||||||
|
res += 'video only'
|
||||||
|
else:
|
||||||
res += '%-5s' % fdict['acodec']
|
res += '%-5s' % fdict['acodec']
|
||||||
elif fdict.get('abr') is not None:
|
elif fdict.get('abr') is not None:
|
||||||
if res:
|
if res:
|
||||||
@@ -1079,6 +1122,8 @@ class YoutubeDL(object):
|
|||||||
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,7 @@ __authors__ = (
|
|||||||
'Sergey M.',
|
'Sergey M.',
|
||||||
'Michael Orlitzky',
|
'Michael Orlitzky',
|
||||||
'Chris Gahan',
|
'Chris Gahan',
|
||||||
|
'Saimadhav Heblikar',
|
||||||
)
|
)
|
||||||
|
|
||||||
__license__ = 'Public Domain'
|
__license__ = 'Public Domain'
|
||||||
@@ -198,7 +199,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',
|
||||||
@@ -216,8 +219,12 @@ def parseOpts(overrideArguments=None):
|
|||||||
selection.add_option('--min-filesize', metavar='SIZE', dest='min_filesize', help="Do not download any videos smaller than SIZE (e.g. 50k or 44.6m)", default=None)
|
selection.add_option('--min-filesize', metavar='SIZE', dest='min_filesize', help="Do not download any videos smaller than SIZE (e.g. 50k or 44.6m)", default=None)
|
||||||
selection.add_option('--max-filesize', metavar='SIZE', dest='max_filesize', help="Do not download any videos larger than SIZE (e.g. 50k or 44.6m)", default=None)
|
selection.add_option('--max-filesize', metavar='SIZE', dest='max_filesize', help="Do not download any videos larger than SIZE (e.g. 50k or 44.6m)", default=None)
|
||||||
selection.add_option('--date', metavar='DATE', dest='date', help='download only videos uploaded in this date', default=None)
|
selection.add_option('--date', metavar='DATE', dest='date', help='download only videos uploaded in this date', default=None)
|
||||||
selection.add_option('--datebefore', metavar='DATE', dest='datebefore', help='download only videos uploaded before this date', default=None)
|
selection.add_option(
|
||||||
selection.add_option('--dateafter', metavar='DATE', dest='dateafter', help='download only videos uploaded after this date', default=None)
|
'--datebefore', metavar='DATE', dest='datebefore', default=None,
|
||||||
|
help='download only videos uploaded on or before this date (i.e. inclusive)')
|
||||||
|
selection.add_option(
|
||||||
|
'--dateafter', metavar='DATE', dest='dateafter', default=None,
|
||||||
|
help='download only videos uploaded on or after this date (i.e. inclusive)')
|
||||||
selection.add_option(
|
selection.add_option(
|
||||||
'--min-views', metavar='COUNT', dest='min_views',
|
'--min-views', metavar='COUNT', dest='min_views',
|
||||||
default=None, type=int,
|
default=None, type=int,
|
||||||
@@ -233,7 +240,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')
|
||||||
@@ -242,12 +256,12 @@ def parseOpts(overrideArguments=None):
|
|||||||
authentication.add_option('-n', '--netrc',
|
authentication.add_option('-n', '--netrc',
|
||||||
action='store_true', dest='usenetrc', help='use .netrc authentication data', default=False)
|
action='store_true', dest='usenetrc', help='use .netrc authentication data', default=False)
|
||||||
authentication.add_option('--video-password',
|
authentication.add_option('--video-password',
|
||||||
dest='videopassword', metavar='PASSWORD', help='video password (vimeo only)')
|
dest='videopassword', metavar='PASSWORD', help='video password (vimeo, smotri)')
|
||||||
|
|
||||||
|
|
||||||
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',
|
||||||
@@ -255,7 +269,7 @@ def parseOpts(overrideArguments=None):
|
|||||||
video_format.add_option('--max-quality',
|
video_format.add_option('--max-quality',
|
||||||
action='store', dest='format_limit', metavar='FORMAT', help='highest quality format to download')
|
action='store', dest='format_limit', metavar='FORMAT', help='highest quality format to download')
|
||||||
video_format.add_option('-F', '--list-formats',
|
video_format.add_option('-F', '--list-formats',
|
||||||
action='store_true', dest='listformats', help='list all available formats (currently youtube only)')
|
action='store_true', dest='listformats', help='list all available formats')
|
||||||
|
|
||||||
subtitles.add_option('--write-sub', '--write-srt',
|
subtitles.add_option('--write-sub', '--write-srt',
|
||||||
action='store_true', dest='writesubtitles',
|
action='store_true', dest='writesubtitles',
|
||||||
@@ -338,7 +352,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)
|
||||||
@@ -373,7 +388,7 @@ def parseOpts(overrideArguments=None):
|
|||||||
dest='batchfile', metavar='FILE', help='file containing URLs to download (\'-\' for stdin)')
|
dest='batchfile', metavar='FILE', help='file containing URLs to download (\'-\' for stdin)')
|
||||||
filesystem.add_option('--load-info',
|
filesystem.add_option('--load-info',
|
||||||
dest='load_info_filename', metavar='FILE',
|
dest='load_info_filename', metavar='FILE',
|
||||||
help='json file containing the video information (created with the "--write-json" option')
|
help='json file containing the video information (created with the "--write-json" option)')
|
||||||
filesystem.add_option('-w', '--no-overwrites',
|
filesystem.add_option('-w', '--no-overwrites',
|
||||||
action='store_true', dest='nooverwrites', help='do not overwrite files', default=False)
|
action='store_true', dest='nooverwrites', help='do not overwrite files', default=False)
|
||||||
filesystem.add_option('-c', '--continue',
|
filesystem.add_option('-c', '--continue',
|
||||||
@@ -420,6 +435,10 @@ def parseOpts(overrideArguments=None):
|
|||||||
help='write metadata to the video file')
|
help='write metadata to the video file')
|
||||||
postproc.add_option('--xattrs', action='store_true', dest='xattrs', default=False,
|
postproc.add_option('--xattrs', action='store_true', dest='xattrs', default=False,
|
||||||
help='write metadata to the video file\'s xattrs (using dublin core and xdg standards)')
|
help='write metadata to the video file\'s xattrs (using dublin core and xdg standards)')
|
||||||
|
postproc.add_option('--prefer-avconv', action='store_false', dest='prefer_ffmpeg',
|
||||||
|
help='Prefer avconv over ffmpeg for running the postprocessors (default)')
|
||||||
|
postproc.add_option('--prefer-ffmpeg', action='store_true', dest='prefer_ffmpeg',
|
||||||
|
help='Prefer ffmpeg over avconv for running the postprocessors')
|
||||||
|
|
||||||
|
|
||||||
parser.add_option_group(general)
|
parser.add_option_group(general)
|
||||||
@@ -607,6 +626,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.
|
||||||
@@ -631,6 +656,7 @@ def _real_main(argv=None):
|
|||||||
u' template'.format(outtmpl))
|
u' template'.format(outtmpl))
|
||||||
|
|
||||||
any_printing = opts.geturl or opts.gettitle or opts.getid or opts.getthumbnail or opts.getdescription or opts.getfilename or opts.getformat or opts.getduration or opts.dumpjson
|
any_printing = opts.geturl or opts.gettitle or opts.getid or opts.getthumbnail or opts.getdescription or opts.getfilename or opts.getformat or opts.getduration or opts.dumpjson
|
||||||
|
download_archive_fn = os.path.expanduser(opts.download_archive) if opts.download_archive is not None else opts.download_archive
|
||||||
|
|
||||||
ydl_opts = {
|
ydl_opts = {
|
||||||
'usenetrc': opts.usenetrc,
|
'usenetrc': opts.usenetrc,
|
||||||
@@ -698,13 +724,17 @@ def _real_main(argv=None):
|
|||||||
'cachedir': opts.cachedir,
|
'cachedir': opts.cachedir,
|
||||||
'youtube_print_sig_code': opts.youtube_print_sig_code,
|
'youtube_print_sig_code': opts.youtube_print_sig_code,
|
||||||
'age_limit': opts.age_limit,
|
'age_limit': opts.age_limit,
|
||||||
'download_archive': opts.download_archive,
|
'download_archive': download_archive_fn,
|
||||||
'cookiefile': opts.cookiefile,
|
'cookiefile': opts.cookiefile,
|
||||||
'nocheckcertificate': opts.no_check_certificate,
|
'nocheckcertificate': opts.no_check_certificate,
|
||||||
'proxy': opts.proxy,
|
'proxy': opts.proxy,
|
||||||
'socket_timeout': opts.socket_timeout,
|
'socket_timeout': opts.socket_timeout,
|
||||||
'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,
|
||||||
|
'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:
|
||||||
|
@@ -29,7 +29,7 @@ class HlsFD(FileDownloader):
|
|||||||
retval = subprocess.call(cmd)
|
retval = subprocess.call(cmd)
|
||||||
if retval == 0:
|
if retval == 0:
|
||||||
fsize = os.path.getsize(encodeFilename(tmpfilename))
|
fsize = os.path.getsize(encodeFilename(tmpfilename))
|
||||||
self.to_screen(u'\r[%s] %s bytes' % (args[0], fsize))
|
self.to_screen(u'\r[%s] %s bytes' % (cmd[0], fsize))
|
||||||
self.try_rename(tmpfilename, filename)
|
self.try_rename(tmpfilename, filename)
|
||||||
self._hook_progress({
|
self._hook_progress({
|
||||||
'downloaded_bytes': fsize,
|
'downloaded_bytes': fsize,
|
||||||
|
@@ -47,11 +47,13 @@ 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 .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
|
||||||
from .eitb import EitbIE
|
from .eitb import EitbIE
|
||||||
from .escapist import EscapistIE
|
from .escapist import EscapistIE
|
||||||
|
from .everyonesmixtape import EveryonesMixtapeIE
|
||||||
from .exfm import ExfmIE
|
from .exfm import ExfmIE
|
||||||
from .extremetube import ExtremeTubeIE
|
from .extremetube import ExtremeTubeIE
|
||||||
from .facebook import FacebookIE
|
from .facebook import FacebookIE
|
||||||
@@ -61,11 +63,13 @@ 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,
|
||||||
FranceTVIE,
|
FranceTVIE,
|
||||||
GenerationQuoiIE
|
GenerationQuoiIE,
|
||||||
|
CultureboxIE,
|
||||||
)
|
)
|
||||||
from .freesound import FreesoundIE
|
from .freesound import FreesoundIE
|
||||||
from .funnyordie import FunnyOrDieIE
|
from .funnyordie import FunnyOrDieIE
|
||||||
@@ -98,6 +102,7 @@ from .justintv import JustinTVIE
|
|||||||
from .jpopsukitv import JpopsukiIE
|
from .jpopsukitv import JpopsukiIE
|
||||||
from .kankan import KankanIE
|
from .kankan import KankanIE
|
||||||
from .keezmovies import KeezMoviesIE
|
from .keezmovies import KeezMoviesIE
|
||||||
|
from .khanacademy import KhanAcademyIE
|
||||||
from .kickstarter import KickStarterIE
|
from .kickstarter import KickStarterIE
|
||||||
from .keek import KeekIE
|
from .keek import KeekIE
|
||||||
from .liveleak import LiveLeakIE
|
from .liveleak import LiveLeakIE
|
||||||
@@ -114,7 +119,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
|
||||||
@@ -127,6 +135,8 @@ from .newgrounds import NewgroundsIE
|
|||||||
from .nhl import NHLIE, NHLVideocenterIE
|
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 .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
|
||||||
@@ -146,6 +156,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
|
||||||
@@ -164,6 +175,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
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
@@ -5,7 +6,7 @@ from .common import InfoExtractor
|
|||||||
|
|
||||||
class AcademicEarthCourseIE(InfoExtractor):
|
class AcademicEarthCourseIE(InfoExtractor):
|
||||||
_VALID_URL = r'^https?://(?:www\.)?academicearth\.org/(?:courses|playlists)/(?P<id>[^?#/]+)'
|
_VALID_URL = r'^https?://(?:www\.)?academicearth\.org/(?:courses|playlists)/(?P<id>[^?#/]+)'
|
||||||
IE_NAME = u'AcademicEarth:Course'
|
IE_NAME = 'AcademicEarth:Course'
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
m = re.match(self._VALID_URL, url)
|
m = re.match(self._VALID_URL, url)
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import json
|
import json
|
||||||
|
|
||||||
@@ -11,46 +13,46 @@ from ..utils import (
|
|||||||
class AppleTrailersIE(InfoExtractor):
|
class AppleTrailersIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?trailers\.apple\.com/trailers/(?P<company>[^/]+)/(?P<movie>[^/]+)'
|
_VALID_URL = r'https?://(?:www\.)?trailers\.apple\.com/trailers/(?P<company>[^/]+)/(?P<movie>[^/]+)'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u"url": u"http://trailers.apple.com/trailers/wb/manofsteel/",
|
"url": "http://trailers.apple.com/trailers/wb/manofsteel/",
|
||||||
u"playlist": [
|
"playlist": [
|
||||||
{
|
{
|
||||||
u"file": u"manofsteel-trailer4.mov",
|
"file": "manofsteel-trailer4.mov",
|
||||||
u"md5": u"d97a8e575432dbcb81b7c3acb741f8a8",
|
"md5": "d97a8e575432dbcb81b7c3acb741f8a8",
|
||||||
u"info_dict": {
|
"info_dict": {
|
||||||
u"duration": 111,
|
"duration": 111,
|
||||||
u"title": u"Trailer 4",
|
"title": "Trailer 4",
|
||||||
u"upload_date": u"20130523",
|
"upload_date": "20130523",
|
||||||
u"uploader_id": u"wb",
|
"uploader_id": "wb",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
u"file": u"manofsteel-trailer3.mov",
|
"file": "manofsteel-trailer3.mov",
|
||||||
u"md5": u"b8017b7131b721fb4e8d6f49e1df908c",
|
"md5": "b8017b7131b721fb4e8d6f49e1df908c",
|
||||||
u"info_dict": {
|
"info_dict": {
|
||||||
u"duration": 182,
|
"duration": 182,
|
||||||
u"title": u"Trailer 3",
|
"title": "Trailer 3",
|
||||||
u"upload_date": u"20130417",
|
"upload_date": "20130417",
|
||||||
u"uploader_id": u"wb",
|
"uploader_id": "wb",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
u"file": u"manofsteel-trailer.mov",
|
"file": "manofsteel-trailer.mov",
|
||||||
u"md5": u"d0f1e1150989b9924679b441f3404d48",
|
"md5": "d0f1e1150989b9924679b441f3404d48",
|
||||||
u"info_dict": {
|
"info_dict": {
|
||||||
u"duration": 148,
|
"duration": 148,
|
||||||
u"title": u"Trailer",
|
"title": "Trailer",
|
||||||
u"upload_date": u"20121212",
|
"upload_date": "20121212",
|
||||||
u"uploader_id": u"wb",
|
"uploader_id": "wb",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
u"file": u"manofsteel-teaser.mov",
|
"file": "manofsteel-teaser.mov",
|
||||||
u"md5": u"5fe08795b943eb2e757fa95cb6def1cb",
|
"md5": "5fe08795b943eb2e757fa95cb6def1cb",
|
||||||
u"info_dict": {
|
"info_dict": {
|
||||||
u"duration": 93,
|
"duration": 93,
|
||||||
u"title": u"Teaser",
|
"title": "Teaser",
|
||||||
u"upload_date": u"20120721",
|
"upload_date": "20120721",
|
||||||
u"uploader_id": u"wb",
|
"uploader_id": "wb",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@@ -1,9 +1,10 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
determine_ext,
|
|
||||||
unified_strdate,
|
unified_strdate,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -13,23 +14,22 @@ class ArchiveOrgIE(InfoExtractor):
|
|||||||
IE_DESC = 'archive.org videos'
|
IE_DESC = 'archive.org videos'
|
||||||
_VALID_URL = r'(?:https?://)?(?:www\.)?archive\.org/details/(?P<id>[^?/]+)(?:[?].*)?$'
|
_VALID_URL = r'(?:https?://)?(?:www\.)?archive\.org/details/(?P<id>[^?/]+)(?:[?].*)?$'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u"url": u"http://archive.org/details/XD300-23_68HighlightsAResearchCntAugHumanIntellect",
|
"url": "http://archive.org/details/XD300-23_68HighlightsAResearchCntAugHumanIntellect",
|
||||||
u'file': u'XD300-23_68HighlightsAResearchCntAugHumanIntellect.ogv',
|
'file': 'XD300-23_68HighlightsAResearchCntAugHumanIntellect.ogv',
|
||||||
u'md5': u'8af1d4cf447933ed3c7f4871162602db',
|
'md5': '8af1d4cf447933ed3c7f4871162602db',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"title": u"1968 Demo - FJCC Conference Presentation Reel #1",
|
"title": "1968 Demo - FJCC Conference Presentation Reel #1",
|
||||||
u"description": u"Reel 1 of 3: Also known as the \"Mother of All Demos\", Doug Engelbart's presentation at the Fall Joint Computer Conference in San Francisco, December 9, 1968 titled \"A Research Center for Augmenting Human Intellect.\" For this presentation, Doug and his team astonished the audience by not only relating their research, but demonstrating it live. This was the debut of the mouse, interactive computing, hypermedia, computer supported software engineering, video teleconferencing, etc. See also <a href=\"http://dougengelbart.org/firsts/dougs-1968-demo.html\" rel=\"nofollow\">Doug's 1968 Demo page</a> for more background, highlights, links, and the detailed paper published in this conference proceedings. Filmed on 3 reels: Reel 1 | <a href=\"http://www.archive.org/details/XD300-24_68HighlightsAResearchCntAugHumanIntellect\" rel=\"nofollow\">Reel 2</a> | <a href=\"http://www.archive.org/details/XD300-25_68HighlightsAResearchCntAugHumanIntellect\" rel=\"nofollow\">Reel 3</a>",
|
"description": "Reel 1 of 3: Also known as the \"Mother of All Demos\", Doug Engelbart's presentation at the Fall Joint Computer Conference in San Francisco, December 9, 1968 titled \"A Research Center for Augmenting Human Intellect.\" For this presentation, Doug and his team astonished the audience by not only relating their research, but demonstrating it live. This was the debut of the mouse, interactive computing, hypermedia, computer supported software engineering, video teleconferencing, etc. See also <a href=\"http://dougengelbart.org/firsts/dougs-1968-demo.html\" rel=\"nofollow\">Doug's 1968 Demo page</a> for more background, highlights, links, and the detailed paper published in this conference proceedings. Filmed on 3 reels: Reel 1 | <a href=\"http://www.archive.org/details/XD300-24_68HighlightsAResearchCntAugHumanIntellect\" rel=\"nofollow\">Reel 2</a> | <a href=\"http://www.archive.org/details/XD300-25_68HighlightsAResearchCntAugHumanIntellect\" rel=\"nofollow\">Reel 3</a>",
|
||||||
u"upload_date": u"19681210",
|
"upload_date": "19681210",
|
||||||
u"uploader": u"SRI International"
|
"uploader": "SRI International"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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')
|
||||||
|
|
||||||
json_url = url + (u'?' if u'?' in url else '&') + u'output=json'
|
json_url = url + ('?' if '?' in url else '&') + 'output=json'
|
||||||
json_data = self._download_webpage(json_url, video_id)
|
json_data = self._download_webpage(json_url, video_id)
|
||||||
data = json.loads(json_data)
|
data = json.loads(json_data)
|
||||||
|
|
||||||
@@ -38,16 +38,16 @@ class ArchiveOrgIE(InfoExtractor):
|
|||||||
uploader = data['metadata']['creator'][0]
|
uploader = data['metadata']['creator'][0]
|
||||||
upload_date = unified_strdate(data['metadata']['date'][0])
|
upload_date = unified_strdate(data['metadata']['date'][0])
|
||||||
|
|
||||||
formats = [{
|
formats = [
|
||||||
|
{
|
||||||
'format': fdata['format'],
|
'format': fdata['format'],
|
||||||
'url': 'http://' + data['server'] + data['dir'] + fn,
|
'url': 'http://' + data['server'] + data['dir'] + fn,
|
||||||
'file_size': int(fdata['size']),
|
'file_size': int(fdata['size']),
|
||||||
}
|
}
|
||||||
for fn, fdata in data['files'].items()
|
for fn, fdata in data['files'].items()
|
||||||
if 'Video' in fdata['format']]
|
if 'Video' in fdata['format']]
|
||||||
formats.sort(key=lambda fdata: fdata['file_size'])
|
|
||||||
for f in formats:
|
self._sort_formats(formats)
|
||||||
f['ext'] = determine_ext(f['url'])
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'_type': 'video',
|
'_type': 'video',
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import json
|
import json
|
||||||
|
|
||||||
@@ -22,7 +24,7 @@ class ArteTvIE(InfoExtractor):
|
|||||||
_LIVEWEB_URL = r'(?:http://)?liveweb\.arte\.tv/(?P<lang>fr|de)/(?P<subpage>.+?)/(?P<name>.+)'
|
_LIVEWEB_URL = r'(?:http://)?liveweb\.arte\.tv/(?P<lang>fr|de)/(?P<subpage>.+?)/(?P<name>.+)'
|
||||||
_LIVE_URL = r'index-[0-9]+\.html$'
|
_LIVE_URL = r'index-[0-9]+\.html$'
|
||||||
|
|
||||||
IE_NAME = u'arte.tv'
|
IE_NAME = 'arte.tv'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def suitable(cls, url):
|
def suitable(cls, url):
|
||||||
@@ -37,7 +39,7 @@ class ArteTvIE(InfoExtractor):
|
|||||||
# r'src="(.*?/videothek_js.*?\.js)',
|
# r'src="(.*?/videothek_js.*?\.js)',
|
||||||
# 0,
|
# 0,
|
||||||
# [
|
# [
|
||||||
# (1, 'url', u'Invalid URL: %s' % url)
|
# (1, 'url', 'Invalid URL: %s' % url)
|
||||||
# ]
|
# ]
|
||||||
# )
|
# )
|
||||||
# http_host = url.split('/')[2]
|
# http_host = url.split('/')[2]
|
||||||
@@ -49,12 +51,12 @@ class ArteTvIE(InfoExtractor):
|
|||||||
# '(rtmp://.*?)\'',
|
# '(rtmp://.*?)\'',
|
||||||
# re.DOTALL,
|
# re.DOTALL,
|
||||||
# [
|
# [
|
||||||
# (1, 'path', u'could not extract video path: %s' % url),
|
# (1, 'path', 'could not extract video path: %s' % url),
|
||||||
# (2, 'player', u'could not extract video player: %s' % url),
|
# (2, 'player', 'could not extract video player: %s' % url),
|
||||||
# (3, 'url', u'could not extract video url: %s' % url)
|
# (3, 'url', 'could not extract video url: %s' % url)
|
||||||
# ]
|
# ]
|
||||||
# )
|
# )
|
||||||
# video_url = u'%s/%s' % (info.get('url'), info.get('path'))
|
# video_url = '%s/%s' % (info.get('url'), info.get('path'))
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VIDEOS_URL, url)
|
mobj = re.match(self._VIDEOS_URL, url)
|
||||||
@@ -107,9 +109,9 @@ class ArteTvIE(InfoExtractor):
|
|||||||
def _extract_liveweb(self, url, name, lang):
|
def _extract_liveweb(self, url, name, lang):
|
||||||
"""Extract form http://liveweb.arte.tv/"""
|
"""Extract form http://liveweb.arte.tv/"""
|
||||||
webpage = self._download_webpage(url, name)
|
webpage = self._download_webpage(url, name)
|
||||||
video_id = self._search_regex(r'eventId=(\d+?)("|&)', webpage, u'event id')
|
video_id = self._search_regex(r'eventId=(\d+?)("|&)', webpage, 'event id')
|
||||||
config_doc = self._download_xml('http://download.liveweb.arte.tv/o21/liveweb/events/event-%s.xml' % video_id,
|
config_doc = self._download_xml('http://download.liveweb.arte.tv/o21/liveweb/events/event-%s.xml' % video_id,
|
||||||
video_id, u'Downloading information')
|
video_id, 'Downloading information')
|
||||||
event_doc = config_doc.find('event')
|
event_doc = config_doc.find('event')
|
||||||
url_node = event_doc.find('video').find('urlHd')
|
url_node = event_doc.find('video').find('urlHd')
|
||||||
if url_node is None:
|
if url_node is None:
|
||||||
@@ -124,7 +126,7 @@ class ArteTvIE(InfoExtractor):
|
|||||||
|
|
||||||
|
|
||||||
class ArteTVPlus7IE(InfoExtractor):
|
class ArteTVPlus7IE(InfoExtractor):
|
||||||
IE_NAME = u'arte.tv:+7'
|
IE_NAME = 'arte.tv:+7'
|
||||||
_VALID_URL = r'https?://www\.arte.tv/guide/(?P<lang>fr|de)/(?:(?:sendungen|emissions)/)?(?P<id>.*?)/(?P<name>.*?)(\?.*)?'
|
_VALID_URL = r'https?://www\.arte.tv/guide/(?P<lang>fr|de)/(?:(?:sendungen|emissions)/)?(?P<id>.*?)/(?P<name>.*?)(\?.*)?'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -207,7 +209,7 @@ class ArteTVPlus7IE(InfoExtractor):
|
|||||||
if bitrate is not None:
|
if bitrate is not None:
|
||||||
quality += '-%d' % bitrate
|
quality += '-%d' % bitrate
|
||||||
if format_info.get('versionCode') is not None:
|
if format_info.get('versionCode') is not None:
|
||||||
format_id = u'%s-%s' % (quality, format_info['versionCode'])
|
format_id = '%s-%s' % (quality, format_info['versionCode'])
|
||||||
else:
|
else:
|
||||||
format_id = quality
|
format_id = quality
|
||||||
info = {
|
info = {
|
||||||
@@ -216,7 +218,7 @@ class ArteTVPlus7IE(InfoExtractor):
|
|||||||
'width': format_info.get('width'),
|
'width': format_info.get('width'),
|
||||||
'height': height,
|
'height': height,
|
||||||
}
|
}
|
||||||
if format_info['mediaType'] == u'rtmp':
|
if format_info['mediaType'] == 'rtmp':
|
||||||
info['url'] = format_info['streamer']
|
info['url'] = format_info['streamer']
|
||||||
info['play_path'] = 'mp4:' + format_info['url']
|
info['play_path'] = 'mp4:' + format_info['url']
|
||||||
info['ext'] = 'flv'
|
info['ext'] = 'flv'
|
||||||
@@ -231,27 +233,27 @@ class ArteTVPlus7IE(InfoExtractor):
|
|||||||
|
|
||||||
# It also uses the arte_vp_url url from the webpage to extract the information
|
# It also uses the arte_vp_url url from the webpage to extract the information
|
||||||
class ArteTVCreativeIE(ArteTVPlus7IE):
|
class ArteTVCreativeIE(ArteTVPlus7IE):
|
||||||
IE_NAME = u'arte.tv:creative'
|
IE_NAME = 'arte.tv:creative'
|
||||||
_VALID_URL = r'https?://creative\.arte\.tv/(?P<lang>fr|de)/magazine?/(?P<id>.+)'
|
_VALID_URL = r'https?://creative\.arte\.tv/(?P<lang>fr|de)/magazine?/(?P<id>.+)'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://creative.arte.tv/de/magazin/agentur-amateur-corporate-design',
|
'url': 'http://creative.arte.tv/de/magazin/agentur-amateur-corporate-design',
|
||||||
u'file': u'050489-002.mp4',
|
'file': '050489-002.mp4',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'Agentur Amateur / Agence Amateur #2 : Corporate Design',
|
'title': 'Agentur Amateur / Agence Amateur #2 : Corporate Design',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class ArteTVFutureIE(ArteTVPlus7IE):
|
class ArteTVFutureIE(ArteTVPlus7IE):
|
||||||
IE_NAME = u'arte.tv:future'
|
IE_NAME = 'arte.tv:future'
|
||||||
_VALID_URL = r'https?://future\.arte\.tv/(?P<lang>fr|de)/(thema|sujet)/.*?#article-anchor-(?P<id>\d+)'
|
_VALID_URL = r'https?://future\.arte\.tv/(?P<lang>fr|de)/(thema|sujet)/.*?#article-anchor-(?P<id>\d+)'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://future.arte.tv/fr/sujet/info-sciences#article-anchor-7081',
|
'url': 'http://future.arte.tv/fr/sujet/info-sciences#article-anchor-7081',
|
||||||
u'file': u'050940-003.mp4',
|
'file': '050940-003.mp4',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'Les champignons au secours de la planète',
|
'title': 'Les champignons au secours de la planète',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,7 +265,7 @@ class ArteTVFutureIE(ArteTVPlus7IE):
|
|||||||
|
|
||||||
|
|
||||||
class ArteTVDDCIE(ArteTVPlus7IE):
|
class ArteTVDDCIE(ArteTVPlus7IE):
|
||||||
IE_NAME = u'arte.tv:ddc'
|
IE_NAME = 'arte.tv:ddc'
|
||||||
_VALID_URL = r'http?://ddc\.arte\.tv/(?P<lang>emission|folge)/(?P<id>.+)'
|
_VALID_URL = r'http?://ddc\.arte\.tv/(?P<lang>emission|folge)/(?P<id>.+)'
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
@@ -7,13 +9,14 @@ from ..utils import (
|
|||||||
ExtractorError,
|
ExtractorError,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class AUEngineIE(InfoExtractor):
|
class AUEngineIE(InfoExtractor):
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://auengine.com/embed.php?file=lfvlytY6&w=650&h=370',
|
'url': 'http://auengine.com/embed.php?file=lfvlytY6&w=650&h=370',
|
||||||
u'file': u'lfvlytY6.mp4',
|
'file': 'lfvlytY6.mp4',
|
||||||
u'md5': u'48972bdbcf1a3a2f5533e62425b41d4f',
|
'md5': '48972bdbcf1a3a2f5533e62425b41d4f',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"title": u"[Commie]The Legend of the Legendary Heroes - 03 - Replication Eye (Alpha Stigma)[F9410F5A]"
|
'title': '[Commie]The Legend of the Legendary Heroes - 03 - Replication Eye (Alpha Stigma)[F9410F5A]'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_VALID_URL = r'(?:http://)?(?:www\.)?auengine\.com/embed\.php\?.*?file=([^&]+).*?'
|
_VALID_URL = r'(?:http://)?(?:www\.)?auengine\.com/embed\.php\?.*?file=([^&]+).*?'
|
||||||
@@ -23,7 +26,7 @@ class AUEngineIE(InfoExtractor):
|
|||||||
video_id = mobj.group(1)
|
video_id = mobj.group(1)
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
title = self._html_search_regex(r'<title>(?P<title>.+?)</title>',
|
title = self._html_search_regex(r'<title>(?P<title>.+?)</title>',
|
||||||
webpage, u'title')
|
webpage, 'title')
|
||||||
title = title.strip()
|
title = title.strip()
|
||||||
links = re.findall(r'\s(?:file|url):\s*["\']([^\'"]+)["\']', webpage)
|
links = re.findall(r'\s(?:file|url):\s*["\']([^\'"]+)["\']', webpage)
|
||||||
links = map(compat_urllib_parse.unquote, links)
|
links = map(compat_urllib_parse.unquote, links)
|
||||||
@@ -37,7 +40,7 @@ class AUEngineIE(InfoExtractor):
|
|||||||
video_url = link
|
video_url = link
|
||||||
if not video_url:
|
if not video_url:
|
||||||
raise ExtractorError(u'Could not find video URL')
|
raise ExtractorError(u'Could not find video URL')
|
||||||
ext = u'.' + determine_ext(video_url)
|
ext = '.' + determine_ext(video_url)
|
||||||
if ext == title[-len(ext):]:
|
if ext == title[-len(ext):]:
|
||||||
title = title[:-len(ext)]
|
title = title[:-len(ext)]
|
||||||
|
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import json
|
import json
|
||||||
import itertools
|
import itertools
|
||||||
@@ -9,26 +11,26 @@ from ..utils import (
|
|||||||
|
|
||||||
|
|
||||||
class BambuserIE(InfoExtractor):
|
class BambuserIE(InfoExtractor):
|
||||||
IE_NAME = u'bambuser'
|
IE_NAME = 'bambuser'
|
||||||
_VALID_URL = r'https?://bambuser\.com/v/(?P<id>\d+)'
|
_VALID_URL = r'https?://bambuser\.com/v/(?P<id>\d+)'
|
||||||
_API_KEY = '005f64509e19a868399060af746a00aa'
|
_API_KEY = '005f64509e19a868399060af746a00aa'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://bambuser.com/v/4050584',
|
'url': 'http://bambuser.com/v/4050584',
|
||||||
# MD5 seems to be flaky, see https://travis-ci.org/rg3/youtube-dl/jobs/14051016#L388
|
# MD5 seems to be flaky, see https://travis-ci.org/rg3/youtube-dl/jobs/14051016#L388
|
||||||
#u'md5': u'fba8f7693e48fd4e8641b3fd5539a641',
|
#u'md5': 'fba8f7693e48fd4e8641b3fd5539a641',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'id': u'4050584',
|
'id': '4050584',
|
||||||
u'ext': u'flv',
|
'ext': 'flv',
|
||||||
u'title': u'Education engineering days - lightning talks',
|
'title': 'Education engineering days - lightning talks',
|
||||||
u'duration': 3741,
|
'duration': 3741,
|
||||||
u'uploader': u'pixelversity',
|
'uploader': 'pixelversity',
|
||||||
u'uploader_id': u'344706',
|
'uploader_id': '344706',
|
||||||
},
|
},
|
||||||
u'params': {
|
'params': {
|
||||||
# It doesn't respect the 'Range' header, it would download the whole video
|
# It doesn't respect the 'Range' header, it would download the whole video
|
||||||
# caused the travis builds to fail: https://travis-ci.org/rg3/youtube-dl/jobs/14493845#L59
|
# caused the travis builds to fail: https://travis-ci.org/rg3/youtube-dl/jobs/14493845#L59
|
||||||
u'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,7 +55,7 @@ class BambuserIE(InfoExtractor):
|
|||||||
|
|
||||||
|
|
||||||
class BambuserChannelIE(InfoExtractor):
|
class BambuserChannelIE(InfoExtractor):
|
||||||
IE_NAME = u'bambuser:channel'
|
IE_NAME = 'bambuser:channel'
|
||||||
_VALID_URL = r'https?://bambuser\.com/channel/(?P<user>.*?)(?:/|#|\?|$)'
|
_VALID_URL = r'https?://bambuser\.com/channel/(?P<user>.*?)(?:/|#|\?|$)'
|
||||||
# The maximum number we can get with each request
|
# The maximum number we can get with each request
|
||||||
_STEP = 50
|
_STEP = 50
|
||||||
@@ -72,7 +74,7 @@ class BambuserChannelIE(InfoExtractor):
|
|||||||
# Without setting this header, we wouldn't get any result
|
# Without setting this header, we wouldn't get any result
|
||||||
req.add_header('Referer', 'http://bambuser.com/channel/%s' % user)
|
req.add_header('Referer', 'http://bambuser.com/channel/%s' % user)
|
||||||
info_json = self._download_webpage(req, user,
|
info_json = self._download_webpage(req, user,
|
||||||
u'Downloading page %d' % i)
|
'Downloading page %d' % i)
|
||||||
results = json.loads(info_json)['result']
|
results = json.loads(info_json)['result']
|
||||||
if len(results) == 0:
|
if len(results) == 0:
|
||||||
break
|
break
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
|
|
||||||
@@ -12,14 +14,14 @@ from ..utils import (
|
|||||||
class BandcampIE(InfoExtractor):
|
class BandcampIE(InfoExtractor):
|
||||||
_VALID_URL = r'http://.*?\.bandcamp\.com/track/(?P<title>.*)'
|
_VALID_URL = r'http://.*?\.bandcamp\.com/track/(?P<title>.*)'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
u'url': u'http://youtube-dl.bandcamp.com/track/youtube-dl-test-song',
|
'url': 'http://youtube-dl.bandcamp.com/track/youtube-dl-test-song',
|
||||||
u'file': u'1812978515.mp3',
|
'file': '1812978515.mp3',
|
||||||
u'md5': u'c557841d5e50261777a6585648adf439',
|
'md5': 'c557841d5e50261777a6585648adf439',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"title": u"youtube-dl \"'/\\\u00e4\u21ad - youtube-dl test song \"'/\\\u00e4\u21ad",
|
"title": "youtube-dl \"'/\\\u00e4\u21ad - youtube-dl test song \"'/\\\u00e4\u21ad",
|
||||||
u"duration": 10,
|
"duration": 10,
|
||||||
},
|
},
|
||||||
u'skip': u'There is a limit of 200 free downloads / month for the test song'
|
'_skip': 'There is a limit of 200 free downloads / month for the test song'
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@@ -58,7 +60,7 @@ class BandcampIE(InfoExtractor):
|
|||||||
'duration': duration,
|
'duration': duration,
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
raise ExtractorError(u'No free songs found')
|
raise ExtractorError('No free songs found')
|
||||||
|
|
||||||
download_link = m_download.group(1)
|
download_link = m_download.group(1)
|
||||||
video_id = re.search(
|
video_id = re.search(
|
||||||
@@ -72,56 +74,56 @@ class BandcampIE(InfoExtractor):
|
|||||||
download_webpage, re.MULTILINE).group(1)
|
download_webpage, re.MULTILINE).group(1)
|
||||||
info = json.loads(info)[0]
|
info = json.loads(info)[0]
|
||||||
# We pick mp3-320 for now, until format selection can be easily implemented.
|
# We pick mp3-320 for now, until format selection can be easily implemented.
|
||||||
mp3_info = info[u'downloads'][u'mp3-320']
|
mp3_info = info['downloads']['mp3-320']
|
||||||
# If we try to use this url it says the link has expired
|
# If we try to use this url it says the link has expired
|
||||||
initial_url = mp3_info[u'url']
|
initial_url = mp3_info['url']
|
||||||
re_url = r'(?P<server>http://(.*?)\.bandcamp\.com)/download/track\?enc=mp3-320&fsig=(?P<fsig>.*?)&id=(?P<id>.*?)&ts=(?P<ts>.*)$'
|
re_url = r'(?P<server>http://(.*?)\.bandcamp\.com)/download/track\?enc=mp3-320&fsig=(?P<fsig>.*?)&id=(?P<id>.*?)&ts=(?P<ts>.*)$'
|
||||||
m_url = re.match(re_url, initial_url)
|
m_url = re.match(re_url, initial_url)
|
||||||
#We build the url we will use to get the final track url
|
#We build the url we will use to get the final track url
|
||||||
# This url is build in Bandcamp in the script download_bunde_*.js
|
# This url is build in Bandcamp in the script download_bunde_*.js
|
||||||
request_url = '%s/statdownload/track?enc=mp3-320&fsig=%s&id=%s&ts=%s&.rand=665028774616&.vrs=1' % (m_url.group('server'), m_url.group('fsig'), video_id, m_url.group('ts'))
|
request_url = '%s/statdownload/track?enc=mp3-320&fsig=%s&id=%s&ts=%s&.rand=665028774616&.vrs=1' % (m_url.group('server'), m_url.group('fsig'), video_id, m_url.group('ts'))
|
||||||
final_url_webpage = self._download_webpage(request_url, id, 'Requesting download url')
|
final_url_webpage = self._download_webpage(request_url, video_id, 'Requesting download url')
|
||||||
# If we could correctly generate the .rand field the url would be
|
# If we could correctly generate the .rand field the url would be
|
||||||
#in the "download_url" key
|
#in the "download_url" key
|
||||||
final_url = re.search(r'"retry_url":"(.*?)"', final_url_webpage).group(1)
|
final_url = re.search(r'"retry_url":"(.*?)"', final_url_webpage).group(1)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': info[u'title'],
|
'title': info['title'],
|
||||||
'ext': 'mp3',
|
'ext': 'mp3',
|
||||||
'vcodec': 'none',
|
'vcodec': 'none',
|
||||||
'url': final_url,
|
'url': final_url,
|
||||||
'thumbnail': info[u'thumb_url'],
|
'thumbnail': info.get('thumb_url'),
|
||||||
'uploader': info[u'artist'],
|
'uploader': info.get('artist'),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class BandcampAlbumIE(InfoExtractor):
|
class BandcampAlbumIE(InfoExtractor):
|
||||||
IE_NAME = u'Bandcamp:album'
|
IE_NAME = 'Bandcamp:album'
|
||||||
_VALID_URL = r'http://.*?\.bandcamp\.com/album/(?P<title>.*)'
|
_VALID_URL = r'http://.*?\.bandcamp\.com/album/(?P<title>.*)'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://blazo.bandcamp.com/album/jazz-format-mixtape-vol-1',
|
'url': 'http://blazo.bandcamp.com/album/jazz-format-mixtape-vol-1',
|
||||||
u'playlist': [
|
'playlist': [
|
||||||
{
|
{
|
||||||
u'file': u'1353101989.mp3',
|
'file': '1353101989.mp3',
|
||||||
u'md5': u'39bc1eded3476e927c724321ddf116cf',
|
'md5': '39bc1eded3476e927c724321ddf116cf',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'Intro',
|
'title': 'Intro',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
u'file': u'38097443.mp3',
|
'file': '38097443.mp3',
|
||||||
u'md5': u'1a2c32e2691474643e912cc6cd4bffaa',
|
'md5': '1a2c32e2691474643e912cc6cd4bffaa',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'Kero One - Keep It Alive (Blazo remix)',
|
'title': 'Kero One - Keep It Alive (Blazo remix)',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
u'params': {
|
'params': {
|
||||||
u'playlistend': 2
|
'playlistend': 2
|
||||||
},
|
},
|
||||||
u'skip': u'Bancamp imposes download limits. See test_playlists:test_bandcamp_album for the playlist test'
|
'skip': 'Bancamp imposes download limits. See test_playlists:test_bandcamp_album for the playlist test'
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@@ -130,11 +132,11 @@ class BandcampAlbumIE(InfoExtractor):
|
|||||||
webpage = self._download_webpage(url, title)
|
webpage = self._download_webpage(url, title)
|
||||||
tracks_paths = re.findall(r'<a href="(.*?)" itemprop="url">', webpage)
|
tracks_paths = re.findall(r'<a href="(.*?)" itemprop="url">', webpage)
|
||||||
if not tracks_paths:
|
if not tracks_paths:
|
||||||
raise ExtractorError(u'The page doesn\'t contain any tracks')
|
raise ExtractorError('The page doesn\'t contain any tracks')
|
||||||
entries = [
|
entries = [
|
||||||
self.url_result(compat_urlparse.urljoin(url, t_path), ie=BandcampIE.ie_key())
|
self.url_result(compat_urlparse.urljoin(url, t_path), ie=BandcampIE.ie_key())
|
||||||
for t_path in tracks_paths]
|
for t_path in tracks_paths]
|
||||||
title = self._search_regex(r'album_title : "(.*?)"', webpage, u'title')
|
title = self._search_regex(r'album_title : "(.*?)"', webpage, 'title')
|
||||||
return {
|
return {
|
||||||
'_type': 'playlist',
|
'_type': 'playlist',
|
||||||
'title': title,
|
'title': title,
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
@@ -10,19 +12,19 @@ from ..utils import (
|
|||||||
|
|
||||||
class BlinkxIE(InfoExtractor):
|
class BlinkxIE(InfoExtractor):
|
||||||
_VALID_URL = r'^(?:https?://(?:www\.)blinkx\.com/#?ce/|blinkx:)(?P<id>[^?]+)'
|
_VALID_URL = r'^(?:https?://(?:www\.)blinkx\.com/#?ce/|blinkx:)(?P<id>[^?]+)'
|
||||||
_IE_NAME = u'blinkx'
|
IE_NAME = 'blinkx'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.blinkx.com/ce/8aQUy7GVFYgFzpKhT0oqsilwOGFRVXk3R1ZGWWdGenBLaFQwb3FzaWx3OGFRVXk3R1ZGWWdGenB',
|
'url': 'http://www.blinkx.com/ce/8aQUy7GVFYgFzpKhT0oqsilwOGFRVXk3R1ZGWWdGenBLaFQwb3FzaWx3OGFRVXk3R1ZGWWdGenB',
|
||||||
u'file': u'8aQUy7GV.mp4',
|
'file': '8aQUy7GV.mp4',
|
||||||
u'md5': u'2e9a07364af40163a908edbf10bb2492',
|
'md5': '2e9a07364af40163a908edbf10bb2492',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"title": u"Police Car Rolls Away",
|
"title": "Police Car Rolls Away",
|
||||||
u"uploader": u"stupidvideos.com",
|
"uploader": "stupidvideos.com",
|
||||||
u"upload_date": u"20131215",
|
"upload_date": "20131215",
|
||||||
u"description": u"A police car gently rolls away from a fight. Maybe it felt weird being around a confrontation and just had to get out of there!",
|
"description": "A police car gently rolls away from a fight. Maybe it felt weird being around a confrontation and just had to get out of there!",
|
||||||
u"duration": 14.886,
|
"duration": 14.886,
|
||||||
u"thumbnails": [{
|
"thumbnails": [{
|
||||||
"width": 100,
|
"width": 100,
|
||||||
"height": 76,
|
"height": 76,
|
||||||
"url": "http://cdn.blinkx.com/stream/b/41/StupidVideos/20131215/1873969261/1873969261_tn_0.jpg",
|
"url": "http://cdn.blinkx.com/stream/b/41/StupidVideos/20131215/1873969261/1873969261_tn_0.jpg",
|
||||||
@@ -30,17 +32,17 @@ class BlinkxIE(InfoExtractor):
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, rl):
|
||||||
m = re.match(self._VALID_URL, url)
|
m = re.match(self._VALID_URL, rl)
|
||||||
video_id = m.group('id')
|
video_id = m.group('id')
|
||||||
display_id = video_id[:8]
|
display_id = video_id[:8]
|
||||||
|
|
||||||
api_url = (u'https://apib4.blinkx.com/api.php?action=play_video&' +
|
api_url = (u'https://apib4.blinkx.com/api.php?action=play_video&' +
|
||||||
u'video=%s' % video_id)
|
'video=%s' % video_id)
|
||||||
data_json = self._download_webpage(api_url, display_id)
|
data_json = self._download_webpage(api_url, display_id)
|
||||||
data = json.loads(data_json)['api']['results'][0]
|
data = json.loads(data_json)['api']['results'][0]
|
||||||
dt = datetime.datetime.fromtimestamp(data['pubdate_epoch'])
|
dt = datetime.datetime.fromtimestamp(data['pubdate_epoch'])
|
||||||
upload_date = dt.strftime('%Y%m%d')
|
pload_date = dt.strftime('%Y%m%d')
|
||||||
|
|
||||||
duration = None
|
duration = None
|
||||||
thumbnails = []
|
thumbnails = []
|
||||||
@@ -86,7 +88,7 @@ class BlinkxIE(InfoExtractor):
|
|||||||
'title': data['title'],
|
'title': data['title'],
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'uploader': data['channel_name'],
|
'uploader': data['channel_name'],
|
||||||
'upload_date': upload_date,
|
'upload_date': pload_date,
|
||||||
'description': data.get('description'),
|
'description': data.get('description'),
|
||||||
'thumbnails': thumbnails,
|
'thumbnails': thumbnails,
|
||||||
'duration': duration,
|
'duration': duration,
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from .ooyala import OoyalaIE
|
||||||
|
|
||||||
|
|
||||||
class BloombergIE(InfoExtractor):
|
class BloombergIE(InfoExtractor):
|
||||||
@@ -23,5 +24,5 @@ class BloombergIE(InfoExtractor):
|
|||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
name = mobj.group('name')
|
name = mobj.group('name')
|
||||||
webpage = self._download_webpage(url, name)
|
webpage = self._download_webpage(url, name)
|
||||||
ooyala_url = self._og_search_video_url(webpage)
|
ooyala_code = self._search_regex(r'<source src="http://player.ooyala.com/player/[^/]+/([^".]+)', webpage, u'ooyala url')
|
||||||
return self.url_result(ooyala_url, ie='Ooyala')
|
return OoyalaIE._build_url_result(ooyala_code)
|
||||||
|
@@ -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 = {'flashID': object_doc.attrib['id'],
|
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'],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
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:
|
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
|
||||||
|
@@ -1,21 +1,21 @@
|
|||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import determine_ext
|
|
||||||
|
|
||||||
class C56IE(InfoExtractor):
|
class C56IE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://((www|player)\.)?56\.com/(.+?/)?(v_|(play_album.+-))(?P<textid>.+?)\.(html|swf)'
|
_VALID_URL = r'https?://((www|player)\.)?56\.com/(.+?/)?(v_|(play_album.+-))(?P<textid>.+?)\.(html|swf)'
|
||||||
IE_NAME = u'56.com'
|
IE_NAME = '56.com'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.56.com/u39/v_OTM0NDA3MTY.html',
|
'url': 'http://www.56.com/u39/v_OTM0NDA3MTY.html',
|
||||||
u'file': u'93440716.flv',
|
'file': '93440716.flv',
|
||||||
u'md5': u'e59995ac63d0457783ea05f93f12a866',
|
'md5': 'e59995ac63d0457783ea05f93f12a866',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'网事知多少 第32期:车怒',
|
'title': '网事知多少 第32期:车怒',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,14 +23,18 @@ class C56IE(InfoExtractor):
|
|||||||
mobj = re.match(self._VALID_URL, url, flags=re.VERBOSE)
|
mobj = re.match(self._VALID_URL, url, flags=re.VERBOSE)
|
||||||
text_id = mobj.group('textid')
|
text_id = mobj.group('textid')
|
||||||
info_page = self._download_webpage('http://vxml.56.com/json/%s/' % text_id,
|
info_page = self._download_webpage('http://vxml.56.com/json/%s/' % text_id,
|
||||||
text_id, u'Downloading video info')
|
text_id, 'Downloading video info')
|
||||||
info = json.loads(info_page)['info']
|
info = json.loads(info_page)['info']
|
||||||
best_format = sorted(info['rfiles'], key=lambda f: int(f['filesize']))[-1]
|
formats = [{
|
||||||
video_url = best_format['url']
|
'format_id': f['type'],
|
||||||
|
'filesize': int(f['filesize']),
|
||||||
|
'url': f['url']
|
||||||
|
} for f in info['rfiles']]
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
return {'id': info['vid'],
|
return {
|
||||||
|
'id': info['vid'],
|
||||||
'title': info['Subject'],
|
'title': info['Subject'],
|
||||||
'url': video_url,
|
'formats': formats,
|
||||||
'ext': determine_ext(video_url),
|
|
||||||
'thumbnail': info.get('bimg') or info.get('img'),
|
'thumbnail': info.get('bimg') or info.get('img'),
|
||||||
}
|
}
|
||||||
|
@@ -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):
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
@@ -12,23 +14,24 @@ class CNNIE(InfoExtractor):
|
|||||||
(?P<path>.+?/(?P<title>[^/]+?)(?:\.cnn|(?=&)))'''
|
(?P<path>.+?/(?P<title>[^/]+?)(?:\.cnn|(?=&)))'''
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
u'url': u'http://edition.cnn.com/video/?/video/sports/2013/06/09/nadal-1-on-1.cnn',
|
'url': 'http://edition.cnn.com/video/?/video/sports/2013/06/09/nadal-1-on-1.cnn',
|
||||||
u'file': u'sports_2013_06_09_nadal-1-on-1.cnn.mp4',
|
'file': 'sports_2013_06_09_nadal-1-on-1.cnn.mp4',
|
||||||
u'md5': u'3e6121ea48df7e2259fe73a0628605c4',
|
'md5': '3e6121ea48df7e2259fe73a0628605c4',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'Nadal wins 8th French Open title',
|
'title': 'Nadal wins 8th French Open title',
|
||||||
u'description': u'World Sport\'s Amanda Davies chats with 2013 French Open champion Rafael Nadal.',
|
'description': 'World Sport\'s Amanda Davies chats with 2013 French Open champion Rafael Nadal.',
|
||||||
u'duration': 135,
|
'duration': 135,
|
||||||
u'upload_date': u'20130609',
|
'upload_date': '20130609',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
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",
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
|
|
||||||
@@ -36,7 +39,7 @@ class CNNIE(InfoExtractor):
|
|||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
path = mobj.group('path')
|
path = mobj.group('path')
|
||||||
page_title = mobj.group('title')
|
page_title = mobj.group('title')
|
||||||
info_url = u'http://cnn.com/video/data/3.0/%s/index.xml' % path
|
info_url = 'http://cnn.com/video/data/3.0/%s/index.xml' % path
|
||||||
info = self._download_xml(info_url, page_title)
|
info = self._download_xml(info_url, page_title)
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
|
@@ -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,6 @@
|
|||||||
import base64
|
import base64
|
||||||
|
import hashlib
|
||||||
|
import json
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import socket
|
import socket
|
||||||
@@ -61,8 +63,10 @@ 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
|
||||||
@@ -218,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):
|
||||||
@@ -233,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).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)
|
||||||
@@ -260,6 +269,15 @@ class InfoExtractor(object):
|
|||||||
xml_string = transform_source(xml_string)
|
xml_string = transform_source(xml_string)
|
||||||
return xml.etree.ElementTree.fromstring(xml_string.encode('utf-8'))
|
return xml.etree.ElementTree.fromstring(xml_string.encode('utf-8'))
|
||||||
|
|
||||||
|
def _download_json(self, url_or_request, video_id,
|
||||||
|
note=u'Downloading JSON metadata',
|
||||||
|
errnote=u'Unable to download JSON metadata'):
|
||||||
|
json_string = self._download_webpage(url_or_request, video_id, note, errnote)
|
||||||
|
try:
|
||||||
|
return json.loads(json_string)
|
||||||
|
except ValueError as ve:
|
||||||
|
raise ExtractorError('Failed to download JSON', cause=ve)
|
||||||
|
|
||||||
def report_warning(self, msg, video_id=None):
|
def report_warning(self, msg, video_id=None):
|
||||||
idstr = u'' if video_id is None else u'%s: ' % video_id
|
idstr = u'' if video_id is None else u'%s: ' % video_id
|
||||||
self._downloader.report_warning(
|
self._downloader.report_warning(
|
||||||
@@ -491,6 +509,7 @@ class InfoExtractor(object):
|
|||||||
f.get('height') if f.get('height') is not None else -1,
|
f.get('height') if f.get('height') is not None else -1,
|
||||||
f.get('width') if f.get('width') is not None else -1,
|
f.get('width') if f.get('width') is not None else -1,
|
||||||
ext_preference,
|
ext_preference,
|
||||||
|
f.get('tbr') if f.get('tbr') is not None else -1,
|
||||||
f.get('vbr') if f.get('vbr') is not None else -1,
|
f.get('vbr') if f.get('vbr') is not None else -1,
|
||||||
f.get('abr') if f.get('abr') is not None else -1,
|
f.get('abr') if f.get('abr') is not None else -1,
|
||||||
audio_ext_preference,
|
audio_ext_preference,
|
||||||
|
@@ -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,35 +59,37 @@ 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,
|
||||||
|
@@ -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',
|
||||||
}
|
}
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import json
|
import json
|
||||||
|
|
||||||
@@ -5,15 +7,14 @@ from .common import InfoExtractor
|
|||||||
|
|
||||||
|
|
||||||
class DefenseGouvFrIE(InfoExtractor):
|
class DefenseGouvFrIE(InfoExtractor):
|
||||||
_IE_NAME = 'defense.gouv.fr'
|
IE_NAME = 'defense.gouv.fr'
|
||||||
_VALID_URL = (r'http://.*?\.defense\.gouv\.fr/layout/set/'
|
_VALID_URL = (r'http://.*?\.defense\.gouv\.fr/layout/set/'
|
||||||
r'ligthboxvideo/base-de-medias/webtv/(.*)')
|
r'ligthboxvideo/base-de-medias/webtv/(.*)')
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': (u'http://www.defense.gouv.fr/layout/set/ligthboxvideo/'
|
'url': 'http://www.defense.gouv.fr/layout/set/ligthboxvideo/base-de-medias/webtv/attaque-chimique-syrienne-du-21-aout-2013-1',
|
||||||
u'base-de-medias/webtv/attaque-chimique-syrienne-du-21-aout-2013-1'),
|
'file': '11213.mp4',
|
||||||
u'file': u'11213.mp4',
|
'md5': '75bba6124da7e63d2d60b5244ec9430c',
|
||||||
u'md5': u'75bba6124da7e63d2d60b5244ec9430c',
|
|
||||||
"info_dict": {
|
"info_dict": {
|
||||||
"title": "attaque-chimique-syrienne-du-21-aout-2013-1"
|
"title": "attaque-chimique-syrienne-du-21-aout-2013-1"
|
||||||
}
|
}
|
||||||
|
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,
|
||||||
|
}
|
69
youtube_dl/extractor/everyonesmixtape.py
Normal file
69
youtube_dl/extractor/everyonesmixtape.py
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
compat_urllib_request,
|
||||||
|
ExtractorError,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class EveryonesMixtapeIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?everyonesmixtape\.com/#/mix/(?P<id>[0-9a-zA-Z]+)(?:/(?P<songnr>[0-9]))?$'
|
||||||
|
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://everyonesmixtape.com/#/mix/m7m0jJAbMQi/5',
|
||||||
|
'file': '5bfseWNmlds.mp4',
|
||||||
|
"info_dict": {
|
||||||
|
"title": "Passion Pit - \"Sleepyhead\" (Official Music Video)",
|
||||||
|
"uploader": "FKR.TV",
|
||||||
|
"uploader_id": "frenchkissrecords",
|
||||||
|
"description": "Music video for \"Sleepyhead\" from Passion Pit's debut EP Chunk Of Change.\nBuy on iTunes: https://itunes.apple.com/us/album/chunk-of-change-ep/id300087641\n\nDirected by The Wilderness.\n\nhttp://www.passionpitmusic.com\nhttp://www.frenchkissrecords.com",
|
||||||
|
"upload_date": "20081015"
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
'skip_download': True, # This is simply YouTube
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
playlist_id = mobj.group('id')
|
||||||
|
|
||||||
|
pllist_url = 'http://everyonesmixtape.com/mixtape.php?a=getMixes&u=-1&linked=%s&explore=' % playlist_id
|
||||||
|
pllist_req = compat_urllib_request.Request(pllist_url)
|
||||||
|
pllist_req.add_header('X-Requested-With', 'XMLHttpRequest')
|
||||||
|
|
||||||
|
playlist_list = self._download_json(
|
||||||
|
pllist_req, playlist_id, note='Downloading playlist metadata')
|
||||||
|
try:
|
||||||
|
playlist_no = next(playlist['id']
|
||||||
|
for playlist in playlist_list
|
||||||
|
if playlist['code'] == playlist_id)
|
||||||
|
except StopIteration:
|
||||||
|
raise ExtractorError('Playlist id not found')
|
||||||
|
|
||||||
|
pl_url = 'http://everyonesmixtape.com/mixtape.php?a=getMix&id=%s&userId=null&code=' % playlist_no
|
||||||
|
pl_req = compat_urllib_request.Request(pl_url)
|
||||||
|
pl_req.add_header('X-Requested-With', 'XMLHttpRequest')
|
||||||
|
playlist = self._download_json(
|
||||||
|
pl_req, playlist_id, note='Downloading playlist info')
|
||||||
|
|
||||||
|
entries = [{
|
||||||
|
'_type': 'url',
|
||||||
|
'url': t['url'],
|
||||||
|
'title': t['title'],
|
||||||
|
} for t in playlist['tracks']]
|
||||||
|
|
||||||
|
if mobj.group('songnr'):
|
||||||
|
songnr = int(mobj.group('songnr')) - 1
|
||||||
|
return entries[songnr]
|
||||||
|
|
||||||
|
playlist_title = playlist['mixData']['name']
|
||||||
|
return {
|
||||||
|
'_type': 'playlist',
|
||||||
|
'id': playlist_id,
|
||||||
|
'title': playlist_title,
|
||||||
|
'entries': entries,
|
||||||
|
}
|
@@ -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,
|
||||||
|
}
|
@@ -191,3 +191,29 @@ class GenerationQuoiIE(InfoExtractor):
|
|||||||
info = json.loads(info_json)
|
info = json.loads(info_json)
|
||||||
return self.url_result('http://www.dailymotion.com/video/%s' % info['id'],
|
return self.url_result('http://www.dailymotion.com/video/%s' % info['id'],
|
||||||
ie='Dailymotion')
|
ie='Dailymotion')
|
||||||
|
|
||||||
|
|
||||||
|
class CultureboxIE(FranceTVBaseInfoExtractor):
|
||||||
|
IE_NAME = u'culturebox.francetvinfo.fr'
|
||||||
|
_VALID_URL = r'https?://culturebox\.francetvinfo\.fr/(?P<name>.*?)(\?|$)'
|
||||||
|
|
||||||
|
_TEST = {
|
||||||
|
u'url': u'http://culturebox.francetvinfo.fr/einstein-on-the-beach-au-theatre-du-chatelet-146813',
|
||||||
|
u'info_dict': {
|
||||||
|
u'id': u'EV_6785',
|
||||||
|
u'ext': u'mp4',
|
||||||
|
u'title': u'Einstein on the beach au Théâtre du Châtelet',
|
||||||
|
u'description': u'md5:9ce2888b1efefc617b5e58b3f6200eeb',
|
||||||
|
},
|
||||||
|
u'params': {
|
||||||
|
# m3u8 download
|
||||||
|
u'skip_download': True,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
name = mobj.group('name')
|
||||||
|
webpage = self._download_webpage(url, name)
|
||||||
|
video_id = self._search_regex(r'"http://videos\.francetv\.fr/video/(.*?)"', webpage, u'video id')
|
||||||
|
return self._extract_video(video_id)
|
||||||
|
@@ -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,6 +92,7 @@ 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',
|
||||||
@@ -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:
|
||||||
|
default_search = self._downloader.params.get('default_search')
|
||||||
|
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')
|
self._downloader.report_warning('The url doesn\'t specify the protocol, trying with http')
|
||||||
return self.url_result('http://' + url)
|
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)
|
||||||
@@ -230,7 +242,7 @@ class GenericIE(InfoExtractor):
|
|||||||
|
|
||||||
# Look for embedded (iframe) Vimeo player
|
# Look for embedded (iframe) Vimeo player
|
||||||
mobj = re.search(
|
mobj = re.search(
|
||||||
r'<iframe[^>]+?src="(https?://player.vimeo.com/video/.+?)"', webpage)
|
r'<iframe[^>]+?src="((?:https?:)?//player.vimeo.com/video/.+?)"', webpage)
|
||||||
if mobj:
|
if mobj:
|
||||||
player_url = unescapeHTML(mobj.group(1))
|
player_url = unescapeHTML(mobj.group(1))
|
||||||
surl = smuggle_url(player_url, {'Referer': url})
|
surl = smuggle_url(player_url, {'Referer': url})
|
||||||
@@ -303,15 +315,27 @@ class GenericIE(InfoExtractor):
|
|||||||
return OoyalaIE._build_url_result(mobj.group(1))
|
return OoyalaIE._build_url_result(mobj.group(1))
|
||||||
|
|
||||||
# Look for Aparat videos
|
# Look for Aparat videos
|
||||||
mobj = re.search(r'<iframe src="(http://www.aparat.com/video/[^"]+)"', webpage)
|
mobj = re.search(r'<iframe src="(http://www\.aparat\.com/video/[^"]+)"', webpage)
|
||||||
if mobj is not None:
|
if mobj is not None:
|
||||||
return self.url_result(mobj.group(1), 'Aparat')
|
return self.url_result(mobj.group(1), 'Aparat')
|
||||||
|
|
||||||
# Look for MPORA videos
|
# Look for MPORA videos
|
||||||
mobj = re.search(r'<iframe .*?src="(http://mpora.com/videos/[^"]+)"', webpage)
|
mobj = re.search(r'<iframe .*?src="(http://mpora\.com/videos/[^"]+)"', webpage)
|
||||||
if mobj is not None:
|
if mobj is not None:
|
||||||
return self.url_result(mobj.group(1), 'Mpora')
|
return self.url_result(mobj.group(1), 'Mpora')
|
||||||
|
|
||||||
|
# Look for embedded Novamov player
|
||||||
|
mobj = re.search(
|
||||||
|
r'<iframe[^>]+?src=(["\'])(?P<url>http://(?:(?:embed|www)\.)?novamov\.com/embed\.php.+?)\1', webpage)
|
||||||
|
if mobj is not None:
|
||||||
|
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')
|
||||||
|
|
||||||
# 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:
|
||||||
@@ -322,7 +346,7 @@ class GenericIE(InfoExtractor):
|
|||||||
mobj = re.search(r'[^A-Za-z0-9]?(?:file|source)=(http[^\'"&]*)', webpage)
|
mobj = re.search(r'[^A-Za-z0-9]?(?:file|source)=(http[^\'"&]*)', webpage)
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
# Broaden the search a little bit: JWPlayer JS loader
|
# Broaden the search a little bit: JWPlayer JS loader
|
||||||
mobj = re.search(r'[^A-Za-z0-9]?file["\']?:\s*["\'](http[^\'"]*)', webpage)
|
mobj = re.search(r'[^A-Za-z0-9]?file["\']?:\s*["\'](http(?![^\'"]+\.[0-9]+[\'"])[^\'"]+)["\']', webpage)
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
# Try to find twitter cards info
|
# Try to find twitter cards info
|
||||||
mobj = re.search(r'<meta (?:property|name)="twitter:player:stream" (?:content|value)="(.+?)"', webpage)
|
mobj = re.search(r'<meta (?:property|name)="twitter:player:stream" (?:content|value)="(.+?)"', webpage)
|
||||||
|
@@ -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()
|
||||||
|
|
||||||
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
'title': video_title,
|
'title': video_title,
|
||||||
'thumbnail': self._og_search_thumbnail(webpage_src),
|
'thumbnail': self._og_search_thumbnail(webpage_src),
|
||||||
'ext' : 'mp3',
|
}
|
||||||
}]
|
|
||||||
return results
|
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import json
|
import json
|
||||||
|
|
||||||
@@ -9,18 +11,18 @@ from ..utils import (
|
|||||||
|
|
||||||
|
|
||||||
class ImdbIE(InfoExtractor):
|
class ImdbIE(InfoExtractor):
|
||||||
IE_NAME = u'imdb'
|
IE_NAME = 'imdb'
|
||||||
IE_DESC = u'Internet Movie Database trailers'
|
IE_DESC = 'Internet Movie Database trailers'
|
||||||
_VALID_URL = r'http://(?:www|m)\.imdb\.com/video/imdb/vi(?P<id>\d+)'
|
_VALID_URL = r'http://(?:www|m)\.imdb\.com/video/imdb/vi(?P<id>\d+)'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.imdb.com/video/imdb/vi2524815897',
|
'url': 'http://www.imdb.com/video/imdb/vi2524815897',
|
||||||
u'md5': u'9f34fa777ade3a6e57a054fdbcb3a068',
|
'md5': '9f34fa777ade3a6e57a054fdbcb3a068',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'id': u'2524815897',
|
'id': '2524815897',
|
||||||
u'ext': u'mp4',
|
'ext': 'mp4',
|
||||||
u'title': u'Ice Age: Continental Drift Trailer (No. 2) - IMDb',
|
'title': 'Ice Age: Continental Drift Trailer (No. 2) - IMDb',
|
||||||
u'description': u'md5:9061c2219254e5d14e03c25c98e96a81',
|
'description': 'md5:9061c2219254e5d14e03c25c98e96a81',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,10 +39,10 @@ class ImdbIE(InfoExtractor):
|
|||||||
f_path = f_path.strip()
|
f_path = f_path.strip()
|
||||||
format_page = self._download_webpage(
|
format_page = self._download_webpage(
|
||||||
compat_urlparse.urljoin(url, f_path),
|
compat_urlparse.urljoin(url, f_path),
|
||||||
u'Downloading info for %s format' % f_id)
|
'Downloading info for %s format' % f_id)
|
||||||
json_data = self._search_regex(
|
json_data = self._search_regex(
|
||||||
r'<script[^>]+class="imdb-player-data"[^>]*?>(.*?)</script>',
|
r'<script[^>]+class="imdb-player-data"[^>]*?>(.*?)</script>',
|
||||||
format_page, u'json data', flags=re.DOTALL)
|
format_page, 'json data', flags=re.DOTALL)
|
||||||
info = json.loads(json_data)
|
info = json.loads(json_data)
|
||||||
format_info = info['videoPlayerObject']['video']
|
format_info = info['videoPlayerObject']['video']
|
||||||
formats.append({
|
formats.append({
|
||||||
@@ -56,31 +58,25 @@ class ImdbIE(InfoExtractor):
|
|||||||
'thumbnail': format_info['slate'],
|
'thumbnail': format_info['slate'],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class ImdbListIE(InfoExtractor):
|
class ImdbListIE(InfoExtractor):
|
||||||
IE_NAME = u'imdb:list'
|
IE_NAME = 'imdb:list'
|
||||||
IE_DESC = u'Internet Movie Database lists'
|
IE_DESC = 'Internet Movie Database lists'
|
||||||
_VALID_URL = r'http://www\.imdb\.com/list/(?P<id>[\da-zA-Z_-]{11})'
|
_VALID_URL = r'http://www\.imdb\.com/list/(?P<id>[\da-zA-Z_-]{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)
|
||||||
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, u'Downloading list RSS')
|
list_code = self._search_regex(
|
||||||
list_title = self._html_search_regex(r'<title>(.*?)</title>', rss, u'list title')
|
r'(?s)<div\s+class="list\sdetail">(.*?)class="see-more"',
|
||||||
|
webpage, 'list code')
|
||||||
|
entries = [
|
||||||
|
self.url_result('http://www.imdb.com' + m, 'Imdb')
|
||||||
|
for m in re.findall(r'href="(/video/imdb/vi[^"]+)"', webpage)]
|
||||||
|
|
||||||
# Export is independent of actual author_id, but returns 404 if no author_id is provided.
|
list_title = self._html_search_regex(
|
||||||
# However, passing dummy author_id seems to be enough.
|
r'<h1 class="header">(.*?)</h1>', webpage, 'list title')
|
||||||
csv = self._download_webpage('http://www.imdb.com/list/export?list_id=%s&author_id=ur00000000' % list_id,
|
|
||||||
list_id, u'Downloading list CSV')
|
|
||||||
|
|
||||||
entries = []
|
|
||||||
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)
|
@@ -7,7 +7,7 @@ class InaIE(InfoExtractor):
|
|||||||
"""Information Extractor for Ina.fr"""
|
"""Information Extractor for Ina.fr"""
|
||||||
_VALID_URL = r'(?:http://)?(?:www\.)?ina\.fr/video/(?P<id>I?[A-F0-9]+)/.*'
|
_VALID_URL = r'(?:http://)?(?:www\.)?ina\.fr/video/(?P<id>I?[A-F0-9]+)/.*'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'www.ina.fr/video/I12055569/francois-hollande-je-crois-que-c-est-clair-video.html',
|
u'url': u'http://www.ina.fr/video/I12055569/francois-hollande-je-crois-que-c-est-clair-video.html',
|
||||||
u'file': u'I12055569.mp4',
|
u'file': u'I12055569.mp4',
|
||||||
u'md5': u'a667021bf2b41f8dc6049479d9bb38a3',
|
u'md5': u'a667021bf2b41f8dc6049479d9bb38a3',
|
||||||
u'info_dict': {
|
u'info_dict': {
|
||||||
|
@@ -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 {
|
||||||
|
'id': video_id,
|
||||||
'title': title,
|
'title': title,
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
'ext': determine_ext(video_url),
|
|
||||||
}
|
}
|
||||||
|
71
youtube_dl/extractor/khanacademy.py
Normal file
71
youtube_dl/extractor/khanacademy.py
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
unified_strdate,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class KhanAcademyIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'^https?://(?:www\.)?khanacademy\.org/(?P<key>[^/]+)/(?:[^/]+/){,2}(?P<id>[^?#/]+)(?:$|[?#])'
|
||||||
|
IE_NAME = 'KhanAcademy'
|
||||||
|
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://www.khanacademy.org/video/one-time-pad',
|
||||||
|
'file': 'one-time-pad.mp4',
|
||||||
|
'md5': '7021db7f2d47d4fff89b13177cb1e8f4',
|
||||||
|
'info_dict': {
|
||||||
|
'title': 'The one-time pad',
|
||||||
|
'description': 'The perfect cipher',
|
||||||
|
'duration': 176,
|
||||||
|
'uploader': 'Brit Cruise',
|
||||||
|
'upload_date': '20120411',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
m = re.match(self._VALID_URL, url)
|
||||||
|
video_id = m.group('id')
|
||||||
|
|
||||||
|
if m.group('key') == 'video':
|
||||||
|
data = self._download_json(
|
||||||
|
'http://api.khanacademy.org/api/v1/videos/' + video_id,
|
||||||
|
video_id, 'Downloading video info')
|
||||||
|
|
||||||
|
upload_date = unified_strdate(data['date_added'])
|
||||||
|
uploader = ', '.join(data['author_names'])
|
||||||
|
return {
|
||||||
|
'_type': 'url_transparent',
|
||||||
|
'url': data['url'],
|
||||||
|
'id': video_id,
|
||||||
|
'title': data['title'],
|
||||||
|
'thumbnail': data['image_url'],
|
||||||
|
'duration': data['duration'],
|
||||||
|
'description': data['description'],
|
||||||
|
'uploader': uploader,
|
||||||
|
'upload_date': upload_date,
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
# topic
|
||||||
|
data = self._download_json(
|
||||||
|
'http://api.khanacademy.org/api/v1/topic/' + video_id,
|
||||||
|
video_id, 'Downloading topic info')
|
||||||
|
|
||||||
|
entries = [
|
||||||
|
{
|
||||||
|
'_type': 'url',
|
||||||
|
'url': c['url'],
|
||||||
|
'id': c['id'],
|
||||||
|
'title': c['title'],
|
||||||
|
}
|
||||||
|
for c in data['children'] if c['kind'] in ('Video', 'Topic')]
|
||||||
|
|
||||||
|
return {
|
||||||
|
'_type': 'playlist',
|
||||||
|
'id': video_id,
|
||||||
|
'title': data['title'],
|
||||||
|
'description': data['description'],
|
||||||
|
'entries': entries,
|
||||||
|
}
|
@@ -5,13 +5,24 @@ import json
|
|||||||
|
|
||||||
from .subtitles import SubtitlesInfoExtractor
|
from .subtitles import SubtitlesInfoExtractor
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import ExtractorError
|
from ..utils import (
|
||||||
|
compat_urllib_parse,
|
||||||
|
compat_urllib_request,
|
||||||
|
ExtractorError
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class LyndaIE(SubtitlesInfoExtractor):
|
class LyndaIE(SubtitlesInfoExtractor):
|
||||||
IE_NAME = 'lynda'
|
IE_NAME = 'lynda'
|
||||||
IE_DESC = 'lynda.com videos'
|
IE_DESC = 'lynda.com videos'
|
||||||
_VALID_URL = r'https?://www\.lynda\.com/[^/]+/[^/]+/\d+/(\d+)-\d\.html'
|
_VALID_URL = r'https?://www\.lynda\.com/[^/]+/[^/]+/\d+/(\d+)-\d\.html'
|
||||||
|
_LOGIN_URL = 'https://www.lynda.com/login/login.aspx'
|
||||||
|
_NETRC_MACHINE = 'lynda'
|
||||||
|
|
||||||
|
_SUCCESSFUL_LOGIN_REGEX = r'<a href="https://www.lynda.com/home/userAccount/ChangeContactInfo.aspx" data-qa="eyebrow_account_menu">My account'
|
||||||
|
_TIMECODE_REGEX = r'\[(?P<timecode>\d+:\d+:\d+[\.,]\d+)\]'
|
||||||
|
|
||||||
|
ACCOUNT_CREDENTIALS_HINT = 'Use --username and --password options to provide lynda.com account credentials.'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'http://www.lynda.com/Bootstrap-tutorials/Using-exercise-files/110885/114408-4.html',
|
'url': 'http://www.lynda.com/Bootstrap-tutorials/Using-exercise-files/110885/114408-4.html',
|
||||||
@@ -23,6 +34,9 @@ class LyndaIE(SubtitlesInfoExtractor):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def _real_initialize(self):
|
||||||
|
self._login()
|
||||||
|
|
||||||
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)
|
video_id = mobj.group(1)
|
||||||
@@ -31,11 +45,11 @@ class LyndaIE(SubtitlesInfoExtractor):
|
|||||||
video_id, 'Downloading video JSON')
|
video_id, 'Downloading video JSON')
|
||||||
video_json = json.loads(page)
|
video_json = json.loads(page)
|
||||||
|
|
||||||
if 'Status' in video_json and video_json['Status'] == 'NotFound':
|
if 'Status' in video_json:
|
||||||
raise ExtractorError('Video %s does not exist' % video_id, expected=True)
|
raise ExtractorError('lynda returned error: %s' % video_json['Message'], expected=True)
|
||||||
|
|
||||||
if video_json['HasAccess'] is False:
|
if video_json['HasAccess'] is False:
|
||||||
raise ExtractorError('Video %s is only available for members' % video_id, expected=True)
|
raise ExtractorError('Video %s is only available for members. ' % video_id + self.ACCOUNT_CREDENTIALS_HINT, expected=True)
|
||||||
|
|
||||||
video_id = video_json['ID']
|
video_id = video_json['ID']
|
||||||
duration = video_json['DurationInSeconds']
|
duration = video_json['DurationInSeconds']
|
||||||
@@ -65,7 +79,47 @@ class LyndaIE(SubtitlesInfoExtractor):
|
|||||||
'formats': formats
|
'formats': formats
|
||||||
}
|
}
|
||||||
|
|
||||||
_TIMECODE_REGEX = r'\[(?P<timecode>\d+:\d+:\d+[\.,]\d+)\]'
|
def _login(self):
|
||||||
|
(username, password) = self._get_login_info()
|
||||||
|
if username is None:
|
||||||
|
return
|
||||||
|
|
||||||
|
login_form = {
|
||||||
|
'username': username,
|
||||||
|
'password': password,
|
||||||
|
'remember': 'false',
|
||||||
|
'stayPut': 'false'
|
||||||
|
}
|
||||||
|
request = compat_urllib_request.Request(self._LOGIN_URL, compat_urllib_parse.urlencode(login_form))
|
||||||
|
login_page = self._download_webpage(request, None, note='Logging in as %s' % username)
|
||||||
|
|
||||||
|
# Not (yet) logged in
|
||||||
|
m = re.search(r'loginResultJson = \'(?P<json>[^\']+)\';', login_page)
|
||||||
|
if m is not None:
|
||||||
|
response = m.group('json')
|
||||||
|
response_json = json.loads(response)
|
||||||
|
state = response_json['state']
|
||||||
|
|
||||||
|
if state == 'notlogged':
|
||||||
|
raise ExtractorError('Unable to login, incorrect username and/or password', expected=True)
|
||||||
|
|
||||||
|
# This is when we get popup:
|
||||||
|
# > You're already logged in to lynda.com on two devices.
|
||||||
|
# > If you log in here, we'll log you out of another device.
|
||||||
|
# So, we need to confirm this.
|
||||||
|
if state == 'conflicted':
|
||||||
|
confirm_form = {
|
||||||
|
'username': '',
|
||||||
|
'password': '',
|
||||||
|
'resolve': 'true',
|
||||||
|
'remember': 'false',
|
||||||
|
'stayPut': 'false',
|
||||||
|
}
|
||||||
|
request = compat_urllib_request.Request(self._LOGIN_URL, compat_urllib_parse.urlencode(confirm_form))
|
||||||
|
login_page = self._download_webpage(request, None, note='Confirming log in and log out from another device')
|
||||||
|
|
||||||
|
if re.search(self._SUCCESSFUL_LOGIN_REGEX, login_page) is None:
|
||||||
|
raise ExtractorError('Unable to log in')
|
||||||
|
|
||||||
def _fix_subtitles(self, subtitles):
|
def _fix_subtitles(self, subtitles):
|
||||||
if subtitles is None:
|
if subtitles is None:
|
||||||
@@ -123,16 +177,18 @@ class LyndaCourseIE(InfoExtractor):
|
|||||||
|
|
||||||
unaccessible_videos = 0
|
unaccessible_videos = 0
|
||||||
videos = []
|
videos = []
|
||||||
|
(username, _) = self._get_login_info()
|
||||||
|
|
||||||
for chapter in course_json['Chapters']:
|
for chapter in course_json['Chapters']:
|
||||||
for video in chapter['Videos']:
|
for video in chapter['Videos']:
|
||||||
if video['HasAccess'] is not True:
|
if username is None and video['HasAccess'] is False:
|
||||||
unaccessible_videos += 1
|
unaccessible_videos += 1
|
||||||
continue
|
continue
|
||||||
videos.append(video['ID'])
|
videos.append(video['ID'])
|
||||||
|
|
||||||
if unaccessible_videos > 0:
|
if unaccessible_videos > 0:
|
||||||
self._downloader.report_warning('%s videos are only available for members and will not be downloaded' % unaccessible_videos)
|
self._downloader.report_warning('%s videos are only available for members and will not be downloaded. '
|
||||||
|
% unaccessible_videos + LyndaIE.ACCOUNT_CREDENTIALS_HINT)
|
||||||
|
|
||||||
entries = [
|
entries = [
|
||||||
self.url_result('http://www.lynda.com/%s/%s-4.html' %
|
self.url_result('http://www.lynda.com/%s/%s-4.html' %
|
||||||
|
@@ -1,9 +1,10 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import operator
|
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
fix_xml_all_ampersand,
|
fix_xml_ampersands,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -11,12 +12,12 @@ class MetacriticIE(InfoExtractor):
|
|||||||
_VALID_URL = r'https?://www\.metacritic\.com/.+?/trailers/(?P<id>\d+)'
|
_VALID_URL = r'https?://www\.metacritic\.com/.+?/trailers/(?P<id>\d+)'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.metacritic.com/game/playstation-4/infamous-second-son/trailers/3698222',
|
'url': 'http://www.metacritic.com/game/playstation-4/infamous-second-son/trailers/3698222',
|
||||||
u'file': u'3698222.mp4',
|
'file': '3698222.mp4',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'inFamous: Second Son - inSide Sucker Punch: Smoke & Mirrors',
|
'title': 'inFamous: Second Son - inSide Sucker Punch: Smoke & Mirrors',
|
||||||
u'description': u'Take a peak behind-the-scenes to see how Sucker Punch brings smoke into the universe of inFAMOUS Second Son on the PS4.',
|
'description': 'Take a peak behind-the-scenes to see how Sucker Punch brings smoke into the universe of inFAMOUS Second Son on the PS4.',
|
||||||
u'duration': 221,
|
'duration': 221,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,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, u'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 = []
|
||||||
@@ -37,12 +38,12 @@ class MetacriticIE(InfoExtractor):
|
|||||||
'url': video_url,
|
'url': video_url,
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'format_id': rate_str,
|
'format_id': rate_str,
|
||||||
'rate': int(rate_str),
|
'tbr': int(rate_str),
|
||||||
})
|
})
|
||||||
formats.sort(key=operator.itemgetter('rate'))
|
self._sort_formats(formats)
|
||||||
|
|
||||||
description = self._html_search_regex(r'<b>Description:</b>(.*?)</p>',
|
description = self._html_search_regex(r'<b>Description:</b>(.*?)</p>',
|
||||||
webpage, u'description', flags=re.DOTALL)
|
webpage, 'description', flags=re.DOTALL)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
@@ -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)
|
||||||
|
@@ -11,7 +11,7 @@ from ..utils import (
|
|||||||
|
|
||||||
class MporaIE(InfoExtractor):
|
class MporaIE(InfoExtractor):
|
||||||
_VALID_URL = r'^https?://(www\.)?mpora\.(?:com|de)/videos/(?P<id>[^?#/]+)'
|
_VALID_URL = r'^https?://(www\.)?mpora\.(?:com|de)/videos/(?P<id>[^?#/]+)'
|
||||||
_IE_NAME = 'MPORA'
|
IE_NAME = 'MPORA'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'http://mpora.de/videos/AAdo8okx4wiz/embed?locale=de',
|
'url': 'http://mpora.de/videos/AAdo8okx4wiz/embed?locale=de',
|
||||||
@@ -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',
|
||||||
},
|
},
|
||||||
u'params': {
|
'params': {
|
||||||
# rtmp download
|
# rtmp download
|
||||||
u'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
|
# song
|
||||||
|
{
|
||||||
|
'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)
|
||||||
|
|
||||||
|
if mobj.group('mediatype').startswith('music/song'):
|
||||||
|
# songs don't store any useful info in the 'context' variable
|
||||||
|
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,
|
context = json.loads(self._search_regex(r'context = ({.*?});', webpage,
|
||||||
u'context'))
|
u'context'))
|
||||||
video = context['video']
|
video = context['video']
|
||||||
rtmp_url, play_path = video['streamUrl'].split(';', 1)
|
streamUrl = video['streamUrl']
|
||||||
|
info = {
|
||||||
return {
|
|
||||||
'id': compat_str(video['mediaId']),
|
'id': compat_str(video['mediaId']),
|
||||||
'title': video['title'],
|
'title': video['title'],
|
||||||
'url': rtmp_url,
|
|
||||||
'play_path': play_path,
|
|
||||||
'ext': 'flv',
|
|
||||||
'description': video['description'],
|
'description': video['description'],
|
||||||
'thumbnail': video['imageUrl'],
|
'thumbnail': video['imageUrl'],
|
||||||
'uploader': video['artistName'],
|
'uploader': video['artistName'],
|
||||||
'uploader_id': video['artistUsername'],
|
'uploader_id': video['artistUsername'],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rtmp_url, play_path = streamUrl.split(';', 1)
|
||||||
|
info.update({
|
||||||
|
'url': rtmp_url,
|
||||||
|
'play_path': play_path,
|
||||||
|
'ext': 'flv',
|
||||||
|
})
|
||||||
|
return info
|
||||||
|
@@ -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,10 +24,13 @@ 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']
|
||||||
|
|
||||||
@@ -34,5 +39,4 @@ class NewgroundsIE(InfoExtractor):
|
|||||||
'title': title,
|
'title': title,
|
||||||
'url': music_url,
|
'url': music_url,
|
||||||
'uploader': uploader,
|
'uploader': uploader,
|
||||||
'ext': determine_ext(music_url),
|
|
||||||
}
|
}
|
||||||
|
63
youtube_dl/extractor/novamov.py
Normal file
63
youtube_dl/extractor/novamov.py
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
ExtractorError,
|
||||||
|
compat_urlparse
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class NovamovIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'http://(?:(?:www\.)?novamov\.com/video/|(?:(?:embed|www)\.)novamov\.com/embed\.php\?v=)(?P<videoid>[a-z\d]{13})'
|
||||||
|
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://www.novamov.com/video/4rurhn9x446jj',
|
||||||
|
'file': '4rurhn9x446jj.flv',
|
||||||
|
'md5': '7205f346a52bbeba427603ba10d4b935',
|
||||||
|
'info_dict': {
|
||||||
|
'title': 'search engine optimization',
|
||||||
|
'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):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('videoid')
|
||||||
|
|
||||||
|
page = self._download_webpage('http://www.novamov.com/video/%s' % video_id,
|
||||||
|
video_id, 'Downloading video page')
|
||||||
|
|
||||||
|
if re.search(r'This file no longer exists on our servers!</h2>', page) is not None:
|
||||||
|
raise ExtractorError(u'Video %s does not exist' % video_id, expected=True)
|
||||||
|
|
||||||
|
filekey = self._search_regex(
|
||||||
|
r'flashvars\.filekey="(?P<filekey>[^"]+)";', page, 'filekey')
|
||||||
|
|
||||||
|
title = self._html_search_regex(
|
||||||
|
r'(?s)<div class="v_tab blockborder rounded5" id="v_tab1">\s*<h3>([^<]+)</h3>',
|
||||||
|
page, 'title', fatal=False)
|
||||||
|
|
||||||
|
description = self._html_search_regex(
|
||||||
|
r'(?s)<div class="v_tab blockborder rounded5" id="v_tab1">\s*<h3>[^<]+</h3><p>([^<]+)</p>',
|
||||||
|
page, 'description', fatal=False)
|
||||||
|
|
||||||
|
api_response = self._download_webpage(
|
||||||
|
'http://www.novamov.com/api/player.api.php?key=%s&file=%s' % (filekey, video_id),
|
||||||
|
video_id, 'Downloading video api response')
|
||||||
|
|
||||||
|
response = compat_urlparse.parse_qs(api_response)
|
||||||
|
|
||||||
|
if 'error_msg' in response:
|
||||||
|
raise ExtractorError('novamov returned error: %s' % response['error_msg'][0], expected=True)
|
||||||
|
|
||||||
|
video_url = response['url'][0]
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'url': video_url,
|
||||||
|
'title': title,
|
||||||
|
'description': description
|
||||||
|
}
|
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',
|
||||||
|
}
|
@@ -5,7 +5,7 @@ from ..utils import compat_urlparse
|
|||||||
|
|
||||||
|
|
||||||
class NowVideoIE(InfoExtractor):
|
class NowVideoIE(InfoExtractor):
|
||||||
_VALID_URL = r'(?:https?://)?(?:www\.)?nowvideo\.ch/video/(?P<id>\w+)'
|
_VALID_URL = r'(?:https?://)?(?:www\.)?nowvideo\.(?:ch|sx)/video/(?P<id>\w+)'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.nowvideo.ch/video/0mw0yow7b6dxa',
|
u'url': u'http://www.nowvideo.ch/video/0mw0yow7b6dxa',
|
||||||
u'file': u'0mw0yow7b6dxa.flv',
|
u'file': u'0mw0yow7b6dxa.flv',
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
@@ -11,16 +13,17 @@ from ..aes import (
|
|||||||
aes_decrypt_text
|
aes_decrypt_text
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class PornHubIE(InfoExtractor):
|
class PornHubIE(InfoExtractor):
|
||||||
_VALID_URL = r'^(?:https?://)?(?:www\.)?(?P<url>pornhub\.com/view_video\.php\?viewkey=(?P<videoid>[0-9a-f]+))'
|
_VALID_URL = r'^(?:https?://)?(?:www\.)?(?P<url>pornhub\.com/view_video\.php\?viewkey=(?P<videoid>[0-9a-f]+))'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.pornhub.com/view_video.php?viewkey=648719015',
|
'url': 'http://www.pornhub.com/view_video.php?viewkey=648719015',
|
||||||
u'file': u'648719015.mp4',
|
'file': '648719015.mp4',
|
||||||
u'md5': u'882f488fa1f0026f023f33576004a2ed',
|
'md5': '882f488fa1f0026f023f33576004a2ed',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"uploader": u"BABES-COM",
|
"uploader": "BABES-COM",
|
||||||
u"title": u"Seductive Indian beauty strips down and fingers her pink pussy",
|
"title": "Seductive Indian beauty strips down and fingers her pink pussy",
|
||||||
u"age_limit": 18
|
"age_limit": 18
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,15 +36,15 @@ class PornHubIE(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(r'<b>From: </b>(?:\s|<[^>]*>)*(.+?)<', webpage, u'uploader', fatal=False)
|
video_uploader = self._html_search_regex(r'<b>From: </b>(?:\s|<[^>]*>)*(.+?)<', webpage, 'uploader', fatal=False)
|
||||||
thumbnail = self._html_search_regex(r'"image_url":"([^"]+)', webpage, u'thumbnail', fatal=False)
|
thumbnail = self._html_search_regex(r'"image_url":"([^"]+)', webpage, 'thumbnail', fatal=False)
|
||||||
if thumbnail:
|
if thumbnail:
|
||||||
thumbnail = compat_urllib_parse.unquote(thumbnail)
|
thumbnail = compat_urllib_parse.unquote(thumbnail)
|
||||||
|
|
||||||
video_urls = list(map(compat_urllib_parse.unquote , re.findall(r'"quality_[0-9]{3}p":"([^"]+)', webpage)))
|
video_urls = list(map(compat_urllib_parse.unquote , re.findall(r'"quality_[0-9]{3}p":"([^"]+)', webpage)))
|
||||||
if webpage.find('"encrypted":true') != -1:
|
if webpage.find('"encrypted":true') != -1:
|
||||||
password = self._html_search_regex(r'"video_title":"([^"]+)', webpage, u'password').replace('+', ' ')
|
password = self._html_search_regex(r'"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 = []
|
||||||
@@ -50,13 +53,24 @@ class PornHubIE(InfoExtractor):
|
|||||||
extension = os.path.splitext(path)[1][1:]
|
extension = os.path.splitext(path)[1][1:]
|
||||||
format = path.split('/')[5].split('_')[:2]
|
format = path.split('/')[5].split('_')[:2]
|
||||||
format = "-".join(format)
|
format = "-".join(format)
|
||||||
|
|
||||||
|
m = re.match(r'^(?P<height>[0-9]+)P-(?P<tbr>[0-9]+)K$', format)
|
||||||
|
if m is None:
|
||||||
|
height = None
|
||||||
|
tbr = None
|
||||||
|
else:
|
||||||
|
height = int(m.group('height'))
|
||||||
|
tbr = int(m.group('tbr'))
|
||||||
|
|
||||||
formats.append({
|
formats.append({
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
'ext': extension,
|
'ext': extension,
|
||||||
'format': format,
|
'format': format,
|
||||||
'format_id': format,
|
'format_id': format,
|
||||||
|
'tbr': tbr,
|
||||||
|
'height': height,
|
||||||
})
|
})
|
||||||
formats.sort(key=lambda format: list(map(lambda s: s.zfill(6), format['format'].split('-'))))
|
self._sort_formats(formats)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
@@ -1,19 +1,21 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
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,6 +35,10 @@ 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
|
||||||
@@ -42,5 +48,6 @@ class RedTubeIE(InfoExtractor):
|
|||||||
'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(
|
||||||
|
r'addthis:description="([^"]+)"',
|
||||||
|
webpage, 'description', fatal=False)
|
||||||
|
final_url = "http://ringtv.craveonline.springboardplatform.com/storage/ringtv.craveonline.com/conversion/%s.mp4" % video_id
|
||||||
|
thumbnail_url = "http://ringtv.craveonline.springboardplatform.com/storage/ringtv.craveonline.com/snapshots/%s.jpg" % video_id
|
||||||
|
|
||||||
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'url': final_url,
|
'url': final_url,
|
||||||
'ext' : ext,
|
|
||||||
'title': title,
|
'title': title,
|
||||||
'thumbnail': thumbnail_url,
|
'thumbnail': thumbnail_url,
|
||||||
'description': description,
|
'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.',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@@ -39,7 +39,7 @@ class RTLnowIE(InfoExtractor):
|
|||||||
u'skip': u'Only works from Germany',
|
u'skip': u'Only works from Germany',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
u'url': u'www.voxnow.de/voxtours/suedafrika-reporter-ii.php?film_id=13883&player=1&season=17',
|
u'url': u'http://www.voxnow.de/voxtours/suedafrika-reporter-ii.php?film_id=13883&player=1&season=17',
|
||||||
u'file': u'13883.flv',
|
u'file': u'13883.flv',
|
||||||
u'info_dict': {
|
u'info_dict': {
|
||||||
u'upload_date': u'20090627',
|
u'upload_date': u'20090627',
|
||||||
|
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,56 +11,61 @@ 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,
|
||||||
|
@@ -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)
|
||||||
|
@@ -24,7 +24,7 @@ class VimeoIE(InfoExtractor):
|
|||||||
|
|
||||||
# _VALID_URL matches Vimeo URLs
|
# _VALID_URL matches Vimeo URLs
|
||||||
_VALID_URL = r'''(?x)
|
_VALID_URL = r'''(?x)
|
||||||
(?P<proto>https?://)?
|
(?P<proto>(?:https?:)?//)?
|
||||||
(?:(?:www|(?P<player>player))\.)?
|
(?:(?:www|(?P<player>player))\.)?
|
||||||
vimeo(?P<pro>pro)?\.com/
|
vimeo(?P<pro>pro)?\.com/
|
||||||
(?:.*?/)?
|
(?:.*?/)?
|
||||||
@@ -124,6 +124,19 @@ class VimeoIE(InfoExtractor):
|
|||||||
'Verifying the password',
|
'Verifying the password',
|
||||||
'Wrong password')
|
'Wrong password')
|
||||||
|
|
||||||
|
def _verify_player_video_password(self, url, video_id):
|
||||||
|
password = self._downloader.params.get('videopassword', None)
|
||||||
|
if password is None:
|
||||||
|
raise ExtractorError('This video is protected by a password, use the --video-password option')
|
||||||
|
data = compat_urllib_parse.urlencode({'password': password})
|
||||||
|
pass_url = url + '/check-password'
|
||||||
|
password_request = compat_urllib_request.Request(pass_url, data)
|
||||||
|
password_request.add_header('Content-Type', 'application/x-www-form-urlencoded')
|
||||||
|
return self._download_json(
|
||||||
|
password_request, video_id,
|
||||||
|
'Verifying the password',
|
||||||
|
'Wrong password')
|
||||||
|
|
||||||
def _real_initialize(self):
|
def _real_initialize(self):
|
||||||
self._login()
|
self._login()
|
||||||
|
|
||||||
@@ -136,9 +149,6 @@ class VimeoIE(InfoExtractor):
|
|||||||
|
|
||||||
# Extract ID from URL
|
# Extract ID from URL
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
if mobj is None:
|
|
||||||
raise ExtractorError('Invalid URL: %s' % url)
|
|
||||||
|
|
||||||
video_id = mobj.group('id')
|
video_id = mobj.group('id')
|
||||||
if mobj.group('pro') or mobj.group('player'):
|
if mobj.group('pro') or mobj.group('player'):
|
||||||
url = 'http://player.vimeo.com/video/' + video_id
|
url = 'http://player.vimeo.com/video/' + video_id
|
||||||
@@ -184,8 +194,7 @@ class VimeoIE(InfoExtractor):
|
|||||||
cause=e)
|
cause=e)
|
||||||
else:
|
else:
|
||||||
if config.get('view') == 4:
|
if config.get('view') == 4:
|
||||||
self._verify_video_password(url, video_id, webpage)
|
config = self._verify_player_video_password(url, video_id)
|
||||||
return self._real_extract(url)
|
|
||||||
|
|
||||||
# Extract title
|
# Extract title
|
||||||
video_title = config["video"]["title"]
|
video_title = config["video"]["title"]
|
||||||
|
@@ -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,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,
|
||||||
@@ -131,6 +134,8 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
|
|||||||
(
|
(
|
||||||
(?:https?://|//)? # http(s):// or protocol-independent URL (optional)
|
(?:https?://|//)? # http(s):// or protocol-independent URL (optional)
|
||||||
(?:(?:(?:(?:\w+\.)?[yY][oO][uU][tT][uU][bB][eE](?:-nocookie)?\.com/|
|
(?:(?:(?:(?:\w+\.)?[yY][oO][uU][tT][uU][bB][eE](?:-nocookie)?\.com/|
|
||||||
|
(?:www\.)?deturl\.com/www\.youtube\.com/|
|
||||||
|
(?:www\.)?pwnyoutube\.com|
|
||||||
tube\.majestyc\.net/|
|
tube\.majestyc\.net/|
|
||||||
youtube\.googleapis\.com/) # the various hostnames, with wildcard subdomains
|
youtube\.googleapis\.com/) # the various hostnames, with wildcard subdomains
|
||||||
(?:.*?\#/)? # handle anchor (#/) redirect urls
|
(?:.*?\#/)? # handle anchor (#/) redirect urls
|
||||||
@@ -202,6 +207,11 @@ 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},
|
||||||
|
'168': {'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},
|
||||||
@@ -213,6 +223,9 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
|
|||||||
# Dash webm audio
|
# Dash webm audio
|
||||||
'171': {'ext': 'webm', 'vcodec': 'none', 'format_note': 'DASH webm audio', 'abr': 48, 'preference': -50},
|
'171': {'ext': 'webm', 'vcodec': 'none', 'format_note': 'DASH webm audio', 'abr': 48, 'preference': -50},
|
||||||
'172': {'ext': 'webm', 'vcodec': 'none', 'format_note': 'DASH webm audio', 'abr': 256, 'preference': -50},
|
'172': {'ext': 'webm', 'vcodec': 'none', 'format_note': 'DASH webm audio', 'abr': 256, 'preference': -50},
|
||||||
|
|
||||||
|
# RTMP (unnamed)
|
||||||
|
'_rtmp': {'protocol': 'rtmp'},
|
||||||
}
|
}
|
||||||
|
|
||||||
IE_NAME = u'youtube'
|
IE_NAME = u'youtube'
|
||||||
@@ -264,6 +277,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",
|
||||||
|
},
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@@ -998,7 +1027,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
|
|||||||
'lang': lang,
|
'lang': lang,
|
||||||
'v': video_id,
|
'v': video_id,
|
||||||
'fmt': self._downloader.params.get('subtitlesformat', 'srt'),
|
'fmt': self._downloader.params.get('subtitlesformat', 'srt'),
|
||||||
'name': l[0].encode('utf-8'),
|
'name': unescapeHTML(l[0]).encode('utf-8'),
|
||||||
})
|
})
|
||||||
url = u'http://www.youtube.com/api/timedtext?' + params
|
url = u'http://www.youtube.com/api/timedtext?' + params
|
||||||
sub_lang_list[lang] = url
|
sub_lang_list[lang] = url
|
||||||
@@ -1061,18 +1090,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):
|
||||||
@@ -1246,7 +1263,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:
|
||||||
@@ -1271,9 +1287,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 = [(None, 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:
|
||||||
@@ -1318,23 +1352,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,
|
||||||
|
note=u'Downloading DASH manifest',
|
||||||
|
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,
|
||||||
}
|
}
|
||||||
dct.update(self._formats[itag])
|
try:
|
||||||
formats.append(dct)
|
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)
|
||||||
|
|
||||||
@@ -1443,7 +1504,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
|
||||||
|
|
||||||
|
try:
|
||||||
playlist_title = self._og_search_title(page)
|
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)
|
||||||
@@ -1567,44 +1635,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)
|
||||||
|
|
||||||
@@ -1752,13 +1811,16 @@ 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(
|
||||||
u'Did you forget to quote the URL? Remember that & is a meta '
|
u'Did you forget to quote the URL? Remember that & is a meta '
|
||||||
u'character in most shells, so you want to put the URL in quotes, '
|
u'character in most shells, so you want to put the URL in quotes, '
|
||||||
u'like youtube-dl '
|
u'like youtube-dl '
|
||||||
u'\'http://www.youtube.com/watch?feature=foo&v=BaW_jenozKc\''
|
u'"http://www.youtube.com/watch?feature=foo&v=BaW_jenozKc" '
|
||||||
u' (or simply youtube-dl BaW_jenozKc ).',
|
u' or simply youtube-dl BaW_jenozKc .',
|
||||||
expected=True)
|
expected=True)
|
||||||
|
@@ -31,14 +31,23 @@ class FFmpegPostProcessor(PostProcessor):
|
|||||||
programs = ['avprobe', 'avconv', 'ffmpeg', 'ffprobe']
|
programs = ['avprobe', 'avconv', 'ffmpeg', 'ffprobe']
|
||||||
return dict((program, check_executable(program, ['-version'])) for program in programs)
|
return dict((program, check_executable(program, ['-version'])) for program in programs)
|
||||||
|
|
||||||
|
def _get_executable(self):
|
||||||
|
if self._downloader.params.get('prefer_ffmpeg', False):
|
||||||
|
return self._exes['ffmpeg'] or self._exes['avconv']
|
||||||
|
else:
|
||||||
|
return self._exes['avconv'] or self._exes['ffmpeg']
|
||||||
|
|
||||||
|
def _uses_avconv(self):
|
||||||
|
return self._get_executable() == self._exes['avconv']
|
||||||
|
|
||||||
def run_ffmpeg_multiple_files(self, input_paths, out_path, opts):
|
def run_ffmpeg_multiple_files(self, input_paths, out_path, opts):
|
||||||
if not self._exes['ffmpeg'] and not self._exes['avconv']:
|
if not self._get_executable():
|
||||||
raise FFmpegPostProcessorError(u'ffmpeg or avconv not found. Please install one.')
|
raise FFmpegPostProcessorError(u'ffmpeg or avconv not found. Please install one.')
|
||||||
|
|
||||||
files_cmd = []
|
files_cmd = []
|
||||||
for path in input_paths:
|
for path in input_paths:
|
||||||
files_cmd.extend(['-i', encodeFilename(path, True)])
|
files_cmd.extend(['-i', encodeFilename(path, True)])
|
||||||
cmd = ([self._exes['avconv'] or self._exes['ffmpeg'], '-y'] + files_cmd
|
cmd = ([self._get_executable(), '-y'] + files_cmd
|
||||||
+ opts +
|
+ opts +
|
||||||
[encodeFilename(self._ffmpeg_filename_argument(out_path), True)])
|
[encodeFilename(self._ffmpeg_filename_argument(out_path), True)])
|
||||||
|
|
||||||
@@ -93,8 +102,6 @@ class FFmpegExtractAudioPP(FFmpegPostProcessor):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def run_ffmpeg(self, path, out_path, codec, more_opts):
|
def run_ffmpeg(self, path, out_path, codec, more_opts):
|
||||||
if not self._exes['ffmpeg'] and not self._exes['avconv']:
|
|
||||||
raise AudioConversionError('ffmpeg or avconv not found. Please install one.')
|
|
||||||
if codec is None:
|
if codec is None:
|
||||||
acodec_opts = []
|
acodec_opts = []
|
||||||
else:
|
else:
|
||||||
@@ -112,13 +119,14 @@ class FFmpegExtractAudioPP(FFmpegPostProcessor):
|
|||||||
if filecodec is None:
|
if filecodec is None:
|
||||||
raise PostProcessingError(u'WARNING: unable to obtain file audio codec with ffprobe')
|
raise PostProcessingError(u'WARNING: unable to obtain file audio codec with ffprobe')
|
||||||
|
|
||||||
|
uses_avconv = self._uses_avconv()
|
||||||
more_opts = []
|
more_opts = []
|
||||||
if self._preferredcodec == 'best' or self._preferredcodec == filecodec or (self._preferredcodec == 'm4a' and filecodec == 'aac'):
|
if self._preferredcodec == 'best' or self._preferredcodec == filecodec or (self._preferredcodec == 'm4a' and filecodec == 'aac'):
|
||||||
if filecodec == 'aac' and self._preferredcodec in ['m4a', 'best']:
|
if filecodec == 'aac' and self._preferredcodec in ['m4a', 'best']:
|
||||||
# Lossless, but in another container
|
# Lossless, but in another container
|
||||||
acodec = 'copy'
|
acodec = 'copy'
|
||||||
extension = 'm4a'
|
extension = 'm4a'
|
||||||
more_opts = [self._exes['avconv'] and '-bsf:a' or '-absf', 'aac_adtstoasc']
|
more_opts = ['-bsf:a' if uses_avconv else '-absf', 'aac_adtstoasc']
|
||||||
elif filecodec in ['aac', 'mp3', 'vorbis', 'opus']:
|
elif filecodec in ['aac', 'mp3', 'vorbis', 'opus']:
|
||||||
# Lossless if possible
|
# Lossless if possible
|
||||||
acodec = 'copy'
|
acodec = 'copy'
|
||||||
@@ -134,9 +142,9 @@ class FFmpegExtractAudioPP(FFmpegPostProcessor):
|
|||||||
more_opts = []
|
more_opts = []
|
||||||
if self._preferredquality is not None:
|
if self._preferredquality is not None:
|
||||||
if int(self._preferredquality) < 10:
|
if int(self._preferredquality) < 10:
|
||||||
more_opts += [self._exes['avconv'] and '-q:a' or '-aq', self._preferredquality]
|
more_opts += ['-q:a' if uses_avconv else '-aq', self._preferredquality]
|
||||||
else:
|
else:
|
||||||
more_opts += [self._exes['avconv'] and '-b:a' or '-ab', self._preferredquality + 'k']
|
more_opts += ['-b:a' if uses_avconv else '-ab', self._preferredquality + 'k']
|
||||||
else:
|
else:
|
||||||
# We convert the audio (lossy)
|
# We convert the audio (lossy)
|
||||||
acodec = {'mp3': 'libmp3lame', 'aac': 'aac', 'm4a': 'aac', 'opus': 'opus', 'vorbis': 'libvorbis', 'wav': None}[self._preferredcodec]
|
acodec = {'mp3': 'libmp3lame', 'aac': 'aac', 'm4a': 'aac', 'opus': 'opus', 'vorbis': 'libvorbis', 'wav': None}[self._preferredcodec]
|
||||||
@@ -145,13 +153,13 @@ class FFmpegExtractAudioPP(FFmpegPostProcessor):
|
|||||||
if self._preferredquality is not None:
|
if self._preferredquality is not None:
|
||||||
# The opus codec doesn't support the -aq option
|
# The opus codec doesn't support the -aq option
|
||||||
if int(self._preferredquality) < 10 and extension != 'opus':
|
if int(self._preferredquality) < 10 and extension != 'opus':
|
||||||
more_opts += [self._exes['avconv'] and '-q:a' or '-aq', self._preferredquality]
|
more_opts += ['-q:a' if uses_avconv else '-aq', self._preferredquality]
|
||||||
else:
|
else:
|
||||||
more_opts += [self._exes['avconv'] and '-b:a' or '-ab', self._preferredquality + 'k']
|
more_opts += ['-b:a' if uses_avconv else '-ab', self._preferredquality + 'k']
|
||||||
if self._preferredcodec == 'aac':
|
if self._preferredcodec == 'aac':
|
||||||
more_opts += ['-f', 'adts']
|
more_opts += ['-f', 'adts']
|
||||||
if self._preferredcodec == 'm4a':
|
if self._preferredcodec == 'm4a':
|
||||||
more_opts += [self._exes['avconv'] and '-bsf:a' or '-absf', 'aac_adtstoasc']
|
more_opts += ['-bsf:a' if uses_avconv else '-absf', 'aac_adtstoasc']
|
||||||
if self._preferredcodec == 'vorbis':
|
if self._preferredcodec == 'vorbis':
|
||||||
extension = 'ogg'
|
extension = 'ogg'
|
||||||
if self._preferredcodec == 'wav':
|
if self._preferredcodec == 'wav':
|
||||||
@@ -169,14 +177,14 @@ class FFmpegExtractAudioPP(FFmpegPostProcessor):
|
|||||||
if self._nopostoverwrites and os.path.exists(encodeFilename(new_path)):
|
if self._nopostoverwrites and os.path.exists(encodeFilename(new_path)):
|
||||||
self._downloader.to_screen(u'[youtube] Post-process file %s exists, skipping' % new_path)
|
self._downloader.to_screen(u'[youtube] Post-process file %s exists, skipping' % new_path)
|
||||||
else:
|
else:
|
||||||
self._downloader.to_screen(u'[' + (self._exes['avconv'] and 'avconv' or 'ffmpeg') + '] Destination: ' + new_path)
|
self._downloader.to_screen(u'[' + self._get_executable() + '] Destination: ' + new_path)
|
||||||
self.run_ffmpeg(path, new_path, acodec, more_opts)
|
self.run_ffmpeg(path, new_path, acodec, more_opts)
|
||||||
except:
|
except:
|
||||||
etype,e,tb = sys.exc_info()
|
etype,e,tb = sys.exc_info()
|
||||||
if isinstance(e, AudioConversionError):
|
if isinstance(e, AudioConversionError):
|
||||||
msg = u'audio conversion failed: ' + e.msg
|
msg = u'audio conversion failed: ' + e.msg
|
||||||
else:
|
else:
|
||||||
msg = u'error running ' + (self._exes['avconv'] and 'avconv' or 'ffmpeg')
|
msg = u'error running ' + self._get_executable()
|
||||||
raise PostProcessingError(msg)
|
raise PostProcessingError(msg)
|
||||||
|
|
||||||
# Try to update the date time for extracted audio file.
|
# Try to update the date time for extracted audio file.
|
||||||
@@ -471,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
|
||||||
|
|
||||||
|
@@ -6,7 +6,6 @@ from .common import PostProcessor
|
|||||||
from ..utils import (
|
from ..utils import (
|
||||||
check_executable,
|
check_executable,
|
||||||
hyphenate_date,
|
hyphenate_date,
|
||||||
preferredencoding,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -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__ = '2014.01.07.3'
|
__version__ = '2014.01.23.3'
|
||||||
|
Reference in New Issue
Block a user