Compare commits
228 Commits
2014.01.22
...
2014.02.06
Author | SHA1 | Date | |
---|---|---|---|
63424b6233 | |||
0bf35c5cf5 | |||
95c29381eb | |||
94c4abce7f | |||
df872ec4e7 | |||
5de90176d9 | |||
dcf3eec47a | |||
e9e4f30d26 | |||
83cebd73d4 | |||
1df4229bd7 | |||
3c995527e9 | |||
7c62b568a2 | |||
ccf9114e84 | |||
d8061908bb | |||
211e17dd43 | |||
6cb38a9994 | |||
fa7df757a7 | |||
8c82077619 | |||
e5d1f9e50a | |||
7ee50ae7b5 | |||
de563c9da0 | |||
50451f2a18 | |||
9bc70948e1 | |||
5dc733f071 | |||
bc4850908c | |||
20650c8654 | |||
56dced2670 | |||
eef726c04b | |||
acf1555d76 | |||
22e7f1a6ec | |||
3c49325658 | |||
bb1cd2bea1 | |||
fdf1f8d4ce | |||
117c8c6b97 | |||
5cef4ff09b | |||
91264ce572 | |||
c79ef8e1ae | |||
58d915df51 | |||
7881a64499 | |||
90159f5561 | |||
99877772d0 | |||
b0268cb6ce | |||
4edff4cfa8 | |||
1eac553e7e | |||
9d3ac7444d | |||
588128d054 | |||
8e93b9b9aa | |||
b4bcffefa3 | |||
2b39af9b4f | |||
23fe495feb | |||
b5dbe89bba | |||
dbe80ca7ad | |||
009a3408f5 | |||
b58e3c8918 | |||
56b6faf91e | |||
7ac1f877a7 | |||
d55433bbfd | |||
f0ce2bc1c5 | |||
c3bc00b90e | |||
ff6b7b049b | |||
f46359121f | |||
37c1525c17 | |||
c85e4cf7b4 | |||
c66dcda287 | |||
6d845922ab | |||
2949cbe036 | |||
c3309a7774 | |||
7aed837595 | |||
0eb799bae9 | |||
4baff4a4ae | |||
45d7bc2f8b | |||
c0c2ddddcd | |||
a96ed91610 | |||
c1206423c4 | |||
659aa21ba1 | |||
efd02e858a | |||
3bf8bc7f37 | |||
8ccda826d5 | |||
b9381e43c2 | |||
fcdea2666d | |||
c4db377cbb | |||
90dc5e8693 | |||
c81a855b0f | |||
c8d8ec8567 | |||
4f879a5be0 | |||
1a0648b4a9 | |||
3c1b4669d0 | |||
24b3d5e538 | |||
ab083b08ab | |||
89acb96927 | |||
79752e18b1 | |||
55b41c723c | |||
9f8928d032 | |||
3effa7ceaa | |||
ed9cc2f1e0 | |||
975fa541c2 | |||
251974e44c | |||
38a40276ec | |||
57b6288358 | |||
c3f51436bf | |||
0c708f11cb | |||
fb2a706d11 | |||
0b76600deb | |||
245b612a36 | |||
d882161d5a | |||
d4a21e0b49 | |||
26a78d4bbf | |||
8db69786c2 | |||
b11cec4162 | |||
7eeb5bef24 | |||
9d2032932c | |||
6490306017 | |||
ceb2b7d257 | |||
459a53c2c2 | |||
adc267eebf | |||
ffe8f62d27 | |||
ed85007039 | |||
5aaca50d60 | |||
869baf3565 | |||
e299f6d27f | |||
4a192f817e | |||
bc1d1a5a71 | |||
456895d9cf | |||
218c15ab59 | |||
17ab4d3b5e | |||
31ef0ff038 | |||
37e3b90d59 | |||
00ff8f92a5 | |||
4857beba3a | |||
c1e60cc2bf | |||
98669ed79c | |||
a3978a6159 | |||
e3a9f32f52 | |||
87fac3238d | |||
a2fb2a2134 | |||
9e8ee54553 | |||
117bec936c | |||
1547c8cc88 | |||
075911d48e | |||
b21a918984 | |||
f9b8549609 | |||
d1b30713fb | |||
e2ba07024f | |||
9b05bd42e5 | |||
b6d3a99678 | |||
96d7b8873a | |||
efc867775e | |||
5ab772f09c | |||
2a89386232 | |||
4d9be98dbc | |||
6737907826 | |||
c060b77446 | |||
7e8caf30c0 | |||
ca3e054750 | |||
1da1558f46 | |||
25c67d257c | |||
a17d16d59c | |||
d16076ff3e | |||
6c57e8a063 | |||
db1f388878 | |||
0f2999fe2b | |||
53bfd6b24c | |||
5700e7792a | |||
38c2e5b8d5 | |||
48f9678a32 | |||
beddbc2ad1 | |||
f89197d73e | |||
944d65c762 | |||
f945612bd0 | |||
59188de113 | |||
352d08e3e5 | |||
bacb5e4f44 | |||
008af8660b | |||
886fa72324 | |||
2c5bae429a | |||
f265fc1238 | |||
1394ce65b4 | |||
67ccb77197 | |||
63ef36e8d8 | |||
0b65e5d40f | |||
629be17af4 | |||
fd28827864 | |||
8c61d9a9b1 | |||
975d35dbab | |||
8b769664c4 | |||
76f270a46a | |||
9dab1b7f28 | |||
d3e5bbf437 | |||
18a25c5d78 | |||
924f47f7b6 | |||
22ff1c4a93 | |||
35409e1101 | |||
65d781128a | |||
c35b1b07e2 | |||
066f6a0630 | |||
12ed57418c | |||
8b1be5cd73 | |||
780083dbc6 | |||
4919603f66 | |||
dd26ced164 | |||
bd2d82a5d3 | |||
c4cd138b92 | |||
65697b3bf3 | |||
50317b111d | |||
d7975ea287 | |||
714d709a31 | |||
11577ec054 | |||
79bf58f9b5 | |||
cd8a562267 | |||
de3ef3ed58 | |||
8908741806 | |||
ba7678f9cc | |||
a70c83768e | |||
04b4d394d9 | |||
130f12985a | |||
4ca5d43cd8 | |||
4bbf139aa7 | |||
47739636a9 | |||
407ae733ab | |||
c39f7013e1 | |||
a4a028323e | |||
780ee4e501 | |||
d7b51547c0 | |||
43030f36db | |||
48c63f1653 | |||
90f479b6d5 | |||
b7ab059084 | |||
dd27fd1739 |
417
README.md
417
README.md
@ -14,194 +14,235 @@ your Unix box, on Windows or on Mac OS X. It is released to the public domain,
|
|||||||
which means you can modify it, redistribute it or use it however you like.
|
which means you can modify it, redistribute it or use it however you like.
|
||||||
|
|
||||||
# OPTIONS
|
# OPTIONS
|
||||||
-h, --help print this help text and exit
|
-h, --help print this help text and exit
|
||||||
--version print program version and exit
|
--version print program version and exit
|
||||||
-U, --update update this program to latest version. Make sure
|
-U, --update update this program to latest version. Make
|
||||||
that you have sufficient permissions (run with
|
sure that you have sufficient permissions
|
||||||
sudo if needed)
|
(run with sudo if needed)
|
||||||
-i, --ignore-errors continue on download errors, for example to to
|
-i, --ignore-errors continue on download errors, for example to
|
||||||
skip unavailable videos in a playlist
|
to skip unavailable videos in a playlist
|
||||||
--abort-on-error Abort downloading of further videos (in the
|
--abort-on-error Abort downloading of further videos (in the
|
||||||
playlist or the command line) if an error occurs
|
playlist or the command line) if an error
|
||||||
--dump-user-agent display the current browser identification
|
occurs
|
||||||
--user-agent UA specify a custom user agent
|
--dump-user-agent display the current browser identification
|
||||||
--referer REF specify a custom referer, use if the video access
|
--user-agent UA specify a custom user agent
|
||||||
is restricted to one domain
|
--referer REF specify a custom referer, use if the video
|
||||||
--list-extractors List all supported extractors and the URLs they
|
access is restricted to one domain
|
||||||
would handle
|
--list-extractors List all supported extractors and the URLs
|
||||||
--extractor-descriptions Output descriptions of all supported extractors
|
they would handle
|
||||||
--proxy URL Use the specified HTTP/HTTPS proxy. Pass in an
|
--extractor-descriptions Output descriptions of all supported
|
||||||
empty string (--proxy "") for direct connection
|
extractors
|
||||||
--no-check-certificate Suppress HTTPS certificate validation.
|
--proxy URL Use the specified HTTP/HTTPS proxy. Pass in
|
||||||
--cache-dir DIR Location in the filesystem where youtube-dl can
|
an empty string (--proxy "") for direct
|
||||||
store some downloaded information permanently. By
|
connection
|
||||||
default $XDG_CACHE_HOME/youtube-dl or ~/.cache
|
--no-check-certificate Suppress HTTPS certificate validation.
|
||||||
/youtube-dl . At the moment, only YouTube player
|
--cache-dir DIR Location in the filesystem where youtube-dl
|
||||||
files (for videos with obfuscated signatures) are
|
can store some downloaded information
|
||||||
cached, but that may change.
|
permanently. By default $XDG_CACHE_HOME
|
||||||
--no-cache-dir Disable filesystem caching
|
/youtube-dl or ~/.cache/youtube-dl . At the
|
||||||
--socket-timeout None Time to wait before giving up, in seconds
|
moment, only YouTube player files (for
|
||||||
--bidi-workaround Work around terminals that lack bidirectional
|
videos with obfuscated signatures) are
|
||||||
text support. Requires bidiv or fribidi
|
cached, but that may change.
|
||||||
executable in PATH
|
--no-cache-dir Disable filesystem caching
|
||||||
|
--socket-timeout None Time to wait before giving up, in seconds
|
||||||
|
--bidi-workaround Work around terminals that lack
|
||||||
|
bidirectional text support. Requires bidiv
|
||||||
|
or fribidi executable in PATH
|
||||||
|
--default-search PREFIX Use this prefix for unqualified URLs. For
|
||||||
|
example "gvsearch2:" downloads two videos
|
||||||
|
from google videos for youtube-dl "large
|
||||||
|
apple". By default (with value "auto")
|
||||||
|
youtube-dl guesses.
|
||||||
|
--ignore-config Do not read configuration files. When given
|
||||||
|
in the global configuration file /etc
|
||||||
|
/youtube-dl.conf: do not read the user
|
||||||
|
configuration in ~/.config/youtube-dl.conf
|
||||||
|
(%APPDATA%/youtube-dl/config.txt on
|
||||||
|
Windows)
|
||||||
|
|
||||||
## Video Selection:
|
## Video Selection:
|
||||||
--playlist-start NUMBER playlist video to start at (default is 1)
|
--playlist-start NUMBER playlist video to start at (default is 1)
|
||||||
--playlist-end NUMBER playlist video to end at (default is last)
|
--playlist-end NUMBER playlist video to end at (default is last)
|
||||||
--match-title REGEX download only matching titles (regex or caseless
|
--match-title REGEX download only matching titles (regex or
|
||||||
sub-string)
|
caseless sub-string)
|
||||||
--reject-title REGEX skip download for matching titles (regex or
|
--reject-title REGEX skip download for matching titles (regex or
|
||||||
caseless sub-string)
|
caseless sub-string)
|
||||||
--max-downloads NUMBER Abort after downloading NUMBER files
|
--max-downloads NUMBER Abort after downloading NUMBER files
|
||||||
--min-filesize SIZE Do not download any videos smaller than SIZE
|
--min-filesize SIZE Do not download any videos smaller than
|
||||||
(e.g. 50k or 44.6m)
|
SIZE (e.g. 50k or 44.6m)
|
||||||
--max-filesize SIZE Do not download any videos larger than SIZE (e.g.
|
--max-filesize SIZE Do not download any videos larger than SIZE
|
||||||
50k or 44.6m)
|
(e.g. 50k or 44.6m)
|
||||||
--date DATE download only videos uploaded in this date
|
--date DATE download only videos uploaded in this date
|
||||||
--datebefore DATE download only videos uploaded on or before this
|
--datebefore DATE download only videos uploaded on or before
|
||||||
date (i.e. inclusive)
|
this date (i.e. inclusive)
|
||||||
--dateafter DATE download only videos uploaded on or after this
|
--dateafter DATE download only videos uploaded on or after
|
||||||
date (i.e. inclusive)
|
this date (i.e. inclusive)
|
||||||
--min-views COUNT Do not download any videos with less than COUNT
|
--min-views COUNT Do not download any videos with less than
|
||||||
views
|
COUNT views
|
||||||
--max-views COUNT Do not download any videos with more than COUNT
|
--max-views COUNT Do not download any videos with more than
|
||||||
views
|
COUNT views
|
||||||
--no-playlist download only the currently playing video
|
--no-playlist download only the currently playing video
|
||||||
--age-limit YEARS download only videos suitable for the given age
|
--age-limit YEARS download only videos suitable for the given
|
||||||
--download-archive FILE Download only videos not listed in the archive
|
age
|
||||||
file. Record the IDs of all downloaded videos in
|
--download-archive FILE Download only videos not listed in the
|
||||||
it.
|
archive file. Record the IDs of all
|
||||||
--include-ads Download advertisements as well (experimental)
|
downloaded videos in it.
|
||||||
|
--include-ads Download advertisements as well
|
||||||
|
(experimental)
|
||||||
|
--youtube-include-dash-manifest Try to download the DASH manifest on
|
||||||
|
YouTube videos (experimental)
|
||||||
|
|
||||||
## Download Options:
|
## Download Options:
|
||||||
-r, --rate-limit LIMIT maximum download rate in bytes per second (e.g.
|
-r, --rate-limit LIMIT maximum download rate in bytes per second
|
||||||
50K or 4.2M)
|
(e.g. 50K or 4.2M)
|
||||||
-R, --retries RETRIES number of retries (default is 10)
|
-R, --retries RETRIES number of retries (default is 10)
|
||||||
--buffer-size SIZE size of download buffer (e.g. 1024 or 16K)
|
--buffer-size SIZE size of download buffer (e.g. 1024 or 16K)
|
||||||
(default is 1024)
|
(default is 1024)
|
||||||
--no-resize-buffer do not automatically adjust the buffer size. By
|
--no-resize-buffer do not automatically adjust the buffer
|
||||||
default, the buffer size is automatically resized
|
size. By default, the buffer size is
|
||||||
from an initial value of SIZE.
|
automatically resized from an initial value
|
||||||
|
of SIZE.
|
||||||
|
|
||||||
## Filesystem Options:
|
## Filesystem Options:
|
||||||
-t, --title use title in file name (default)
|
-t, --title use title in file name (default)
|
||||||
--id use only video ID in file name
|
--id use only video ID in file name
|
||||||
-l, --literal [deprecated] alias of --title
|
-l, --literal [deprecated] alias of --title
|
||||||
-A, --auto-number number downloaded files starting from 00000
|
-A, --auto-number number downloaded files starting from 00000
|
||||||
-o, --output TEMPLATE output filename template. Use %(title)s to get
|
-o, --output TEMPLATE output filename template. Use %(title)s to
|
||||||
the title, %(uploader)s for the uploader name,
|
get the title, %(uploader)s for the
|
||||||
%(uploader_id)s for the uploader nickname if
|
uploader name, %(uploader_id)s for the
|
||||||
different, %(autonumber)s to get an automatically
|
uploader nickname if different,
|
||||||
incremented number, %(ext)s for the filename
|
%(autonumber)s to get an automatically
|
||||||
extension, %(format)s for the format description
|
incremented number, %(ext)s for the
|
||||||
(like "22 - 1280x720" or "HD"), %(format_id)s for
|
filename extension, %(format)s for the
|
||||||
the unique id of the format (like Youtube's
|
format description (like "22 - 1280x720" or
|
||||||
itags: "137"), %(upload_date)s for the upload
|
"HD"), %(format_id)s for the unique id of
|
||||||
date (YYYYMMDD), %(extractor)s for the provider
|
the format (like Youtube's itags: "137"),
|
||||||
(youtube, metacafe, etc), %(id)s for the video
|
%(upload_date)s for the upload date
|
||||||
id, %(playlist)s for the playlist the video is
|
(YYYYMMDD), %(extractor)s for the provider
|
||||||
in, %(playlist_index)s for the position in the
|
(youtube, metacafe, etc), %(id)s for the
|
||||||
playlist and %% for a literal percent. Use - to
|
video id, %(playlist)s for the playlist the
|
||||||
output to stdout. Can also be used to download to
|
video is in, %(playlist_index)s for the
|
||||||
a different directory, for example with -o '/my/d
|
position in the playlist and %% for a
|
||||||
ownloads/%(uploader)s/%(title)s-%(id)s.%(ext)s' .
|
literal percent. Use - to output to stdout.
|
||||||
--autonumber-size NUMBER Specifies the number of digits in %(autonumber)s
|
Can also be used to download to a different
|
||||||
when it is present in output filename template or
|
directory, for example with -o '/my/downloa
|
||||||
--auto-number option is given
|
ds/%(uploader)s/%(title)s-%(id)s.%(ext)s' .
|
||||||
--restrict-filenames Restrict filenames to only ASCII characters, and
|
--autonumber-size NUMBER Specifies the number of digits in
|
||||||
avoid "&" and spaces in filenames
|
%(autonumber)s when it is present in output
|
||||||
-a, --batch-file FILE file containing URLs to download ('-' for stdin)
|
filename template or --auto-number option
|
||||||
--load-info FILE json file containing the video information
|
is given
|
||||||
(created with the "--write-json" option)
|
--restrict-filenames Restrict filenames to only ASCII
|
||||||
-w, --no-overwrites do not overwrite files
|
characters, and avoid "&" and spaces in
|
||||||
-c, --continue force resume of partially downloaded files. By
|
filenames
|
||||||
default, youtube-dl will resume downloads if
|
-a, --batch-file FILE file containing URLs to download ('-' for
|
||||||
possible.
|
stdin)
|
||||||
--no-continue do not resume partially downloaded files (restart
|
--load-info FILE json file containing the video information
|
||||||
from beginning)
|
(created with the "--write-json" option)
|
||||||
--cookies FILE file to read cookies from and dump cookie jar in
|
-w, --no-overwrites do not overwrite files
|
||||||
--no-part do not use .part files
|
-c, --continue force resume of partially downloaded files.
|
||||||
--no-mtime do not use the Last-modified header to set the
|
By default, youtube-dl will resume
|
||||||
file modification time
|
downloads if possible.
|
||||||
--write-description write video description to a .description file
|
--no-continue do not resume partially downloaded files
|
||||||
--write-info-json write video metadata to a .info.json file
|
(restart from beginning)
|
||||||
--write-annotations write video annotations to a .annotation file
|
--cookies FILE file to read cookies from and dump cookie
|
||||||
--write-thumbnail write thumbnail image to disk
|
jar in
|
||||||
|
--no-part do not use .part files
|
||||||
|
--no-mtime do not use the Last-modified header to set
|
||||||
|
the file modification time
|
||||||
|
--write-description write video description to a .description
|
||||||
|
file
|
||||||
|
--write-info-json write video metadata to a .info.json file
|
||||||
|
--write-annotations write video annotations to a .annotation
|
||||||
|
file
|
||||||
|
--write-thumbnail write thumbnail image to disk
|
||||||
|
|
||||||
## Verbosity / Simulation Options:
|
## Verbosity / Simulation Options:
|
||||||
-q, --quiet activates quiet mode
|
-q, --quiet activates quiet mode
|
||||||
-s, --simulate do not download the video and do not write
|
-s, --simulate do not download the video and do not write
|
||||||
anything to disk
|
anything to disk
|
||||||
--skip-download do not download the video
|
--skip-download do not download the video
|
||||||
-g, --get-url simulate, quiet but print URL
|
-g, --get-url simulate, quiet but print URL
|
||||||
-e, --get-title simulate, quiet but print title
|
-e, --get-title simulate, quiet but print title
|
||||||
--get-id simulate, quiet but print id
|
--get-id simulate, quiet but print id
|
||||||
--get-thumbnail simulate, quiet but print thumbnail URL
|
--get-thumbnail simulate, quiet but print thumbnail URL
|
||||||
--get-description simulate, quiet but print video description
|
--get-description simulate, quiet but print video description
|
||||||
--get-duration simulate, quiet but print video length
|
--get-duration simulate, quiet but print video length
|
||||||
--get-filename simulate, quiet but print output filename
|
--get-filename simulate, quiet but print output filename
|
||||||
--get-format simulate, quiet but print output format
|
--get-format simulate, quiet but print output format
|
||||||
-j, --dump-json simulate, quiet but print JSON information
|
-j, --dump-json simulate, quiet but print JSON information
|
||||||
--newline output progress bar as new lines
|
--newline output progress bar as new lines
|
||||||
--no-progress do not print progress bar
|
--no-progress do not print progress bar
|
||||||
--console-title display progress in console titlebar
|
--console-title display progress in console titlebar
|
||||||
-v, --verbose print various debugging information
|
-v, --verbose print various debugging information
|
||||||
--dump-intermediate-pages print downloaded pages to debug problems (very
|
--dump-intermediate-pages print downloaded pages to debug problems
|
||||||
verbose)
|
(very verbose)
|
||||||
--write-pages Write downloaded intermediary pages to files in
|
--write-pages Write downloaded intermediary pages to
|
||||||
the current directory to debug problems
|
files in the current directory to debug
|
||||||
|
problems
|
||||||
|
--print-traffic Display sent and read HTTP traffic
|
||||||
|
|
||||||
## Video Format Options:
|
## Video Format Options:
|
||||||
-f, --format FORMAT video format code, specify the order of
|
-f, --format FORMAT video format code, specify the order of
|
||||||
preference using slashes: "-f 22/17/18". "-f mp4"
|
preference using slashes: "-f 22/17/18".
|
||||||
and "-f flv" are also supported
|
"-f mp4" and "-f flv" are also supported.
|
||||||
--all-formats download all available video formats
|
You can also use the special names "best",
|
||||||
--prefer-free-formats prefer free video formats unless a specific one
|
"bestaudio", "worst", and "worstaudio". By
|
||||||
is requested
|
default, youtube-dl will pick the best
|
||||||
--max-quality FORMAT highest quality format to download
|
quality.
|
||||||
-F, --list-formats list all available formats
|
--all-formats download all available video formats
|
||||||
|
--prefer-free-formats prefer free video formats unless a specific
|
||||||
|
one is requested
|
||||||
|
--max-quality FORMAT highest quality format to download
|
||||||
|
-F, --list-formats list all available formats
|
||||||
|
|
||||||
## Subtitle Options:
|
## Subtitle Options:
|
||||||
--write-sub write subtitle file
|
--write-sub write subtitle file
|
||||||
--write-auto-sub write automatic subtitle file (youtube only)
|
--write-auto-sub write automatic subtitle file (youtube
|
||||||
--all-subs downloads all the available subtitles of the
|
only)
|
||||||
video
|
--all-subs downloads all the available subtitles of
|
||||||
--list-subs lists all available subtitles for the video
|
the video
|
||||||
--sub-format FORMAT subtitle format (default=srt) ([sbv/vtt] youtube
|
--list-subs lists all available subtitles for the video
|
||||||
only)
|
--sub-format FORMAT subtitle format (default=srt) ([sbv/vtt]
|
||||||
--sub-lang LANGS languages of the subtitles to download (optional)
|
youtube only)
|
||||||
separated by commas, use IETF language tags like
|
--sub-lang LANGS languages of the subtitles to download
|
||||||
'en,pt'
|
(optional) separated by commas, use IETF
|
||||||
|
language tags like 'en,pt'
|
||||||
|
|
||||||
## Authentication Options:
|
## Authentication Options:
|
||||||
-u, --username USERNAME account username
|
-u, --username USERNAME account username
|
||||||
-p, --password PASSWORD account password
|
-p, --password PASSWORD account password
|
||||||
-n, --netrc use .netrc authentication data
|
-n, --netrc use .netrc authentication data
|
||||||
--video-password PASSWORD video password (vimeo, smotri)
|
--video-password PASSWORD video password (vimeo, smotri)
|
||||||
|
|
||||||
## Post-processing Options:
|
## Post-processing Options:
|
||||||
-x, --extract-audio convert video files to audio-only files (requires
|
-x, --extract-audio convert video files to audio-only files
|
||||||
ffmpeg or avconv and ffprobe or avprobe)
|
(requires ffmpeg or avconv and ffprobe or
|
||||||
--audio-format FORMAT "best", "aac", "vorbis", "mp3", "m4a", "opus", or
|
avprobe)
|
||||||
"wav"; best by default
|
--audio-format FORMAT "best", "aac", "vorbis", "mp3", "m4a",
|
||||||
--audio-quality QUALITY ffmpeg/avconv audio quality specification, insert
|
"opus", or "wav"; best by default
|
||||||
a value between 0 (better) and 9 (worse) for VBR
|
--audio-quality QUALITY ffmpeg/avconv audio quality specification,
|
||||||
or a specific bitrate like 128K (default 5)
|
insert a value between 0 (better) and 9
|
||||||
--recode-video FORMAT Encode the video to another format if necessary
|
(worse) for VBR or a specific bitrate like
|
||||||
(currently supported: mp4|flv|ogg|webm)
|
128K (default 5)
|
||||||
-k, --keep-video keeps the video file on disk after the post-
|
--recode-video FORMAT Encode the video to another format if
|
||||||
processing; the video is erased by default
|
necessary (currently supported:
|
||||||
--no-post-overwrites do not overwrite post-processed files; the post-
|
mp4|flv|ogg|webm)
|
||||||
processed files are overwritten by default
|
-k, --keep-video keeps the video file on disk after the
|
||||||
--embed-subs embed subtitles in the video (only for mp4
|
post-processing; the video is erased by
|
||||||
videos)
|
default
|
||||||
--add-metadata write metadata to the video file
|
--no-post-overwrites do not overwrite post-processed files; the
|
||||||
--xattrs write metadata to the video file's xattrs (using
|
post-processed files are overwritten by
|
||||||
dublin core and xdg standards)
|
default
|
||||||
--prefer-avconv Prefer avconv over ffmpeg for running the
|
--embed-subs embed subtitles in the video (only for mp4
|
||||||
postprocessors (default)
|
videos)
|
||||||
--prefer-ffmpeg Prefer ffmpeg over avconv for running the
|
--add-metadata write metadata to the video file
|
||||||
postprocessors
|
--xattrs write metadata to the video file's xattrs
|
||||||
|
(using dublin core and xdg standards)
|
||||||
|
--prefer-avconv Prefer avconv over ffmpeg for running the
|
||||||
|
postprocessors (default)
|
||||||
|
--prefer-ffmpeg Prefer ffmpeg over avconv for running the
|
||||||
|
postprocessors
|
||||||
|
|
||||||
# CONFIGURATION
|
# CONFIGURATION
|
||||||
|
|
||||||
@ -290,11 +331,31 @@ 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
|
# DEVELOPER 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
|
||||||
|
|
||||||
|
### Adding support for a new site
|
||||||
|
|
||||||
|
If you want to add support for a new site, copy *any* [recently modified](https://github.com/rg3/youtube-dl/commits/master/youtube_dl/extractor) file in `youtube_dl/extractor`, add an import in [`youtube_dl/extractor/__init__.py`](https://github.com/rg3/youtube-dl/blob/master/youtube_dl/extractor/__init__.py). Have a look at [`youtube_dl/common/extractor/common.py`](https://github.com/rg3/youtube-dl/blob/master/youtube_dl/extractor/common.py) for possible helper methods and a [detailed description of what your extractor should return](https://github.com/rg3/youtube-dl/blob/master/youtube_dl/extractor/common.py#L38). Don't forget to run the tests with `python test/test_download.py Test_Download.test_YourExtractor`! For a detailed tutorial, refer to [this blog post](http://filippo.io/add-support-for-a-new-video-site-to-youtube-dl/).
|
||||||
|
|
||||||
# BUGS
|
# BUGS
|
||||||
|
|
||||||
@ -353,3 +414,9 @@ Only post features that you (or an incapicated friend you can personally talk to
|
|||||||
### Is your question about youtube-dl?
|
### Is your question about youtube-dl?
|
||||||
|
|
||||||
It may sound strange, but some bug reports we receive are completely unrelated to youtube-dl and relate to a different or even the reporter's own application. Please make sure that you are actually using youtube-dl. If you are using a UI for youtube-dl, report the bug to the maintainer of the actual application providing the UI. On the other hand, if your UI for youtube-dl fails in some way you believe is related to youtube-dl, by all means, go ahead and report the bug.
|
It may sound strange, but some bug reports we receive are completely unrelated to youtube-dl and relate to a different or even the reporter's own application. Please make sure that you are actually using youtube-dl. If you are using a UI for youtube-dl, report the bug to the maintainer of the actual application providing the UI. On the other hand, if your UI for youtube-dl fails in some way you believe is related to youtube-dl, by all means, go ahead and report the bug.
|
||||||
|
|
||||||
|
# COPYRIGHT
|
||||||
|
|
||||||
|
youtube-dl is released into the public domain by the copyright holders.
|
||||||
|
|
||||||
|
This README file was originally written by Daniel Bolton (<https://github.com/dbbolton>) and is likewise released into the public domain.
|
||||||
|
24
setup.py
24
setup.py
@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
import os.path
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
|
import warnings
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -44,12 +46,24 @@ py2exe_params = {
|
|||||||
if len(sys.argv) >= 2 and sys.argv[1] == 'py2exe':
|
if len(sys.argv) >= 2 and sys.argv[1] == 'py2exe':
|
||||||
params = py2exe_params
|
params = py2exe_params
|
||||||
else:
|
else:
|
||||||
|
files_spec = [
|
||||||
|
('etc/bash_completion.d', ['youtube-dl.bash-completion']),
|
||||||
|
('share/doc/youtube_dl', ['README.txt']),
|
||||||
|
('share/man/man1', ['youtube-dl.1'])
|
||||||
|
]
|
||||||
|
root = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
data_files = []
|
||||||
|
for dirname, files in files_spec:
|
||||||
|
resfiles = []
|
||||||
|
for fn in files:
|
||||||
|
if not os.path.exists(fn):
|
||||||
|
warnings.warn('Skipping file %s since it is not present. Type make to build all automatically generated files.' % fn)
|
||||||
|
else:
|
||||||
|
resfiles.append(fn)
|
||||||
|
data_files.append((dirname, resfiles))
|
||||||
|
|
||||||
params = {
|
params = {
|
||||||
'data_files': [ # Installing system-wide would require sudo...
|
'data_files': data_files,
|
||||||
('etc/bash_completion.d', ['youtube-dl.bash-completion']),
|
|
||||||
('share/doc/youtube_dl', ['README.txt']),
|
|
||||||
('share/man/man1', ['youtube-dl.1'])
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
if setuptools_available:
|
if setuptools_available:
|
||||||
params['entry_points'] = {'console_scripts': ['youtube-dl = youtube_dl:main']}
|
params['entry_points'] = {'console_scripts': ['youtube-dl = youtube_dl:main']}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
# Allow direct execution
|
# Allow direct execution
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
@ -30,125 +32,155 @@ class TestFormatSelection(unittest.TestCase):
|
|||||||
ydl = YDL()
|
ydl = YDL()
|
||||||
ydl.params['prefer_free_formats'] = True
|
ydl.params['prefer_free_formats'] = True
|
||||||
formats = [
|
formats = [
|
||||||
{u'ext': u'webm', u'height': 460},
|
{'ext': 'webm', 'height': 460},
|
||||||
{u'ext': u'mp4', u'height': 460},
|
{'ext': 'mp4', 'height': 460},
|
||||||
]
|
]
|
||||||
info_dict = {u'formats': formats, u'extractor': u'test'}
|
info_dict = {'formats': formats, 'extractor': 'test'}
|
||||||
yie = YoutubeIE(ydl)
|
yie = YoutubeIE(ydl)
|
||||||
yie._sort_formats(info_dict['formats'])
|
yie._sort_formats(info_dict['formats'])
|
||||||
ydl.process_ie_result(info_dict)
|
ydl.process_ie_result(info_dict)
|
||||||
downloaded = ydl.downloaded_info_dicts[0]
|
downloaded = ydl.downloaded_info_dicts[0]
|
||||||
self.assertEqual(downloaded[u'ext'], u'webm')
|
self.assertEqual(downloaded['ext'], 'webm')
|
||||||
|
|
||||||
# Different resolution => download best quality (mp4)
|
# Different resolution => download best quality (mp4)
|
||||||
ydl = YDL()
|
ydl = YDL()
|
||||||
ydl.params['prefer_free_formats'] = True
|
ydl.params['prefer_free_formats'] = True
|
||||||
formats = [
|
formats = [
|
||||||
{u'ext': u'webm', u'height': 720},
|
{'ext': 'webm', 'height': 720},
|
||||||
{u'ext': u'mp4', u'height': 1080},
|
{'ext': 'mp4', 'height': 1080},
|
||||||
]
|
]
|
||||||
info_dict[u'formats'] = formats
|
info_dict['formats'] = formats
|
||||||
yie = YoutubeIE(ydl)
|
yie = YoutubeIE(ydl)
|
||||||
yie._sort_formats(info_dict['formats'])
|
yie._sort_formats(info_dict['formats'])
|
||||||
ydl.process_ie_result(info_dict)
|
ydl.process_ie_result(info_dict)
|
||||||
downloaded = ydl.downloaded_info_dicts[0]
|
downloaded = ydl.downloaded_info_dicts[0]
|
||||||
self.assertEqual(downloaded[u'ext'], u'mp4')
|
self.assertEqual(downloaded['ext'], 'mp4')
|
||||||
|
|
||||||
# No prefer_free_formats => prefer mp4 and flv for greater compatibilty
|
# No prefer_free_formats => prefer mp4 and flv for greater compatibilty
|
||||||
ydl = YDL()
|
ydl = YDL()
|
||||||
ydl.params['prefer_free_formats'] = False
|
ydl.params['prefer_free_formats'] = False
|
||||||
formats = [
|
formats = [
|
||||||
{u'ext': u'webm', u'height': 720},
|
{'ext': 'webm', 'height': 720},
|
||||||
{u'ext': u'mp4', u'height': 720},
|
{'ext': 'mp4', 'height': 720},
|
||||||
{u'ext': u'flv', u'height': 720},
|
{'ext': 'flv', 'height': 720},
|
||||||
]
|
]
|
||||||
info_dict[u'formats'] = formats
|
info_dict['formats'] = formats
|
||||||
yie = YoutubeIE(ydl)
|
yie = YoutubeIE(ydl)
|
||||||
yie._sort_formats(info_dict['formats'])
|
yie._sort_formats(info_dict['formats'])
|
||||||
ydl.process_ie_result(info_dict)
|
ydl.process_ie_result(info_dict)
|
||||||
downloaded = ydl.downloaded_info_dicts[0]
|
downloaded = ydl.downloaded_info_dicts[0]
|
||||||
self.assertEqual(downloaded[u'ext'], u'mp4')
|
self.assertEqual(downloaded['ext'], 'mp4')
|
||||||
|
|
||||||
ydl = YDL()
|
ydl = YDL()
|
||||||
ydl.params['prefer_free_formats'] = False
|
ydl.params['prefer_free_formats'] = False
|
||||||
formats = [
|
formats = [
|
||||||
{u'ext': u'flv', u'height': 720},
|
{'ext': 'flv', 'height': 720},
|
||||||
{u'ext': u'webm', u'height': 720},
|
{'ext': 'webm', 'height': 720},
|
||||||
]
|
]
|
||||||
info_dict[u'formats'] = formats
|
info_dict['formats'] = formats
|
||||||
yie = YoutubeIE(ydl)
|
yie = YoutubeIE(ydl)
|
||||||
yie._sort_formats(info_dict['formats'])
|
yie._sort_formats(info_dict['formats'])
|
||||||
ydl.process_ie_result(info_dict)
|
ydl.process_ie_result(info_dict)
|
||||||
downloaded = ydl.downloaded_info_dicts[0]
|
downloaded = ydl.downloaded_info_dicts[0]
|
||||||
self.assertEqual(downloaded[u'ext'], u'flv')
|
self.assertEqual(downloaded['ext'], 'flv')
|
||||||
|
|
||||||
def test_format_limit(self):
|
def test_format_limit(self):
|
||||||
formats = [
|
formats = [
|
||||||
{u'format_id': u'meh', u'url': u'http://example.com/meh', 'preference': 1},
|
{'format_id': 'meh', 'url': 'http://example.com/meh', 'preference': 1},
|
||||||
{u'format_id': u'good', u'url': u'http://example.com/good', 'preference': 2},
|
{'format_id': 'good', 'url': 'http://example.com/good', 'preference': 2},
|
||||||
{u'format_id': u'great', u'url': u'http://example.com/great', 'preference': 3},
|
{'format_id': 'great', 'url': 'http://example.com/great', 'preference': 3},
|
||||||
{u'format_id': u'excellent', u'url': u'http://example.com/exc', 'preference': 4},
|
{'format_id': 'excellent', 'url': 'http://example.com/exc', 'preference': 4},
|
||||||
]
|
]
|
||||||
info_dict = {
|
info_dict = {
|
||||||
u'formats': formats, u'extractor': u'test', 'id': 'testvid'}
|
'formats': formats, 'extractor': 'test', 'id': 'testvid'}
|
||||||
|
|
||||||
ydl = YDL()
|
ydl = YDL()
|
||||||
ydl.process_ie_result(info_dict)
|
ydl.process_ie_result(info_dict)
|
||||||
downloaded = ydl.downloaded_info_dicts[0]
|
downloaded = ydl.downloaded_info_dicts[0]
|
||||||
self.assertEqual(downloaded[u'format_id'], u'excellent')
|
self.assertEqual(downloaded['format_id'], 'excellent')
|
||||||
|
|
||||||
ydl = YDL({'format_limit': 'good'})
|
ydl = YDL({'format_limit': 'good'})
|
||||||
assert ydl.params['format_limit'] == 'good'
|
assert ydl.params['format_limit'] == 'good'
|
||||||
ydl.process_ie_result(info_dict.copy())
|
ydl.process_ie_result(info_dict.copy())
|
||||||
downloaded = ydl.downloaded_info_dicts[0]
|
downloaded = ydl.downloaded_info_dicts[0]
|
||||||
self.assertEqual(downloaded[u'format_id'], u'good')
|
self.assertEqual(downloaded['format_id'], 'good')
|
||||||
|
|
||||||
ydl = YDL({'format_limit': 'great', 'format': 'all'})
|
ydl = YDL({'format_limit': 'great', 'format': 'all'})
|
||||||
ydl.process_ie_result(info_dict.copy())
|
ydl.process_ie_result(info_dict.copy())
|
||||||
self.assertEqual(ydl.downloaded_info_dicts[0][u'format_id'], u'meh')
|
self.assertEqual(ydl.downloaded_info_dicts[0]['format_id'], 'meh')
|
||||||
self.assertEqual(ydl.downloaded_info_dicts[1][u'format_id'], u'good')
|
self.assertEqual(ydl.downloaded_info_dicts[1]['format_id'], 'good')
|
||||||
self.assertEqual(ydl.downloaded_info_dicts[2][u'format_id'], u'great')
|
self.assertEqual(ydl.downloaded_info_dicts[2]['format_id'], 'great')
|
||||||
self.assertTrue('3' in ydl.msgs[0])
|
self.assertTrue('3' in ydl.msgs[0])
|
||||||
|
|
||||||
ydl = YDL()
|
ydl = YDL()
|
||||||
ydl.params['format_limit'] = 'excellent'
|
ydl.params['format_limit'] = 'excellent'
|
||||||
ydl.process_ie_result(info_dict.copy())
|
ydl.process_ie_result(info_dict.copy())
|
||||||
downloaded = ydl.downloaded_info_dicts[0]
|
downloaded = ydl.downloaded_info_dicts[0]
|
||||||
self.assertEqual(downloaded[u'format_id'], u'excellent')
|
self.assertEqual(downloaded['format_id'], 'excellent')
|
||||||
|
|
||||||
def test_format_selection(self):
|
def test_format_selection(self):
|
||||||
formats = [
|
formats = [
|
||||||
{u'format_id': u'35', u'ext': u'mp4', 'preference': 1},
|
{'format_id': '35', 'ext': 'mp4', 'preference': 1},
|
||||||
{u'format_id': u'45', u'ext': u'webm', 'preference': 2},
|
{'format_id': '45', 'ext': 'webm', 'preference': 2},
|
||||||
{u'format_id': u'47', u'ext': u'webm', 'preference': 3},
|
{'format_id': '47', 'ext': 'webm', 'preference': 3},
|
||||||
{u'format_id': u'2', u'ext': u'flv', 'preference': 4},
|
{'format_id': '2', 'ext': 'flv', 'preference': 4},
|
||||||
]
|
]
|
||||||
info_dict = {u'formats': formats, u'extractor': u'test'}
|
info_dict = {'formats': formats, 'extractor': 'test'}
|
||||||
|
|
||||||
ydl = YDL({'format': u'20/47'})
|
ydl = YDL({'format': '20/47'})
|
||||||
ydl.process_ie_result(info_dict.copy())
|
ydl.process_ie_result(info_dict.copy())
|
||||||
downloaded = ydl.downloaded_info_dicts[0]
|
downloaded = ydl.downloaded_info_dicts[0]
|
||||||
self.assertEqual(downloaded['format_id'], u'47')
|
self.assertEqual(downloaded['format_id'], '47')
|
||||||
|
|
||||||
ydl = YDL({'format': u'20/71/worst'})
|
ydl = YDL({'format': '20/71/worst'})
|
||||||
ydl.process_ie_result(info_dict.copy())
|
ydl.process_ie_result(info_dict.copy())
|
||||||
downloaded = ydl.downloaded_info_dicts[0]
|
downloaded = ydl.downloaded_info_dicts[0]
|
||||||
self.assertEqual(downloaded['format_id'], u'35')
|
self.assertEqual(downloaded['format_id'], '35')
|
||||||
|
|
||||||
ydl = YDL()
|
ydl = YDL()
|
||||||
ydl.process_ie_result(info_dict.copy())
|
ydl.process_ie_result(info_dict.copy())
|
||||||
downloaded = ydl.downloaded_info_dicts[0]
|
downloaded = ydl.downloaded_info_dicts[0]
|
||||||
self.assertEqual(downloaded['format_id'], u'2')
|
self.assertEqual(downloaded['format_id'], '2')
|
||||||
|
|
||||||
ydl = YDL({'format': u'webm/mp4'})
|
ydl = YDL({'format': 'webm/mp4'})
|
||||||
ydl.process_ie_result(info_dict.copy())
|
ydl.process_ie_result(info_dict.copy())
|
||||||
downloaded = ydl.downloaded_info_dicts[0]
|
downloaded = ydl.downloaded_info_dicts[0]
|
||||||
self.assertEqual(downloaded['format_id'], u'47')
|
self.assertEqual(downloaded['format_id'], '47')
|
||||||
|
|
||||||
ydl = YDL({'format': u'3gp/40/mp4'})
|
ydl = YDL({'format': '3gp/40/mp4'})
|
||||||
ydl.process_ie_result(info_dict.copy())
|
ydl.process_ie_result(info_dict.copy())
|
||||||
downloaded = ydl.downloaded_info_dicts[0]
|
downloaded = ydl.downloaded_info_dicts[0]
|
||||||
self.assertEqual(downloaded['format_id'], u'35')
|
self.assertEqual(downloaded['format_id'], '35')
|
||||||
|
|
||||||
|
def test_format_selection_audio(self):
|
||||||
|
formats = [
|
||||||
|
{'format_id': 'audio-low', 'ext': 'webm', 'preference': 1, 'vcodec': 'none'},
|
||||||
|
{'format_id': 'audio-mid', 'ext': 'webm', 'preference': 2, 'vcodec': 'none'},
|
||||||
|
{'format_id': 'audio-high', 'ext': 'flv', 'preference': 3, 'vcodec': 'none'},
|
||||||
|
{'format_id': 'vid', 'ext': 'mp4', 'preference': 4},
|
||||||
|
]
|
||||||
|
info_dict = {'formats': formats, 'extractor': 'test'}
|
||||||
|
|
||||||
|
ydl = YDL({'format': 'bestaudio'})
|
||||||
|
ydl.process_ie_result(info_dict.copy())
|
||||||
|
downloaded = ydl.downloaded_info_dicts[0]
|
||||||
|
self.assertEqual(downloaded['format_id'], 'audio-high')
|
||||||
|
|
||||||
|
ydl = YDL({'format': 'worstaudio'})
|
||||||
|
ydl.process_ie_result(info_dict.copy())
|
||||||
|
downloaded = ydl.downloaded_info_dicts[0]
|
||||||
|
self.assertEqual(downloaded['format_id'], 'audio-low')
|
||||||
|
|
||||||
|
formats = [
|
||||||
|
{'format_id': 'vid-low', 'ext': 'mp4', 'preference': 1},
|
||||||
|
{'format_id': 'vid-high', 'ext': 'mp4', 'preference': 2},
|
||||||
|
]
|
||||||
|
info_dict = {'formats': formats, 'extractor': 'test'}
|
||||||
|
|
||||||
|
ydl = YDL({'format': 'bestaudio/worstaudio/best'})
|
||||||
|
ydl.process_ie_result(info_dict.copy())
|
||||||
|
downloaded = ydl.downloaded_info_dicts[0]
|
||||||
|
self.assertEqual(downloaded['format_id'], 'vid-high')
|
||||||
|
|
||||||
def test_youtube_format_selection(self):
|
def test_youtube_format_selection(self):
|
||||||
order = [
|
order = [
|
||||||
@ -200,17 +232,17 @@ class TestFormatSelection(unittest.TestCase):
|
|||||||
|
|
||||||
def test_prepare_filename(self):
|
def test_prepare_filename(self):
|
||||||
info = {
|
info = {
|
||||||
u'id': u'1234',
|
'id': '1234',
|
||||||
u'ext': u'mp4',
|
'ext': 'mp4',
|
||||||
u'width': None,
|
'width': None,
|
||||||
}
|
}
|
||||||
def fname(templ):
|
def fname(templ):
|
||||||
ydl = YoutubeDL({'outtmpl': templ})
|
ydl = YoutubeDL({'outtmpl': templ})
|
||||||
return ydl.prepare_filename(info)
|
return ydl.prepare_filename(info)
|
||||||
self.assertEqual(fname(u'%(id)s.%(ext)s'), u'1234.mp4')
|
self.assertEqual(fname('%(id)s.%(ext)s'), '1234.mp4')
|
||||||
self.assertEqual(fname(u'%(id)s-%(width)s.%(ext)s'), u'1234-NA.mp4')
|
self.assertEqual(fname('%(id)s-%(width)s.%(ext)s'), '1234-NA.mp4')
|
||||||
# Replace missing fields with 'NA'
|
# Replace missing fields with 'NA'
|
||||||
self.assertEqual(fname(u'%(uploader_date)s-%(id)s.%(ext)s'), u'NA-1234.mp4')
|
self.assertEqual(fname('%(uploader_date)s-%(id)s.%(ext)s'), 'NA-1234.mp4')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -120,5 +120,9 @@ class TestAllURLsMatching(unittest.TestCase):
|
|||||||
def test_soundcloud_not_matching_sets(self):
|
def test_soundcloud_not_matching_sets(self):
|
||||||
self.assertMatch('http://soundcloud.com/floex/sets/gone-ep', ['soundcloud:set'])
|
self.assertMatch('http://soundcloud.com/floex/sets/gone-ep', ['soundcloud:set'])
|
||||||
|
|
||||||
|
def test_tumblr(self):
|
||||||
|
self.assertMatch('http://tatianamaslanydaily.tumblr.com/post/54196191430/orphan-black-dvd-extra-behind-the-scenes', ['Tumblr'])
|
||||||
|
self.assertMatch('http://tatianamaslanydaily.tumblr.com/post/54196191430', ['Tumblr'])
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
@ -22,6 +22,7 @@ import socket
|
|||||||
|
|
||||||
import youtube_dl.YoutubeDL
|
import youtube_dl.YoutubeDL
|
||||||
from youtube_dl.utils import (
|
from youtube_dl.utils import (
|
||||||
|
compat_http_client,
|
||||||
compat_str,
|
compat_str,
|
||||||
compat_urllib_error,
|
compat_urllib_error,
|
||||||
compat_HTTPError,
|
compat_HTTPError,
|
||||||
@ -110,7 +111,7 @@ def generator(test_case):
|
|||||||
ydl.download([test_case['url']])
|
ydl.download([test_case['url']])
|
||||||
except (DownloadError, ExtractorError) as err:
|
except (DownloadError, ExtractorError) as err:
|
||||||
# Check if the exception is not a network related one
|
# Check if the exception is not a network related one
|
||||||
if not err.exc_info[0] in (compat_urllib_error.URLError, socket.timeout, UnavailableVideoError) or (err.exc_info[0] == compat_HTTPError and err.exc_info[1].code == 503):
|
if not err.exc_info[0] in (compat_urllib_error.URLError, socket.timeout, UnavailableVideoError, compat_http_client.BadStatusLine) or (err.exc_info[0] == compat_HTTPError and err.exc_info[1].code == 503):
|
||||||
raise
|
raise
|
||||||
|
|
||||||
if try_num == RETRIES:
|
if try_num == RETRIES:
|
||||||
|
@ -33,6 +33,9 @@ from youtube_dl.extractor import (
|
|||||||
ImdbListIE,
|
ImdbListIE,
|
||||||
KhanAcademyIE,
|
KhanAcademyIE,
|
||||||
EveryonesMixtapeIE,
|
EveryonesMixtapeIE,
|
||||||
|
RutubeChannelIE,
|
||||||
|
GoogleSearchIE,
|
||||||
|
GenericIE,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -195,11 +198,11 @@ class TestPlaylists(unittest.TestCase):
|
|||||||
def test_imdb_list(self):
|
def test_imdb_list(self):
|
||||||
dl = FakeYDL()
|
dl = FakeYDL()
|
||||||
ie = ImdbListIE(dl)
|
ie = ImdbListIE(dl)
|
||||||
result = ie.extract('http://www.imdb.com/list/sMjedvGDd8U')
|
result = ie.extract('http://www.imdb.com/list/JFs9NWw6XI0')
|
||||||
self.assertIsPlaylist(result)
|
self.assertIsPlaylist(result)
|
||||||
self.assertEqual(result['id'], 'sMjedvGDd8U')
|
self.assertEqual(result['id'], 'JFs9NWw6XI0')
|
||||||
self.assertEqual(result['title'], 'Animated and Family Films')
|
self.assertEqual(result['title'], 'March 23, 2012 Releases')
|
||||||
self.assertTrue(len(result['entries']) >= 48)
|
self.assertEqual(len(result['entries']), 7)
|
||||||
|
|
||||||
def test_khanacademy_topic(self):
|
def test_khanacademy_topic(self):
|
||||||
dl = FakeYDL()
|
dl = FakeYDL()
|
||||||
@ -219,7 +222,33 @@ class TestPlaylists(unittest.TestCase):
|
|||||||
self.assertEqual(result['id'], 'm7m0jJAbMQi')
|
self.assertEqual(result['id'], 'm7m0jJAbMQi')
|
||||||
self.assertEqual(result['title'], 'Driving')
|
self.assertEqual(result['title'], 'Driving')
|
||||||
self.assertEqual(len(result['entries']), 24)
|
self.assertEqual(len(result['entries']), 24)
|
||||||
|
|
||||||
|
def test_rutube_channel(self):
|
||||||
|
dl = FakeYDL()
|
||||||
|
ie = RutubeChannelIE(dl)
|
||||||
|
result = ie.extract('http://rutube.ru/tags/video/1409')
|
||||||
|
self.assertIsPlaylist(result)
|
||||||
|
self.assertEqual(result['id'], '1409')
|
||||||
|
self.assertTrue(len(result['entries']) >= 34)
|
||||||
|
|
||||||
|
def test_multiple_brightcove_videos(self):
|
||||||
|
# https://github.com/rg3/youtube-dl/issues/2283
|
||||||
|
dl = FakeYDL()
|
||||||
|
ie = GenericIE(dl)
|
||||||
|
result = ie.extract('http://www.newyorker.com/online/blogs/newsdesk/2014/01/always-never-nuclear-command-and-control.html')
|
||||||
|
self.assertIsPlaylist(result)
|
||||||
|
self.assertEqual(result['id'], 'always-never-nuclear-command-and-control')
|
||||||
|
self.assertEqual(result['title'], 'Always/Never: A Little-Seen Movie About Nuclear Command and Control : The New Yorker')
|
||||||
|
self.assertEqual(len(result['entries']), 3)
|
||||||
|
|
||||||
|
def test_GoogleSearch(self):
|
||||||
|
dl = FakeYDL()
|
||||||
|
ie = GoogleSearchIE(dl)
|
||||||
|
result = ie.extract('gvsearch15:python language')
|
||||||
|
self.assertIsPlaylist(result)
|
||||||
|
self.assertEqual(result['id'], 'python language')
|
||||||
|
self.assertEqual(result['title'], 'python language')
|
||||||
|
self.assertTrue(len(result['entries']) == 15)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
@ -10,9 +10,11 @@ from test.helper import FakeYDL, md5
|
|||||||
|
|
||||||
|
|
||||||
from youtube_dl.extractor import (
|
from youtube_dl.extractor import (
|
||||||
|
BlipTVIE,
|
||||||
YoutubeIE,
|
YoutubeIE,
|
||||||
DailymotionIE,
|
DailymotionIE,
|
||||||
TEDIE,
|
TEDIE,
|
||||||
|
VimeoIE,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -202,5 +204,80 @@ class TestTedSubtitles(BaseTestSubtitles):
|
|||||||
for lang in langs:
|
for lang in langs:
|
||||||
self.assertTrue(subtitles.get(lang) is not None, u'Subtitles for \'%s\' not extracted' % lang)
|
self.assertTrue(subtitles.get(lang) is not None, u'Subtitles for \'%s\' not extracted' % lang)
|
||||||
|
|
||||||
|
|
||||||
|
class TestBlipTVSubtitles(BaseTestSubtitles):
|
||||||
|
url = 'http://blip.tv/a/a-6603250'
|
||||||
|
IE = BlipTVIE
|
||||||
|
|
||||||
|
def test_list_subtitles(self):
|
||||||
|
self.DL.expect_warning(u'Automatic Captions not supported by this server')
|
||||||
|
self.DL.params['listsubtitles'] = True
|
||||||
|
info_dict = self.getInfoDict()
|
||||||
|
self.assertEqual(info_dict, None)
|
||||||
|
|
||||||
|
def test_allsubtitles(self):
|
||||||
|
self.DL.expect_warning(u'Automatic Captions not supported by this server')
|
||||||
|
self.DL.params['writesubtitles'] = True
|
||||||
|
self.DL.params['allsubtitles'] = True
|
||||||
|
subtitles = self.getSubtitles()
|
||||||
|
self.assertEqual(set(subtitles.keys()), set(['en']))
|
||||||
|
self.assertEqual(md5(subtitles['en']), '5b75c300af65fe4476dff79478bb93e4')
|
||||||
|
|
||||||
|
|
||||||
|
class TestVimeoSubtitles(BaseTestSubtitles):
|
||||||
|
url = 'http://vimeo.com/76979871'
|
||||||
|
IE = VimeoIE
|
||||||
|
|
||||||
|
def test_no_writesubtitles(self):
|
||||||
|
subtitles = self.getSubtitles()
|
||||||
|
self.assertEqual(subtitles, None)
|
||||||
|
|
||||||
|
def test_subtitles(self):
|
||||||
|
self.DL.params['writesubtitles'] = True
|
||||||
|
subtitles = self.getSubtitles()
|
||||||
|
self.assertEqual(md5(subtitles['en']), '8062383cf4dec168fc40a088aa6d5888')
|
||||||
|
|
||||||
|
def test_subtitles_lang(self):
|
||||||
|
self.DL.params['writesubtitles'] = True
|
||||||
|
self.DL.params['subtitleslangs'] = ['fr']
|
||||||
|
subtitles = self.getSubtitles()
|
||||||
|
self.assertEqual(md5(subtitles['fr']), 'b6191146a6c5d3a452244d853fde6dc8')
|
||||||
|
|
||||||
|
def test_allsubtitles(self):
|
||||||
|
self.DL.params['writesubtitles'] = True
|
||||||
|
self.DL.params['allsubtitles'] = True
|
||||||
|
subtitles = self.getSubtitles()
|
||||||
|
self.assertEqual(set(subtitles.keys()), set(['de', 'en', 'es', 'fr']))
|
||||||
|
|
||||||
|
def test_list_subtitles(self):
|
||||||
|
self.DL.expect_warning(u'Automatic Captions not supported by this server')
|
||||||
|
self.DL.params['listsubtitles'] = True
|
||||||
|
info_dict = self.getInfoDict()
|
||||||
|
self.assertEqual(info_dict, None)
|
||||||
|
|
||||||
|
def test_automatic_captions(self):
|
||||||
|
self.DL.expect_warning(u'Automatic Captions not supported by this server')
|
||||||
|
self.DL.params['writeautomaticsub'] = True
|
||||||
|
self.DL.params['subtitleslang'] = ['en']
|
||||||
|
subtitles = self.getSubtitles()
|
||||||
|
self.assertTrue(len(subtitles.keys()) == 0)
|
||||||
|
|
||||||
|
def test_nosubtitles(self):
|
||||||
|
self.DL.expect_warning(u'video doesn\'t have subtitles')
|
||||||
|
self.url = 'http://vimeo.com/56015672'
|
||||||
|
self.DL.params['writesubtitles'] = True
|
||||||
|
self.DL.params['allsubtitles'] = True
|
||||||
|
subtitles = self.getSubtitles()
|
||||||
|
self.assertEqual(len(subtitles), 0)
|
||||||
|
|
||||||
|
def test_multiple_langs(self):
|
||||||
|
self.DL.params['writesubtitles'] = True
|
||||||
|
langs = ['es', 'fr', 'de']
|
||||||
|
self.DL.params['subtitleslangs'] = langs
|
||||||
|
subtitles = self.getSubtitles()
|
||||||
|
for lang in langs:
|
||||||
|
self.assertTrue(subtitles.get(lang) is not None, u'Subtitles for \'%s\' not extracted' % lang)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
@ -19,6 +19,7 @@ from youtube_dl.utils import (
|
|||||||
fix_xml_ampersands,
|
fix_xml_ampersands,
|
||||||
get_meta_content,
|
get_meta_content,
|
||||||
orderedSet,
|
orderedSet,
|
||||||
|
PagedList,
|
||||||
parse_duration,
|
parse_duration,
|
||||||
sanitize_filename,
|
sanitize_filename,
|
||||||
shell_quote,
|
shell_quote,
|
||||||
@ -214,5 +215,26 @@ class TestUtil(unittest.TestCase):
|
|||||||
fix_xml_ampersands('Ӓ᪼'), 'Ӓ᪼')
|
fix_xml_ampersands('Ӓ᪼'), 'Ӓ᪼')
|
||||||
self.assertEqual(fix_xml_ampersands('&#&#'), '&#&#')
|
self.assertEqual(fix_xml_ampersands('&#&#'), '&#&#')
|
||||||
|
|
||||||
|
def test_paged_list(self):
|
||||||
|
def testPL(size, pagesize, sliceargs, expected):
|
||||||
|
def get_page(pagenum):
|
||||||
|
firstid = pagenum * pagesize
|
||||||
|
upto = min(size, pagenum * pagesize + pagesize)
|
||||||
|
for i in range(firstid, upto):
|
||||||
|
yield i
|
||||||
|
|
||||||
|
pl = PagedList(get_page, pagesize)
|
||||||
|
got = pl.getslice(*sliceargs)
|
||||||
|
self.assertEqual(got, expected)
|
||||||
|
|
||||||
|
testPL(5, 2, (), [0, 1, 2, 3, 4])
|
||||||
|
testPL(5, 2, (1,), [1, 2, 3, 4])
|
||||||
|
testPL(5, 2, (2,), [2, 3, 4])
|
||||||
|
testPL(5, 2, (4,), [4])
|
||||||
|
testPL(5, 2, (0, 3), [0, 1, 2])
|
||||||
|
testPL(5, 2, (1, 4), [1, 2, 3])
|
||||||
|
testPL(5, 2, (2, 99), [2, 3, 4])
|
||||||
|
testPL(5, 2, (20, 99), [])
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
@ -120,7 +120,7 @@ class TestYoutubeLists(unittest.TestCase):
|
|||||||
def test_youtube_toplist(self):
|
def test_youtube_toplist(self):
|
||||||
dl = FakeYDL()
|
dl = FakeYDL()
|
||||||
ie = YoutubeTopListIE(dl)
|
ie = YoutubeTopListIE(dl)
|
||||||
result = ie.extract('yttoplist:music:Top Tracks')
|
result = ie.extract('yttoplist:music:Trending')
|
||||||
entries = result['entries']
|
entries = result['entries']
|
||||||
self.assertTrue(len(entries) >= 5)
|
self.assertTrue(len(entries) >= 5)
|
||||||
|
|
||||||
|
@ -27,6 +27,12 @@ _TESTS = [
|
|||||||
85,
|
85,
|
||||||
u'3456789a0cdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRS[UVWXYZ!"#$%&\'()*+,-./:;<=>?@',
|
u'3456789a0cdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRS[UVWXYZ!"#$%&\'()*+,-./:;<=>?@',
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
u'https://s.ytimg.com/yts/jsbin/html5player-vfle-mVwz.js',
|
||||||
|
u'js',
|
||||||
|
90,
|
||||||
|
u']\\[@?>=<;:/.-,+*)(\'&%$#"hZYXWVUTSRQPONMLKJIHGFEDCBAzyxwvutsrqponmlkjiagfedcb39876',
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
24
youtube-dl.plugin.zsh
Normal file
24
youtube-dl.plugin.zsh
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# This allows the youtube-dl command to be installed in ZSH using antigen.
|
||||||
|
# Antigen is a bundle manager. It allows you to enhance the functionality of
|
||||||
|
# your zsh session by installing bundles and themes easily.
|
||||||
|
|
||||||
|
# Antigen documentation:
|
||||||
|
# http://antigen.sharats.me/
|
||||||
|
# https://github.com/zsh-users/antigen
|
||||||
|
|
||||||
|
# Install youtube-dl:
|
||||||
|
# antigen bundle rg3/youtube-dl
|
||||||
|
# Bundles installed by antigen are available for use immediately.
|
||||||
|
|
||||||
|
# Update youtube-dl (and all other antigen bundles):
|
||||||
|
# antigen update
|
||||||
|
|
||||||
|
# The antigen command will download the git repository to a folder and then
|
||||||
|
# execute an enabling script (this file). The complete process for loading the
|
||||||
|
# code is documented here:
|
||||||
|
# https://github.com/zsh-users/antigen#notes-on-writing-plugins
|
||||||
|
|
||||||
|
# This specific script just aliases youtube-dl to the python script that this
|
||||||
|
# library provides. This requires updating the PYTHONPATH to ensure that the
|
||||||
|
# full set of code can be located.
|
||||||
|
alias youtube-dl="PYTHONPATH=$(dirname $0) $(dirname $0)/bin/youtube-dl"
|
@ -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,
|
||||||
@ -152,6 +153,8 @@ class YoutubeDL(object):
|
|||||||
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
|
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:
|
||||||
@ -328,7 +331,7 @@ class YoutubeDL(object):
|
|||||||
|
|
||||||
def __exit__(self, *args):
|
def __exit__(self, *args):
|
||||||
self.restore_console_title()
|
self.restore_console_title()
|
||||||
|
|
||||||
if self.params.get('cookiefile') is not None:
|
if self.params.get('cookiefile') is not None:
|
||||||
self.cookiejar.save()
|
self.cookiejar.save()
|
||||||
|
|
||||||
@ -393,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:
|
||||||
@ -514,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()))
|
||||||
@ -576,19 +577,27 @@ class YoutubeDL(object):
|
|||||||
|
|
||||||
playlist_results = []
|
playlist_results = []
|
||||||
|
|
||||||
n_all_entries = len(ie_result['entries'])
|
|
||||||
playliststart = self.params.get('playliststart', 1) - 1
|
playliststart = self.params.get('playliststart', 1) - 1
|
||||||
playlistend = self.params.get('playlistend', None)
|
playlistend = self.params.get('playlistend', None)
|
||||||
# For backwards compatibility, interpret -1 as whole list
|
# For backwards compatibility, interpret -1 as whole list
|
||||||
if playlistend == -1:
|
if playlistend == -1:
|
||||||
playlistend = None
|
playlistend = None
|
||||||
|
|
||||||
entries = ie_result['entries'][playliststart:playlistend]
|
if isinstance(ie_result['entries'], list):
|
||||||
n_entries = len(entries)
|
n_all_entries = len(ie_result['entries'])
|
||||||
|
entries = ie_result['entries'][playliststart:playlistend]
|
||||||
self.to_screen(
|
n_entries = len(entries)
|
||||||
"[%s] playlist '%s': Collected %d video ids (downloading %d of them)" %
|
self.to_screen(
|
||||||
(ie_result['extractor'], playlist, n_all_entries, n_entries))
|
"[%s] playlist %s: Collected %d video ids (downloading %d of them)" %
|
||||||
|
(ie_result['extractor'], playlist, n_all_entries, n_entries))
|
||||||
|
else:
|
||||||
|
assert isinstance(ie_result['entries'], PagedList)
|
||||||
|
entries = ie_result['entries'].getslice(
|
||||||
|
playliststart, playlistend)
|
||||||
|
n_entries = len(entries)
|
||||||
|
self.to_screen(
|
||||||
|
"[%s] playlist %s: Downloading %d videos" %
|
||||||
|
(ie_result['extractor'], playlist, n_entries))
|
||||||
|
|
||||||
for i, entry in enumerate(entries, 1):
|
for i, entry in enumerate(entries, 1):
|
||||||
self.to_screen('[download] Downloading video #%s of %s' % (i, n_entries))
|
self.to_screen('[download] Downloading video #%s of %s' % (i, n_entries))
|
||||||
@ -635,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:
|
||||||
@ -689,17 +710,17 @@ class YoutubeDL(object):
|
|||||||
|
|
||||||
# TODO Central sorting goes here
|
# TODO Central sorting goes here
|
||||||
|
|
||||||
if formats[0] is not info_dict:
|
if formats[0] is not info_dict:
|
||||||
# only set the 'formats' fields if the original info_dict list them
|
# only set the 'formats' fields if the original info_dict list them
|
||||||
# otherwise we end up with a circular reference, the first (and unique)
|
# otherwise we end up with a circular reference, the first (and unique)
|
||||||
# element in the 'formats' field in info_dict is info_dict itself,
|
# element in the 'formats' field in info_dict is info_dict itself,
|
||||||
# wich can't be exported to json
|
# wich can't be exported to json
|
||||||
info_dict['formats'] = formats
|
info_dict['formats'] = formats
|
||||||
if self.params.get('listformats', None):
|
if self.params.get('listformats', None):
|
||||||
self.list_formats(info_dict)
|
self.list_formats(info_dict)
|
||||||
return
|
return
|
||||||
|
|
||||||
req_format = self.params.get('format', 'best')
|
req_format = self.params.get('format')
|
||||||
if req_format is None:
|
if req_format is None:
|
||||||
req_format = 'best'
|
req_format = 'best'
|
||||||
formats_to_download = []
|
formats_to_download = []
|
||||||
@ -748,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:
|
||||||
@ -766,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)
|
||||||
|
|
||||||
@ -1073,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:
|
||||||
@ -1085,13 +1112,18 @@ class YoutubeDL(object):
|
|||||||
if fdict.get('acodec') is not None:
|
if fdict.get('acodec') is not None:
|
||||||
if res:
|
if res:
|
||||||
res += ', '
|
res += ', '
|
||||||
res += '%-5s' % fdict['acodec']
|
if fdict['acodec'] == 'none':
|
||||||
|
res += 'video only'
|
||||||
|
else:
|
||||||
|
res += '%-5s' % fdict['acodec']
|
||||||
elif fdict.get('abr') is not None:
|
elif fdict.get('abr') is not None:
|
||||||
if res:
|
if res:
|
||||||
res += ', '
|
res += ', '
|
||||||
res += 'audio'
|
res += 'audio'
|
||||||
if fdict.get('abr') is not None:
|
if fdict.get('abr') is not None:
|
||||||
res += '@%3dk' % fdict['abr']
|
res += '@%3dk' % fdict['abr']
|
||||||
|
if fdict.get('asr') is not None:
|
||||||
|
res += ' (%5dHz)' % fdict['asr']
|
||||||
if fdict.get('filesize') is not None:
|
if fdict.get('filesize') is not None:
|
||||||
if res:
|
if res:
|
||||||
res += ', '
|
res += ', '
|
||||||
|
@ -40,6 +40,7 @@ __authors__ = (
|
|||||||
'Michael Orlitzky',
|
'Michael Orlitzky',
|
||||||
'Chris Gahan',
|
'Chris Gahan',
|
||||||
'Saimadhav Heblikar',
|
'Saimadhav Heblikar',
|
||||||
|
'Mike Col',
|
||||||
)
|
)
|
||||||
|
|
||||||
__license__ = 'Public Domain'
|
__license__ = 'Public Domain'
|
||||||
@ -99,6 +100,43 @@ def parseOpts(overrideArguments=None):
|
|||||||
optionf.close()
|
optionf.close()
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
def _readUserConf():
|
||||||
|
xdg_config_home = os.environ.get('XDG_CONFIG_HOME')
|
||||||
|
if xdg_config_home:
|
||||||
|
userConfFile = os.path.join(xdg_config_home, 'youtube-dl', 'config')
|
||||||
|
if not os.path.isfile(userConfFile):
|
||||||
|
userConfFile = os.path.join(xdg_config_home, 'youtube-dl.conf')
|
||||||
|
else:
|
||||||
|
userConfFile = os.path.join(os.path.expanduser('~'), '.config', 'youtube-dl', 'config')
|
||||||
|
if not os.path.isfile(userConfFile):
|
||||||
|
userConfFile = os.path.join(os.path.expanduser('~'), '.config', 'youtube-dl.conf')
|
||||||
|
userConf = _readOptions(userConfFile, None)
|
||||||
|
|
||||||
|
if userConf is None:
|
||||||
|
appdata_dir = os.environ.get('appdata')
|
||||||
|
if appdata_dir:
|
||||||
|
userConf = _readOptions(
|
||||||
|
os.path.join(appdata_dir, 'youtube-dl', 'config'),
|
||||||
|
default=None)
|
||||||
|
if userConf is None:
|
||||||
|
userConf = _readOptions(
|
||||||
|
os.path.join(appdata_dir, 'youtube-dl', 'config.txt'),
|
||||||
|
default=None)
|
||||||
|
|
||||||
|
if userConf is None:
|
||||||
|
userConf = _readOptions(
|
||||||
|
os.path.join(os.path.expanduser('~'), 'youtube-dl.conf'),
|
||||||
|
default=None)
|
||||||
|
if userConf is None:
|
||||||
|
userConf = _readOptions(
|
||||||
|
os.path.join(os.path.expanduser('~'), 'youtube-dl.conf.txt'),
|
||||||
|
default=None)
|
||||||
|
|
||||||
|
if userConf is None:
|
||||||
|
userConf = []
|
||||||
|
|
||||||
|
return userConf
|
||||||
|
|
||||||
def _format_option_string(option):
|
def _format_option_string(option):
|
||||||
''' ('-o', '--option') -> -o, --format METAVAR'''
|
''' ('-o', '--option') -> -o, --format METAVAR'''
|
||||||
|
|
||||||
@ -199,6 +237,13 @@ 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.')
|
||||||
|
general.add_option(
|
||||||
|
'--ignore-config',
|
||||||
|
action='store_true',
|
||||||
|
help='Do not read configuration files. When given in the global configuration file /etc/youtube-dl.conf: do not read the user configuration in ~/.config/youtube-dl.conf (%APPDATA%/youtube-dl/config.txt on Windows)')
|
||||||
|
|
||||||
|
|
||||||
selection.add_option(
|
selection.add_option(
|
||||||
@ -242,6 +287,10 @@ def parseOpts(overrideArguments=None):
|
|||||||
'--include-ads', dest='include_ads',
|
'--include-ads', dest='include_ads',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help='Download advertisements as well (experimental)')
|
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')
|
||||||
@ -254,8 +303,8 @@ def parseOpts(overrideArguments=None):
|
|||||||
|
|
||||||
|
|
||||||
video_format.add_option('-f', '--format',
|
video_format.add_option('-f', '--format',
|
||||||
action='store', dest='format', metavar='FORMAT', default='best',
|
action='store', dest='format', metavar='FORMAT', default=None,
|
||||||
help='video format code, specify the order of preference using slashes: "-f 22/17/18". "-f mp4" and "-f flv" are also supported')
|
help='video format code, specify the order of preference using slashes: "-f 22/17/18". "-f mp4" and "-f flv" are also supported. You can also use the special names "best", "bestaudio", "worst", and "worstaudio". By default, youtube-dl will pick the best quality.')
|
||||||
video_format.add_option('--all-formats',
|
video_format.add_option('--all-formats',
|
||||||
action='store_const', dest='format', help='download all available video formats', const='all')
|
action='store_const', dest='format', help='download all available video formats', const='all')
|
||||||
video_format.add_option('--prefer-free-formats',
|
video_format.add_option('--prefer-free-formats',
|
||||||
@ -346,7 +395,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)
|
||||||
@ -449,44 +499,18 @@ def parseOpts(overrideArguments=None):
|
|||||||
if opts.verbose:
|
if opts.verbose:
|
||||||
write_string(u'[debug] Override config: ' + repr(overrideArguments) + '\n')
|
write_string(u'[debug] Override config: ' + repr(overrideArguments) + '\n')
|
||||||
else:
|
else:
|
||||||
systemConf = _readOptions('/etc/youtube-dl.conf')
|
|
||||||
|
|
||||||
xdg_config_home = os.environ.get('XDG_CONFIG_HOME')
|
|
||||||
if xdg_config_home:
|
|
||||||
userConfFile = os.path.join(xdg_config_home, 'youtube-dl', 'config')
|
|
||||||
if not os.path.isfile(userConfFile):
|
|
||||||
userConfFile = os.path.join(xdg_config_home, 'youtube-dl.conf')
|
|
||||||
else:
|
|
||||||
userConfFile = os.path.join(os.path.expanduser('~'), '.config', 'youtube-dl', 'config')
|
|
||||||
if not os.path.isfile(userConfFile):
|
|
||||||
userConfFile = os.path.join(os.path.expanduser('~'), '.config', 'youtube-dl.conf')
|
|
||||||
userConf = _readOptions(userConfFile, None)
|
|
||||||
|
|
||||||
if userConf is None:
|
|
||||||
appdata_dir = os.environ.get('appdata')
|
|
||||||
if appdata_dir:
|
|
||||||
userConf = _readOptions(
|
|
||||||
os.path.join(appdata_dir, 'youtube-dl', 'config'),
|
|
||||||
default=None)
|
|
||||||
if userConf is None:
|
|
||||||
userConf = _readOptions(
|
|
||||||
os.path.join(appdata_dir, 'youtube-dl', 'config.txt'),
|
|
||||||
default=None)
|
|
||||||
|
|
||||||
if userConf is None:
|
|
||||||
userConf = _readOptions(
|
|
||||||
os.path.join(os.path.expanduser('~'), 'youtube-dl.conf'),
|
|
||||||
default=None)
|
|
||||||
if userConf is None:
|
|
||||||
userConf = _readOptions(
|
|
||||||
os.path.join(os.path.expanduser('~'), 'youtube-dl.conf.txt'),
|
|
||||||
default=None)
|
|
||||||
|
|
||||||
if userConf is None:
|
|
||||||
userConf = []
|
|
||||||
|
|
||||||
commandLineConf = sys.argv[1:]
|
commandLineConf = sys.argv[1:]
|
||||||
|
if '--ignore-config' in commandLineConf:
|
||||||
|
systemConf = []
|
||||||
|
userConf = []
|
||||||
|
else:
|
||||||
|
systemConf = _readOptions('/etc/youtube-dl.conf')
|
||||||
|
if '--ignore-config' in systemConf:
|
||||||
|
userConf = []
|
||||||
|
else:
|
||||||
|
userConf = _readUserConf()
|
||||||
argv = systemConf + userConf + commandLineConf
|
argv = systemConf + userConf + commandLineConf
|
||||||
|
|
||||||
opts, args = parser.parse_args(argv)
|
opts, args = parser.parse_args(argv)
|
||||||
if opts.verbose:
|
if opts.verbose:
|
||||||
write_string(u'[debug] System config: ' + repr(_hide_login_info(systemConf)) + '\n')
|
write_string(u'[debug] System config: ' + repr(_hide_login_info(systemConf)) + '\n')
|
||||||
@ -619,6 +643,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.
|
||||||
@ -720,6 +750,8 @@ def _real_main(argv=None):
|
|||||||
'debug_printtraffic': opts.debug_printtraffic,
|
'debug_printtraffic': opts.debug_printtraffic,
|
||||||
'prefer_ffmpeg': opts.prefer_ffmpeg,
|
'prefer_ffmpeg': opts.prefer_ffmpeg,
|
||||||
'include_ads': opts.include_ads,
|
'include_ads': opts.include_ads,
|
||||||
|
'default_search': opts.default_search,
|
||||||
|
'youtube_include_dash_manifest': opts.youtube_include_dash_manifest,
|
||||||
}
|
}
|
||||||
|
|
||||||
with YoutubeDL(ydl_opts) as ydl:
|
with YoutubeDL(ydl_opts) as ydl:
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from .common import FileDownloader
|
from .common import FileDownloader
|
||||||
from .hls import HlsFD
|
from .hls import HlsFD
|
||||||
from .http import HttpFD
|
from .http import HttpFD
|
||||||
@ -8,16 +10,17 @@ from ..utils import (
|
|||||||
determine_ext,
|
determine_ext,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_suitable_downloader(info_dict):
|
def get_suitable_downloader(info_dict):
|
||||||
"""Get the downloader class that can handle the info dict."""
|
"""Get the downloader class that can handle the info dict."""
|
||||||
url = info_dict['url']
|
url = info_dict['url']
|
||||||
|
protocol = info_dict.get('protocol')
|
||||||
|
|
||||||
if url.startswith('rtmp'):
|
if url.startswith('rtmp'):
|
||||||
return RtmpFD
|
return RtmpFD
|
||||||
if determine_ext(url) == u'm3u8':
|
if (protocol == 'm3u8') or (protocol is None and determine_ext(url) == 'm3u8'):
|
||||||
return HlsFD
|
return HlsFD
|
||||||
if url.startswith('mms') or url.startswith('rtsp'):
|
if url.startswith('mms') or url.startswith('rtsp'):
|
||||||
return MplayerFD
|
return MplayerFD
|
||||||
else:
|
else:
|
||||||
return HttpFD
|
return HttpFD
|
||||||
|
|
||||||
|
@ -314,4 +314,3 @@ class FileDownloader(object):
|
|||||||
if the download is successful.
|
if the download is successful.
|
||||||
"""
|
"""
|
||||||
self._progress_hooks.append(ph)
|
self._progress_hooks.append(ph)
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ class HttpFD(FileDownloader):
|
|||||||
request = compat_urllib_request.Request(url, None, headers)
|
request = compat_urllib_request.Request(url, None, headers)
|
||||||
|
|
||||||
if self.params.get('test', False):
|
if self.params.get('test', False):
|
||||||
request.add_header('Range','bytes=0-10240')
|
request.add_header('Range', 'bytes=0-10240')
|
||||||
|
|
||||||
# Establish possible resume length
|
# Establish possible resume length
|
||||||
if os.path.isfile(encodeFilename(tmpfilename)):
|
if os.path.isfile(encodeFilename(tmpfilename)):
|
||||||
@ -39,7 +39,7 @@ class HttpFD(FileDownloader):
|
|||||||
if resume_len != 0:
|
if resume_len != 0:
|
||||||
if self.params.get('continuedl', False):
|
if self.params.get('continuedl', False):
|
||||||
self.report_resuming_byte(resume_len)
|
self.report_resuming_byte(resume_len)
|
||||||
request.add_header('Range','bytes=%d-' % resume_len)
|
request.add_header('Range', 'bytes=%d-' % resume_len)
|
||||||
open_mode = 'ab'
|
open_mode = 'ab'
|
||||||
else:
|
else:
|
||||||
resume_len = 0
|
resume_len = 0
|
||||||
@ -100,7 +100,7 @@ class HttpFD(FileDownloader):
|
|||||||
if data_len is not None:
|
if data_len is not None:
|
||||||
data_len = int(data_len) + resume_len
|
data_len = int(data_len) + resume_len
|
||||||
min_data_len = self.params.get("min_filesize", None)
|
min_data_len = self.params.get("min_filesize", None)
|
||||||
max_data_len = self.params.get("max_filesize", None)
|
max_data_len = self.params.get("max_filesize", None)
|
||||||
if min_data_len is not None and data_len < min_data_len:
|
if min_data_len is not None and data_len < min_data_len:
|
||||||
self.to_screen(u'\r[download] File is smaller than min-filesize (%s bytes < %s bytes). Aborting.' % (data_len, min_data_len))
|
self.to_screen(u'\r[download] File is smaller than min-filesize (%s bytes < %s bytes). Aborting.' % (data_len, min_data_len))
|
||||||
return False
|
return False
|
||||||
|
@ -18,10 +18,10 @@ class MplayerFD(FileDownloader):
|
|||||||
try:
|
try:
|
||||||
subprocess.call(['mplayer', '-h'], stdout=(open(os.path.devnull, 'w')), stderr=subprocess.STDOUT)
|
subprocess.call(['mplayer', '-h'], stdout=(open(os.path.devnull, 'w')), stderr=subprocess.STDOUT)
|
||||||
except (OSError, IOError):
|
except (OSError, IOError):
|
||||||
self.report_error(u'MMS or RTSP download detected but "%s" could not be run' % args[0] )
|
self.report_error(u'MMS or RTSP download detected but "%s" could not be run' % args[0])
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Download using mplayer.
|
# Download using mplayer.
|
||||||
retval = subprocess.call(args)
|
retval = subprocess.call(args)
|
||||||
if retval == 0:
|
if retval == 0:
|
||||||
fsize = os.path.getsize(encodeFilename(tmpfilename))
|
fsize = os.path.getsize(encodeFilename(tmpfilename))
|
||||||
|
@ -27,6 +27,7 @@ from .cbs import CBSIE
|
|||||||
from .channel9 import Channel9IE
|
from .channel9 import Channel9IE
|
||||||
from .cinemassacre import CinemassacreIE
|
from .cinemassacre import CinemassacreIE
|
||||||
from .clipfish import ClipfishIE
|
from .clipfish import ClipfishIE
|
||||||
|
from .cliphunter import CliphunterIE
|
||||||
from .clipsyndicate import ClipsyndicateIE
|
from .clipsyndicate import ClipsyndicateIE
|
||||||
from .cmt import CMTIE
|
from .cmt import CMTIE
|
||||||
from .cnn import CNNIE
|
from .cnn import CNNIE
|
||||||
@ -47,17 +48,20 @@ from .depositfiles import DepositFilesIE
|
|||||||
from .dotsub import DotsubIE
|
from .dotsub import DotsubIE
|
||||||
from .dreisat import DreiSatIE
|
from .dreisat import DreiSatIE
|
||||||
from .defense import DefenseGouvFrIE
|
from .defense import DefenseGouvFrIE
|
||||||
|
from .discovery import DiscoveryIE
|
||||||
from .dropbox import DropboxIE
|
from .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 .elpais import ElPaisIE
|
||||||
from .escapist import EscapistIE
|
from .escapist import EscapistIE
|
||||||
from .everyonesmixtape import EveryonesMixtapeIE
|
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
|
||||||
from .faz import FazIE
|
from .faz import FazIE
|
||||||
|
from .firstpost import FirstpostIE
|
||||||
from .fktv import (
|
from .fktv import (
|
||||||
FKTVIE,
|
FKTVIE,
|
||||||
FKTVPosteckeIE,
|
FKTVPosteckeIE,
|
||||||
@ -72,6 +76,7 @@ from .francetv import (
|
|||||||
CultureboxIE,
|
CultureboxIE,
|
||||||
)
|
)
|
||||||
from .freesound import FreesoundIE
|
from .freesound import FreesoundIE
|
||||||
|
from .freespeech import FreespeechIE
|
||||||
from .funnyordie import FunnyOrDieIE
|
from .funnyordie import FunnyOrDieIE
|
||||||
from .gamekings import GamekingsIE
|
from .gamekings import GamekingsIE
|
||||||
from .gamespot import GameSpotIE
|
from .gamespot import GameSpotIE
|
||||||
@ -82,6 +87,7 @@ from .googlesearch import GoogleSearchIE
|
|||||||
from .hark import HarkIE
|
from .hark import HarkIE
|
||||||
from .hotnewhiphop import HotNewHipHopIE
|
from .hotnewhiphop import HotNewHipHopIE
|
||||||
from .howcast import HowcastIE
|
from .howcast import HowcastIE
|
||||||
|
from .huffpost import HuffPostIE
|
||||||
from .hypem import HypemIE
|
from .hypem import HypemIE
|
||||||
from .ign import IGNIE, OneUPIE
|
from .ign import IGNIE, OneUPIE
|
||||||
from .imdb import (
|
from .imdb import (
|
||||||
@ -92,6 +98,7 @@ from .ina import InaIE
|
|||||||
from .infoq import InfoQIE
|
from .infoq import InfoQIE
|
||||||
from .instagram import InstagramIE
|
from .instagram import InstagramIE
|
||||||
from .internetvideoarchive import InternetVideoArchiveIE
|
from .internetvideoarchive import InternetVideoArchiveIE
|
||||||
|
from .iprima import IPrimaIE
|
||||||
from .ivi import (
|
from .ivi import (
|
||||||
IviIE,
|
IviIE,
|
||||||
IviCompilationIE
|
IviCompilationIE
|
||||||
@ -105,13 +112,17 @@ from .keezmovies import KeezMoviesIE
|
|||||||
from .khanacademy import KhanAcademyIE
|
from .khanacademy import KhanAcademyIE
|
||||||
from .kickstarter import KickStarterIE
|
from .kickstarter import KickStarterIE
|
||||||
from .keek import KeekIE
|
from .keek import KeekIE
|
||||||
|
from .la7 import LA7IE
|
||||||
|
from .lifenews import LifeNewsIE
|
||||||
from .liveleak import LiveLeakIE
|
from .liveleak import LiveLeakIE
|
||||||
from .livestream import LivestreamIE, LivestreamOriginalIE
|
from .livestream import LivestreamIE, LivestreamOriginalIE
|
||||||
from .lynda import (
|
from .lynda import (
|
||||||
LyndaIE,
|
LyndaIE,
|
||||||
LyndaCourseIE
|
LyndaCourseIE
|
||||||
)
|
)
|
||||||
|
from .m6 import M6IE
|
||||||
from .macgamestore import MacGameStoreIE
|
from .macgamestore import MacGameStoreIE
|
||||||
|
from .malemotion import MalemotionIE
|
||||||
from .mdr import MDRIE
|
from .mdr import MDRIE
|
||||||
from .metacafe import MetacafeIE
|
from .metacafe import MetacafeIE
|
||||||
from .metacritic import MetacriticIE
|
from .metacritic import MetacriticIE
|
||||||
@ -119,6 +130,7 @@ 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 .mooshare import MooshareIE
|
||||||
from .mtv import (
|
from .mtv import (
|
||||||
MTVIE,
|
MTVIE,
|
||||||
MTVIggyIE,
|
MTVIggyIE,
|
||||||
@ -132,10 +144,13 @@ from .nba import NBAIE
|
|||||||
from .nbc import NBCNewsIE
|
from .nbc import NBCNewsIE
|
||||||
from .ndtv import NDTVIE
|
from .ndtv import NDTVIE
|
||||||
from .newgrounds import NewgroundsIE
|
from .newgrounds import NewgroundsIE
|
||||||
|
from .nfb import NFBIE
|
||||||
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 .normalboots import NormalbootsIE
|
||||||
from .novamov import NovamovIE
|
from .novamov import NovamovIE
|
||||||
|
from .nowness import NownessIE
|
||||||
from .nowvideo import NowVideoIE
|
from .nowvideo import NowVideoIE
|
||||||
from .ooyala import OoyalaIE
|
from .ooyala import OoyalaIE
|
||||||
from .orf import ORFIE
|
from .orf import ORFIE
|
||||||
@ -154,7 +169,12 @@ from .ro220 import Ro220IE
|
|||||||
from .rottentomatoes import RottenTomatoesIE
|
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,
|
||||||
|
RutubeChannelIE,
|
||||||
|
RutubeMovieIE,
|
||||||
|
RutubePersonIE,
|
||||||
|
)
|
||||||
from .servingsys import ServingSysIE
|
from .servingsys import ServingSysIE
|
||||||
from .sina import SinaIE
|
from .sina import SinaIE
|
||||||
from .slashdot import SlashdotIE
|
from .slashdot import SlashdotIE
|
||||||
@ -186,6 +206,7 @@ from .ted import TEDIE
|
|||||||
from .tf1 import TF1IE
|
from .tf1 import TF1IE
|
||||||
from .theplatform import ThePlatformIE
|
from .theplatform import ThePlatformIE
|
||||||
from .thisav import ThisAVIE
|
from .thisav import ThisAVIE
|
||||||
|
from .tinypic import TinyPicIE
|
||||||
from .toutv import TouTvIE
|
from .toutv import TouTvIE
|
||||||
from .traileraddict import TrailerAddictIE
|
from .traileraddict import TrailerAddictIE
|
||||||
from .trilulilu import TriluliluIE
|
from .trilulilu import TriluliluIE
|
||||||
@ -216,8 +237,8 @@ from .vimeo import (
|
|||||||
from .vine import VineIE
|
from .vine import VineIE
|
||||||
from .viki import VikiIE
|
from .viki import VikiIE
|
||||||
from .vk import VKIE
|
from .vk import VKIE
|
||||||
|
from .vube import VubeIE
|
||||||
from .wat import WatIE
|
from .wat import WatIE
|
||||||
from .websurg import WeBSurgIE
|
|
||||||
from .weibo import WeiboIE
|
from .weibo import WeiboIE
|
||||||
from .wimp import WimpIE
|
from .wimp import WimpIE
|
||||||
from .wistia import WistiaIE
|
from .wistia import WistiaIE
|
||||||
|
@ -1,22 +1,28 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
determine_ext,
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ARDIE(InfoExtractor):
|
class ARDIE(InfoExtractor):
|
||||||
_VALID_URL = r'^(?:https?://)?(?:(?:www\.)?ardmediathek\.de|mediathek\.daserste\.de)/(?:.*/)(?P<video_id>[^/\?]+)(?:\?.*)?'
|
_VALID_URL = r'^https?://(?:(?:www\.)?ardmediathek\.de|mediathek\.daserste\.de)/(?:.*/)(?P<video_id>[^/\?]+)(?:\?.*)?'
|
||||||
_TITLE = r'<h1(?: class="boxTopHeadline")?>(?P<title>.*)</h1>'
|
|
||||||
_MEDIA_STREAM = r'mediaCollection\.addMediaStream\((?P<media_type>\d+), (?P<quality>\d+), "(?P<rtmp_url>[^"]*)", "(?P<video_url>[^"]*)", "[^"]*"\)'
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.ardmediathek.de/das-erste/tagesschau-in-100-sek?documentId=14077640',
|
'url': 'http://www.ardmediathek.de/das-erste/guenther-jauch/edward-snowden-im-interview-held-oder-verraeter?documentId=19288786',
|
||||||
u'file': u'14077640.mp4',
|
'file': '19288786.mp4',
|
||||||
u'md5': u'6ca8824255460c787376353f9e20bbd8',
|
'md5': '515bf47ce209fb3f5a61b7aad364634c',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"title": u"11.04.2013 09:23 Uhr - Tagesschau in 100 Sekunden"
|
'title': 'Edward Snowden im Interview - Held oder Verräter?',
|
||||||
|
'description': 'Edward Snowden hat alles aufs Spiel gesetzt, um die weltweite \xdcberwachung durch die Geheimdienste zu enttarnen. Nun stellt sich der ehemalige NSA-Mitarbeiter erstmals weltweit in einem TV-Interview den Fragen eines NDR-Journalisten. Die Sendung vom Sonntagabend.',
|
||||||
|
'thumbnail': 'http://www.ardmediathek.de/ard/servlet/contentblob/19/28/87/90/19288790/bild/2250037',
|
||||||
},
|
},
|
||||||
u'skip': u'Requires rtmpdump'
|
'skip': 'Blocked outside of Germany',
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@ -29,26 +35,49 @@ class ARDIE(InfoExtractor):
|
|||||||
else:
|
else:
|
||||||
video_id = m.group('video_id')
|
video_id = m.group('video_id')
|
||||||
|
|
||||||
# determine title and media streams from webpage
|
webpage = self._download_webpage(url, video_id)
|
||||||
html = self._download_webpage(url, video_id)
|
|
||||||
title = re.search(self._TITLE, html).group('title')
|
title = self._html_search_regex(
|
||||||
streams = [mo.groupdict() for mo in re.finditer(self._MEDIA_STREAM, html)]
|
r'<h1(?:\s+class="boxTopHeadline")?>(.*?)</h1>', webpage, 'title')
|
||||||
|
description = self._html_search_meta(
|
||||||
|
'dcterms.abstract', webpage, 'description')
|
||||||
|
thumbnail = self._og_search_thumbnail(webpage)
|
||||||
|
|
||||||
|
streams = [
|
||||||
|
mo.groupdict()
|
||||||
|
for mo in re.finditer(
|
||||||
|
r'mediaCollection\.addMediaStream\((?P<media_type>\d+), (?P<quality>\d+), "(?P<rtmp_url>[^"]*)", "(?P<video_url>[^"]*)", "[^"]*"\)', webpage)]
|
||||||
if not streams:
|
if not streams:
|
||||||
assert '"fsk"' in html
|
if '"fsk"' in webpage:
|
||||||
raise ExtractorError(u'This video is only available after 8:00 pm')
|
raise ExtractorError('This video is only available after 20:00')
|
||||||
|
|
||||||
# choose default media type and highest quality for now
|
formats = []
|
||||||
stream = max([s for s in streams if int(s["media_type"]) == 0],
|
for s in streams:
|
||||||
key=lambda s: int(s["quality"]))
|
format = {
|
||||||
|
'quality': int(s['quality']),
|
||||||
|
}
|
||||||
|
if s.get('rtmp_url'):
|
||||||
|
format['protocol'] = 'rtmp'
|
||||||
|
format['url'] = s['rtmp_url']
|
||||||
|
format['playpath'] = s['video_url']
|
||||||
|
else:
|
||||||
|
format['url'] = s['video_url']
|
||||||
|
|
||||||
# there's two possibilities: RTMP stream or HTTP download
|
quality_name = self._search_regex(
|
||||||
info = {'id': video_id, 'title': title, 'ext': 'mp4'}
|
r'[,.]([a-zA-Z0-9_-]+),?\.mp4', format['url'],
|
||||||
if stream['rtmp_url']:
|
'quality name', default='NA')
|
||||||
self.to_screen(u'RTMP download detected')
|
format['format_id'] = '%s-%s-%s-%s' % (
|
||||||
assert stream['video_url'].startswith('mp4:')
|
determine_ext(format['url']), quality_name, s['media_type'],
|
||||||
info["url"] = stream["rtmp_url"]
|
s['quality'])
|
||||||
info["play_path"] = stream['video_url']
|
|
||||||
else:
|
formats.append(format)
|
||||||
assert stream["video_url"].endswith('.mp4')
|
|
||||||
info["url"] = stream["video_url"]
|
self._sort_formats(formats)
|
||||||
return [info]
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': title,
|
||||||
|
'description': description,
|
||||||
|
'formats': formats,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
}
|
||||||
|
@ -1,128 +1,137 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import json
|
|
||||||
import re
|
import re
|
||||||
import socket
|
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from .subtitles import SubtitlesInfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
compat_http_client,
|
|
||||||
compat_str,
|
compat_str,
|
||||||
compat_urllib_error,
|
|
||||||
compat_urllib_request,
|
compat_urllib_request,
|
||||||
|
|
||||||
ExtractorError,
|
|
||||||
unescapeHTML,
|
unescapeHTML,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class BlipTVIE(InfoExtractor):
|
class BlipTVIE(SubtitlesInfoExtractor):
|
||||||
"""Information extractor for blip.tv"""
|
"""Information extractor for blip.tv"""
|
||||||
|
|
||||||
_VALID_URL = r'^(?:https?://)?(?:\w+\.)?blip\.tv/((.+/)|(play/)|(api\.swf#))(.+)$'
|
_VALID_URL = r'https?://(?:\w+\.)?blip\.tv/((.+/)|(play/)|(api\.swf#))(?P<presumptive_id>.+)$'
|
||||||
|
|
||||||
_TEST = {
|
_TESTS = [{
|
||||||
'url': 'http://blip.tv/cbr/cbr-exclusive-gotham-city-imposters-bats-vs-jokerz-short-3-5796352',
|
'url': 'http://blip.tv/cbr/cbr-exclusive-gotham-city-imposters-bats-vs-jokerz-short-3-5796352',
|
||||||
'file': '5779306.mov',
|
|
||||||
'md5': 'c6934ad0b6acf2bd920720ec888eb812',
|
'md5': 'c6934ad0b6acf2bd920720ec888eb812',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
|
'id': '5779306',
|
||||||
|
'ext': 'mov',
|
||||||
'upload_date': '20111205',
|
'upload_date': '20111205',
|
||||||
'description': 'md5:9bc31f227219cde65e47eeec8d2dc596',
|
'description': 'md5:9bc31f227219cde65e47eeec8d2dc596',
|
||||||
'uploader': 'Comic Book Resources - CBR TV',
|
'uploader': 'Comic Book Resources - CBR TV',
|
||||||
'title': 'CBR EXCLUSIVE: "Gotham City Imposters" Bats VS Jokerz Short 3',
|
'title': 'CBR EXCLUSIVE: "Gotham City Imposters" Bats VS Jokerz Short 3',
|
||||||
}
|
}
|
||||||
}
|
}, {
|
||||||
|
# https://github.com/rg3/youtube-dl/pull/2274
|
||||||
def report_direct_download(self, title):
|
'note': 'Video with subtitles',
|
||||||
"""Report information extraction."""
|
'url': 'http://blip.tv/play/h6Uag5OEVgI.html',
|
||||||
self.to_screen('%s: Direct download detected' % title)
|
'md5': '309f9d25b820b086ca163ffac8031806',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '6586561',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'uploader': 'Red vs. Blue',
|
||||||
|
'description': 'One-Zero-One',
|
||||||
|
'upload_date': '20130614',
|
||||||
|
'title': 'Red vs. Blue Season 11 Episode 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)
|
||||||
if mobj is None:
|
presumptive_id = mobj.group('presumptive_id')
|
||||||
raise ExtractorError('Invalid URL: %s' % url)
|
|
||||||
|
|
||||||
# See https://github.com/rg3/youtube-dl/issues/857
|
# See https://github.com/rg3/youtube-dl/issues/857
|
||||||
embed_mobj = re.search(r'^(?:https?://)?(?:\w+\.)?blip\.tv/(?:play/|api\.swf#)([a-zA-Z0-9]+)', url)
|
embed_mobj = re.match(r'https?://(?:\w+\.)?blip\.tv/(?:play/|api\.swf#)([a-zA-Z0-9]+)', url)
|
||||||
if embed_mobj:
|
if embed_mobj:
|
||||||
info_url = 'http://blip.tv/play/%s.x?p=1' % embed_mobj.group(1)
|
info_url = 'http://blip.tv/play/%s.x?p=1' % embed_mobj.group(1)
|
||||||
info_page = self._download_webpage(info_url, embed_mobj.group(1))
|
info_page = self._download_webpage(info_url, embed_mobj.group(1))
|
||||||
video_id = self._search_regex(r'data-episode-id="(\d+)', info_page, 'video_id')
|
video_id = self._search_regex(
|
||||||
|
r'data-episode-id="([0-9]+)', info_page, 'video_id')
|
||||||
return self.url_result('http://blip.tv/a/a-' + video_id, 'BlipTV')
|
return self.url_result('http://blip.tv/a/a-' + video_id, 'BlipTV')
|
||||||
|
|
||||||
if '?' in url:
|
cchar = '&' if '?' in url else '?'
|
||||||
cchar = '&'
|
|
||||||
else:
|
|
||||||
cchar = '?'
|
|
||||||
json_url = url + cchar + 'skin=json&version=2&no_wrap=1'
|
json_url = url + cchar + 'skin=json&version=2&no_wrap=1'
|
||||||
request = compat_urllib_request.Request(json_url)
|
request = compat_urllib_request.Request(json_url)
|
||||||
request.add_header('User-Agent', 'iTunes/10.6.1')
|
request.add_header('User-Agent', 'iTunes/10.6.1')
|
||||||
self.report_extraction(mobj.group(1))
|
|
||||||
urlh = self._request_webpage(request, None, False,
|
|
||||||
'unable to download video info webpage')
|
|
||||||
|
|
||||||
try:
|
json_data = self._download_json(request, video_id=presumptive_id)
|
||||||
json_code_bytes = urlh.read()
|
|
||||||
json_code = json_code_bytes.decode('utf-8')
|
|
||||||
except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err:
|
|
||||||
raise ExtractorError('Unable to read video info webpage: %s' % compat_str(err))
|
|
||||||
|
|
||||||
try:
|
if 'Post' in json_data:
|
||||||
json_data = json.loads(json_code)
|
data = json_data['Post']
|
||||||
if 'Post' in json_data:
|
else:
|
||||||
data = json_data['Post']
|
data = json_data
|
||||||
else:
|
|
||||||
data = json_data
|
|
||||||
|
|
||||||
upload_date = datetime.datetime.strptime(data['datestamp'], '%m-%d-%y %H:%M%p').strftime('%Y%m%d')
|
video_id = compat_str(data['item_id'])
|
||||||
formats = []
|
upload_date = datetime.datetime.strptime(data['datestamp'], '%m-%d-%y %H:%M%p').strftime('%Y%m%d')
|
||||||
if 'additionalMedia' in data:
|
subtitles = {}
|
||||||
for f in sorted(data['additionalMedia'], key=lambda f: int(f['media_height'])):
|
formats = []
|
||||||
if not int(f['media_width']): # filter m3u8
|
if 'additionalMedia' in data:
|
||||||
continue
|
for f in data['additionalMedia']:
|
||||||
formats.append({
|
if f.get('file_type_srt') == 1:
|
||||||
'url': f['url'],
|
LANGS = {
|
||||||
'format_id': f['role'],
|
'english': 'en',
|
||||||
'width': int(f['media_width']),
|
}
|
||||||
'height': int(f['media_height']),
|
lang = f['role'].rpartition('-')[-1].strip().lower()
|
||||||
})
|
langcode = LANGS.get(lang, lang)
|
||||||
else:
|
subtitles[langcode] = f['url']
|
||||||
|
continue
|
||||||
|
if not int(f['media_width']): # filter m3u8
|
||||||
|
continue
|
||||||
formats.append({
|
formats.append({
|
||||||
'url': data['media']['url'],
|
'url': f['url'],
|
||||||
'width': int(data['media']['width']),
|
'format_id': f['role'],
|
||||||
'height': int(data['media']['height']),
|
'width': int(f['media_width']),
|
||||||
|
'height': int(f['media_height']),
|
||||||
})
|
})
|
||||||
|
else:
|
||||||
|
formats.append({
|
||||||
|
'url': data['media']['url'],
|
||||||
|
'width': int(data['media']['width']),
|
||||||
|
'height': int(data['media']['height']),
|
||||||
|
})
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
self._sort_formats(formats)
|
# subtitles
|
||||||
|
video_subtitles = self.extract_subtitles(video_id, subtitles)
|
||||||
|
if self._downloader.params.get('listsubtitles', False):
|
||||||
|
self._list_available_subtitles(video_id, subtitles)
|
||||||
|
return
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': compat_str(data['item_id']),
|
'id': video_id,
|
||||||
'uploader': data['display_name'],
|
'uploader': data['display_name'],
|
||||||
'upload_date': upload_date,
|
'upload_date': upload_date,
|
||||||
'title': data['title'],
|
'title': data['title'],
|
||||||
'thumbnail': data['thumbnailUrl'],
|
'thumbnail': data['thumbnailUrl'],
|
||||||
'description': data['description'],
|
'description': data['description'],
|
||||||
'user_agent': 'iTunes/10.6.1',
|
'user_agent': 'iTunes/10.6.1',
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
}
|
'subtitles': video_subtitles,
|
||||||
except (ValueError, KeyError) as err:
|
}
|
||||||
raise ExtractorError('Unable to parse video information: %s' % repr(err))
|
|
||||||
|
def _download_subtitle_url(self, sub_lang, url):
|
||||||
|
# For some weird reason, blip.tv serves a video instead of subtitles
|
||||||
|
# when we request with a common UA
|
||||||
|
req = compat_urllib_request.Request(url)
|
||||||
|
req.add_header('Youtubedl-user-agent', 'youtube-dl')
|
||||||
|
return self._download_webpage(req, None, note=False)
|
||||||
|
|
||||||
|
|
||||||
class BlipTVUserIE(InfoExtractor):
|
class BlipTVUserIE(InfoExtractor):
|
||||||
"""Information Extractor for blip.tv users."""
|
|
||||||
|
|
||||||
_VALID_URL = r'(?:(?:(?:https?://)?(?:\w+\.)?blip\.tv/)|bliptvuser:)([^/]+)/*$'
|
_VALID_URL = r'(?:(?:(?:https?://)?(?:\w+\.)?blip\.tv/)|bliptvuser:)([^/]+)/*$'
|
||||||
_PAGE_SIZE = 12
|
_PAGE_SIZE = 12
|
||||||
IE_NAME = 'blip.tv:user'
|
IE_NAME = 'blip.tv:user'
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
# Extract username
|
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
if mobj is None:
|
|
||||||
raise ExtractorError('Invalid URL: %s' % url)
|
|
||||||
|
|
||||||
username = mobj.group(1)
|
username = mobj.group(1)
|
||||||
|
|
||||||
page_base = 'http://m.blip.tv/pr/show_get_full_episode_list?users_id=%s&lite=0&esi=1'
|
page_base = 'http://m.blip.tv/pr/show_get_full_episode_list?users_id=%s&lite=0&esi=1'
|
||||||
@ -131,7 +140,6 @@ class BlipTVUserIE(InfoExtractor):
|
|||||||
mobj = re.search(r'data-users-id="([^"]+)"', page)
|
mobj = re.search(r'data-users-id="([^"]+)"', page)
|
||||||
page_base = page_base % mobj.group(1)
|
page_base = page_base % mobj.group(1)
|
||||||
|
|
||||||
|
|
||||||
# Download video ids using BlipTV Ajax calls. Result size per
|
# Download video ids using BlipTV Ajax calls. Result size per
|
||||||
# query is limited (currently to 12 videos) so we need to query
|
# query is limited (currently to 12 videos) so we need to query
|
||||||
# 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
|
||||||
@ -142,8 +150,8 @@ class BlipTVUserIE(InfoExtractor):
|
|||||||
|
|
||||||
while True:
|
while True:
|
||||||
url = page_base + "&page=" + str(pagenum)
|
url = page_base + "&page=" + str(pagenum)
|
||||||
page = self._download_webpage(url, username,
|
page = self._download_webpage(
|
||||||
'Downloading video ids from page %d' % pagenum)
|
url, username, 'Downloading video ids from page %d' % pagenum)
|
||||||
|
|
||||||
# Extract video identifiers
|
# Extract video identifiers
|
||||||
ids_in_page = []
|
ids_in_page = []
|
||||||
@ -167,4 +175,4 @@ class BlipTVUserIE(InfoExtractor):
|
|||||||
|
|
||||||
urls = ['http://blip.tv/%s' % video_id for video_id in video_ids]
|
urls = ['http://blip.tv/%s' % video_id for video_id in video_ids]
|
||||||
url_entries = [self.url_result(vurl, 'BlipTV') for vurl in urls]
|
url_entries = [self.url_result(vurl, 'BlipTV') for vurl in urls]
|
||||||
return [self.playlist_result(url_entries, playlist_title = username)]
|
return [self.playlist_result(url_entries, playlist_title=username)]
|
||||||
|
@ -24,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_code = self._search_regex(r'<source src="http://player.ooyala.com/player/[^/]+/([^".]+)', webpage, u'ooyala url')
|
ooyala_url = self._twitter_search_player(webpage)
|
||||||
return OoyalaIE._build_url_result(ooyala_code)
|
return self.url_result(ooyala_url, OoyalaIE.ie_key())
|
||||||
|
@ -23,7 +23,6 @@ from ..utils import (
|
|||||||
class BrightcoveIE(InfoExtractor):
|
class BrightcoveIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://.*brightcove\.com/(services|viewer).*\?(?P<query>.*)'
|
_VALID_URL = r'https?://.*brightcove\.com/(services|viewer).*\?(?P<query>.*)'
|
||||||
_FEDERATED_URL_TEMPLATE = 'http://c.brightcove.com/services/viewer/htmlFederated?%s'
|
_FEDERATED_URL_TEMPLATE = 'http://c.brightcove.com/services/viewer/htmlFederated?%s'
|
||||||
_PLAYLIST_URL_TEMPLATE = 'http://c.brightcove.com/services/json/experience/runtime/?command=get_programming_for_experience&playerKey=%s'
|
|
||||||
|
|
||||||
_TESTS = [
|
_TESTS = [
|
||||||
{
|
{
|
||||||
@ -70,7 +69,7 @@ class BrightcoveIE(InfoExtractor):
|
|||||||
'description': 'md5:363109c02998fee92ec02211bd8000df',
|
'description': 'md5:363109c02998fee92ec02211bd8000df',
|
||||||
'uploader': 'National Ballet of Canada',
|
'uploader': 'National Ballet of Canada',
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -128,20 +127,28 @@ class BrightcoveIE(InfoExtractor):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _extract_brightcove_url(cls, webpage):
|
def _extract_brightcove_url(cls, webpage):
|
||||||
"""Try to extract the brightcove url from the wepbage, returns None
|
"""Try to extract the brightcove url from the webpage, returns None
|
||||||
if it can't be found
|
if it can't be found
|
||||||
"""
|
"""
|
||||||
m_brightcove = re.search(
|
urls = cls._extract_brightcove_urls(webpage)
|
||||||
|
return urls[0] if urls else None
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def _extract_brightcove_urls(cls, webpage):
|
||||||
|
"""Return a list of all Brightcove URLs from the webpage """
|
||||||
|
|
||||||
|
url_m = re.search(r'<meta\s+property="og:video"\s+content="(http://c.brightcove.com/[^"]+)"', webpage)
|
||||||
|
if url_m:
|
||||||
|
return [url_m.group(1)]
|
||||||
|
|
||||||
|
matches = re.findall(
|
||||||
r'''(?sx)<object
|
r'''(?sx)<object
|
||||||
(?:
|
(?:
|
||||||
[^>]+?class=([\'"])[^>]*?BrightcoveExperience.*?\1 |
|
[^>]+?class=[\'"][^>]*?BrightcoveExperience.*?[\'"] |
|
||||||
[^>]*?>\s*<param\s+name="movie"\s+value="https?://[^/]*brightcove\.com/
|
[^>]*?>\s*<param\s+name="movie"\s+value="https?://[^/]*brightcove\.com/
|
||||||
).+?</object>''',
|
).+?</object>''',
|
||||||
webpage)
|
webpage)
|
||||||
if m_brightcove is not None:
|
return [cls._build_brighcove_url(m) for m in matches]
|
||||||
return cls._build_brighcove_url(m_brightcove.group())
|
|
||||||
else:
|
|
||||||
return None
|
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
url, smuggled_data = unsmuggle_url(url, {})
|
url, smuggled_data = unsmuggle_url(url, {})
|
||||||
@ -183,8 +190,9 @@ class BrightcoveIE(InfoExtractor):
|
|||||||
return self._extract_video_info(video_info)
|
return self._extract_video_info(video_info)
|
||||||
|
|
||||||
def _get_playlist_info(self, player_key):
|
def _get_playlist_info(self, player_key):
|
||||||
playlist_info = self._download_webpage(self._PLAYLIST_URL_TEMPLATE % player_key,
|
info_url = 'http://c.brightcove.com/services/json/experience/runtime/?command=get_programming_for_experience&playerKey=%s' % player_key
|
||||||
player_key, 'Downloading playlist information')
|
playlist_info = self._download_webpage(
|
||||||
|
info_url, player_key, 'Downloading playlist information')
|
||||||
|
|
||||||
json_data = json.loads(playlist_info)
|
json_data = json.loads(playlist_info)
|
||||||
if 'videoList' not in json_data:
|
if 'videoList' not in json_data:
|
||||||
@ -198,7 +206,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'),
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# encoding: utf-8
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
@ -11,38 +11,38 @@ class Channel9IE(InfoExtractor):
|
|||||||
|
|
||||||
The type of provided URL (video or playlist) is determined according to
|
The type of provided URL (video or playlist) is determined according to
|
||||||
meta Search.PageType from web page HTML rather than URL itself, as it is
|
meta Search.PageType from web page HTML rather than URL itself, as it is
|
||||||
not always possible to do.
|
not always possible to do.
|
||||||
'''
|
'''
|
||||||
IE_DESC = u'Channel 9'
|
IE_DESC = 'Channel 9'
|
||||||
IE_NAME = u'channel9'
|
IE_NAME = 'channel9'
|
||||||
_VALID_URL = r'^https?://(?:www\.)?channel9\.msdn\.com/(?P<contentpath>.+)/?'
|
_VALID_URL = r'^https?://(?:www\.)?channel9\.msdn\.com/(?P<contentpath>.+)/?'
|
||||||
|
|
||||||
_TESTS = [
|
_TESTS = [
|
||||||
{
|
{
|
||||||
u'url': u'http://channel9.msdn.com/Events/TechEd/Australia/2013/KOS002',
|
'url': 'http://channel9.msdn.com/Events/TechEd/Australia/2013/KOS002',
|
||||||
u'file': u'Events_TechEd_Australia_2013_KOS002.mp4',
|
'file': 'Events_TechEd_Australia_2013_KOS002.mp4',
|
||||||
u'md5': u'bbd75296ba47916b754e73c3a4bbdf10',
|
'md5': 'bbd75296ba47916b754e73c3a4bbdf10',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'Developer Kick-Off Session: Stuff We Love',
|
'title': 'Developer Kick-Off Session: Stuff We Love',
|
||||||
u'description': u'md5:c08d72240b7c87fcecafe2692f80e35f',
|
'description': 'md5:c08d72240b7c87fcecafe2692f80e35f',
|
||||||
u'duration': 4576,
|
'duration': 4576,
|
||||||
u'thumbnail': u'http://media.ch9.ms/ch9/9d51/03902f2d-fc97-4d3c-b195-0bfe15a19d51/KOS002_220.jpg',
|
'thumbnail': 'http://media.ch9.ms/ch9/9d51/03902f2d-fc97-4d3c-b195-0bfe15a19d51/KOS002_220.jpg',
|
||||||
u'session_code': u'KOS002',
|
'session_code': 'KOS002',
|
||||||
u'session_day': u'Day 1',
|
'session_day': 'Day 1',
|
||||||
u'session_room': u'Arena 1A',
|
'session_room': 'Arena 1A',
|
||||||
u'session_speakers': [ u'Ed Blankenship', u'Andrew Coates', u'Brady Gaster', u'Patrick Klug', u'Mads Kristensen' ],
|
'session_speakers': [ 'Ed Blankenship', 'Andrew Coates', 'Brady Gaster', 'Patrick Klug', 'Mads Kristensen' ],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
u'url': u'http://channel9.msdn.com/posts/Self-service-BI-with-Power-BI-nuclear-testing',
|
'url': 'http://channel9.msdn.com/posts/Self-service-BI-with-Power-BI-nuclear-testing',
|
||||||
u'file': u'posts_Self-service-BI-with-Power-BI-nuclear-testing.mp4',
|
'file': 'posts_Self-service-BI-with-Power-BI-nuclear-testing.mp4',
|
||||||
u'md5': u'b43ee4529d111bc37ba7ee4f34813e68',
|
'md5': 'b43ee4529d111bc37ba7ee4f34813e68',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'Self-service BI with Power BI - nuclear testing',
|
'title': 'Self-service BI with Power BI - nuclear testing',
|
||||||
u'description': u'md5:d1e6ecaafa7fb52a2cacdf9599829f5b',
|
'description': 'md5:d1e6ecaafa7fb52a2cacdf9599829f5b',
|
||||||
u'duration': 1540,
|
'duration': 1540,
|
||||||
u'thumbnail': u'http://media.ch9.ms/ch9/87e1/0300391f-a455-4c72-bec3-4422f19287e1/selfservicenuk_512.jpg',
|
'thumbnail': 'http://media.ch9.ms/ch9/87e1/0300391f-a455-4c72-bec3-4422f19287e1/selfservicenuk_512.jpg',
|
||||||
u'authors': [ u'Mike Wilmot' ],
|
'authors': [ 'Mike Wilmot' ],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -60,7 +60,7 @@ class Channel9IE(InfoExtractor):
|
|||||||
return 0
|
return 0
|
||||||
units = m.group('units')
|
units = m.group('units')
|
||||||
try:
|
try:
|
||||||
exponent = [u'B', u'KB', u'MB', u'GB', u'TB', u'PB', u'EB', u'ZB', u'YB'].index(units.upper())
|
exponent = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'].index(units.upper())
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return 0
|
return 0
|
||||||
size = float(m.group('size'))
|
size = float(m.group('size'))
|
||||||
@ -80,7 +80,7 @@ class Channel9IE(InfoExtractor):
|
|||||||
'url': x.group('url'),
|
'url': x.group('url'),
|
||||||
'format_id': x.group('quality'),
|
'format_id': x.group('quality'),
|
||||||
'format_note': x.group('note'),
|
'format_note': x.group('note'),
|
||||||
'format': u'%s (%s)' % (x.group('quality'), x.group('note')),
|
'format': '%s (%s)' % (x.group('quality'), x.group('note')),
|
||||||
'filesize': self._restore_bytes(x.group('filesize')), # File size is approximate
|
'filesize': self._restore_bytes(x.group('filesize')), # File size is approximate
|
||||||
'preference': self._known_formats.index(x.group('quality')),
|
'preference': self._known_formats.index(x.group('quality')),
|
||||||
'vcodec': 'none' if x.group('note') == 'Audio only' else None,
|
'vcodec': 'none' if x.group('note') == 'Audio only' else None,
|
||||||
@ -91,10 +91,10 @@ class Channel9IE(InfoExtractor):
|
|||||||
return formats
|
return formats
|
||||||
|
|
||||||
def _extract_title(self, html):
|
def _extract_title(self, html):
|
||||||
title = self._html_search_meta(u'title', html, u'title')
|
title = self._html_search_meta('title', html, 'title')
|
||||||
if title is None:
|
if title is None:
|
||||||
title = self._og_search_title(html)
|
title = self._og_search_title(html)
|
||||||
TITLE_SUFFIX = u' (Channel 9)'
|
TITLE_SUFFIX = ' (Channel 9)'
|
||||||
if title is not None and title.endswith(TITLE_SUFFIX):
|
if title is not None and title.endswith(TITLE_SUFFIX):
|
||||||
title = title[:-len(TITLE_SUFFIX)]
|
title = title[:-len(TITLE_SUFFIX)]
|
||||||
return title
|
return title
|
||||||
@ -110,7 +110,7 @@ class Channel9IE(InfoExtractor):
|
|||||||
m = re.search(DESCRIPTION_REGEX, html)
|
m = re.search(DESCRIPTION_REGEX, html)
|
||||||
if m is not None:
|
if m is not None:
|
||||||
return m.group('description')
|
return m.group('description')
|
||||||
return self._html_search_meta(u'description', html, u'description')
|
return self._html_search_meta('description', html, 'description')
|
||||||
|
|
||||||
def _extract_duration(self, html):
|
def _extract_duration(self, html):
|
||||||
m = re.search(r'data-video_duration="(?P<hours>\d{2}):(?P<minutes>\d{2}):(?P<seconds>\d{2})"', html)
|
m = re.search(r'data-video_duration="(?P<hours>\d{2}):(?P<minutes>\d{2}):(?P<seconds>\d{2})"', html)
|
||||||
@ -172,7 +172,7 @@ class Channel9IE(InfoExtractor):
|
|||||||
|
|
||||||
# Nothing to download
|
# Nothing to download
|
||||||
if len(formats) == 0 and slides is None and zip_ is None:
|
if len(formats) == 0 and slides is None and zip_ is None:
|
||||||
self._downloader.report_warning(u'None of recording, slides or zip are available for %s' % content_path)
|
self._downloader.report_warning('None of recording, slides or zip are available for %s' % content_path)
|
||||||
return
|
return
|
||||||
|
|
||||||
# Extract meta
|
# Extract meta
|
||||||
@ -244,7 +244,7 @@ class Channel9IE(InfoExtractor):
|
|||||||
return contents
|
return contents
|
||||||
|
|
||||||
def _extract_list(self, content_path):
|
def _extract_list(self, content_path):
|
||||||
rss = self._download_xml(self._RSS_URL % content_path, content_path, u'Downloading RSS')
|
rss = self._download_xml(self._RSS_URL % content_path, content_path, 'Downloading RSS')
|
||||||
entries = [self.url_result(session_url.text, 'Channel9')
|
entries = [self.url_result(session_url.text, 'Channel9')
|
||||||
for session_url in rss.findall('./channel/item/link')]
|
for session_url in rss.findall('./channel/item/link')]
|
||||||
title_text = rss.find('./channel/title').text
|
title_text = rss.find('./channel/title').text
|
||||||
@ -254,11 +254,11 @@ class Channel9IE(InfoExtractor):
|
|||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
content_path = mobj.group('contentpath')
|
content_path = mobj.group('contentpath')
|
||||||
|
|
||||||
webpage = self._download_webpage(url, content_path, u'Downloading web page')
|
webpage = self._download_webpage(url, content_path, 'Downloading web page')
|
||||||
|
|
||||||
page_type_m = re.search(r'<meta name="Search.PageType" content="(?P<pagetype>[^"]+)"/>', webpage)
|
page_type_m = re.search(r'<meta name="Search.PageType" content="(?P<pagetype>[^"]+)"/>', webpage)
|
||||||
if page_type_m is None:
|
if page_type_m is None:
|
||||||
raise ExtractorError(u'Search.PageType not found, don\'t know how to process this page', expected=True)
|
raise ExtractorError('Search.PageType not found, don\'t know how to process this page', expected=True)
|
||||||
|
|
||||||
page_type = page_type_m.group('pagetype')
|
page_type = page_type_m.group('pagetype')
|
||||||
if page_type == 'List': # List page, may contain list of 'item'-like objects
|
if page_type == 'List': # List page, may contain list of 'item'-like objects
|
||||||
@ -268,4 +268,4 @@ class Channel9IE(InfoExtractor):
|
|||||||
elif page_type == 'Session': # Event session page, may contain downloadable content
|
elif page_type == 'Session': # Event session page, may contain downloadable content
|
||||||
return self._extract_session(webpage, content_path)
|
return self._extract_session(webpage, content_path)
|
||||||
else:
|
else:
|
||||||
raise ExtractorError(u'Unexpected Search.PageType %s' % page_type, expected=True)
|
raise ExtractorError('Unexpected Search.PageType %s' % page_type, expected=True)
|
56
youtube_dl/extractor/cliphunter.py
Normal file
56
youtube_dl/extractor/cliphunter.py
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
|
translation_table = {
|
||||||
|
'a': 'h', 'd': 'e', 'e': 'v', 'f': 'o', 'g': 'f', 'i': 'd', 'l': 'n',
|
||||||
|
'm': 'a', 'n': 'm', 'p': 'u', 'q': 't', 'r': 's', 'v': 'p', 'x': 'r',
|
||||||
|
'y': 'l', 'z': 'i',
|
||||||
|
'$': ':', '&': '.', '(': '=', '^': '&', '=': '/',
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class CliphunterIE(InfoExtractor):
|
||||||
|
IE_NAME = 'cliphunter'
|
||||||
|
|
||||||
|
_VALID_URL = r'''(?x)http://(?:www\.)?cliphunter\.com/w/
|
||||||
|
(?P<id>[0-9]+)/
|
||||||
|
(?P<seo>.+?)(?:$|[#\?])
|
||||||
|
'''
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://www.cliphunter.com/w/1012420/Fun_Jynx_Maze_solo',
|
||||||
|
'file': '1012420.flv',
|
||||||
|
'md5': '15e7740f30428abf70f4223478dc1225',
|
||||||
|
'info_dict': {
|
||||||
|
'title': 'Fun Jynx Maze solo',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
|
pl_fiji = self._search_regex(
|
||||||
|
r'pl_fiji = \'([^\']+)\'', webpage, 'video data')
|
||||||
|
pl_c_qual = self._search_regex(
|
||||||
|
r'pl_c_qual = "(.)"', webpage, 'video quality')
|
||||||
|
video_title = self._search_regex(
|
||||||
|
r'mediaTitle = "([^"]+)"', webpage, 'title')
|
||||||
|
|
||||||
|
video_url = ''.join(translation_table.get(c, c) for c in pl_fiji)
|
||||||
|
|
||||||
|
formats = [{
|
||||||
|
'url': video_url,
|
||||||
|
'format_id': pl_c_qual,
|
||||||
|
}]
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': video_title,
|
||||||
|
'formats': formats,
|
||||||
|
}
|
@ -4,6 +4,7 @@ import json
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from ..utils import int_or_none
|
||||||
|
|
||||||
|
|
||||||
class CollegeHumorIE(InfoExtractor):
|
class CollegeHumorIE(InfoExtractor):
|
||||||
@ -11,24 +12,45 @@ class CollegeHumorIE(InfoExtractor):
|
|||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'http://www.collegehumor.com/video/6902724/comic-con-cosplay-catastrophe',
|
'url': 'http://www.collegehumor.com/video/6902724/comic-con-cosplay-catastrophe',
|
||||||
'file': '6902724.mp4',
|
|
||||||
'md5': 'dcc0f5c1c8be98dc33889a191f4c26bd',
|
'md5': 'dcc0f5c1c8be98dc33889a191f4c26bd',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
|
'id': '6902724',
|
||||||
|
'ext': 'mp4',
|
||||||
'title': 'Comic-Con Cosplay Catastrophe',
|
'title': 'Comic-Con Cosplay Catastrophe',
|
||||||
'description': 'Fans get creative this year at San Diego. Too',
|
'description': 'Fans get creative this year',
|
||||||
'age_limit': 13,
|
'age_limit': 13,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'url': 'http://www.collegehumor.com/video/3505939/font-conference',
|
'url': 'http://www.collegehumor.com/video/3505939/font-conference',
|
||||||
'file': '3505939.mp4',
|
|
||||||
'md5': '72fa701d8ef38664a4dbb9e2ab721816',
|
'md5': '72fa701d8ef38664a4dbb9e2ab721816',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
|
'id': '3505939',
|
||||||
|
'ext': 'mp4',
|
||||||
'title': 'Font Conference',
|
'title': 'Font Conference',
|
||||||
'description': 'This video wasn\'t long enough, so we made it double-spaced.',
|
'description': 'This video wasn\'t long enough,',
|
||||||
'age_limit': 10,
|
'age_limit': 10,
|
||||||
|
'duration': 179,
|
||||||
},
|
},
|
||||||
}]
|
},
|
||||||
|
# embedded youtube video
|
||||||
|
{
|
||||||
|
'url': 'http://www.collegehumor.com/embed/6950457',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'W5gMp3ZjYg4',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Funny Dogs Protecting Babies Compilation 2014 [NEW HD]',
|
||||||
|
'uploader': 'Funnyplox TV',
|
||||||
|
'uploader_id': 'funnyploxtv',
|
||||||
|
'description': 'md5:11812366244110c3523968aa74f02521',
|
||||||
|
'upload_date': '20140128',
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
'skip_download': True,
|
||||||
|
},
|
||||||
|
'add_ie': ['Youtube'],
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
@ -38,6 +60,12 @@ class CollegeHumorIE(InfoExtractor):
|
|||||||
data = json.loads(self._download_webpage(
|
data = json.loads(self._download_webpage(
|
||||||
jsonUrl, video_id, 'Downloading info JSON'))
|
jsonUrl, video_id, 'Downloading info JSON'))
|
||||||
vdata = data['video']
|
vdata = data['video']
|
||||||
|
if vdata.get('youtubeId') is not None:
|
||||||
|
return {
|
||||||
|
'_type': 'url',
|
||||||
|
'url': vdata['youtubeId'],
|
||||||
|
'ie_key': 'Youtube',
|
||||||
|
}
|
||||||
|
|
||||||
AGE_LIMITS = {'nc17': 18, 'r': 18, 'pg13': 13, 'pg': 10, 'g': 0}
|
AGE_LIMITS = {'nc17': 18, 'r': 18, 'pg13': 13, 'pg': 10, 'g': 0}
|
||||||
rating = vdata.get('rating')
|
rating = vdata.get('rating')
|
||||||
@ -49,7 +77,7 @@ class CollegeHumorIE(InfoExtractor):
|
|||||||
PREFS = {'high_quality': 2, 'low_quality': 0}
|
PREFS = {'high_quality': 2, 'low_quality': 0}
|
||||||
formats = []
|
formats = []
|
||||||
for format_key in ('mp4', 'webm'):
|
for format_key in ('mp4', 'webm'):
|
||||||
for qname, qurl in vdata[format_key].items():
|
for qname, qurl in vdata.get(format_key, {}).items():
|
||||||
formats.append({
|
formats.append({
|
||||||
'format_id': format_key + '_' + qname,
|
'format_id': format_key + '_' + qname,
|
||||||
'url': qurl,
|
'url': qurl,
|
||||||
@ -58,6 +86,8 @@ class CollegeHumorIE(InfoExtractor):
|
|||||||
})
|
})
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
duration = int_or_none(vdata.get('duration'), 1000)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': vdata['title'],
|
'title': vdata['title'],
|
||||||
@ -65,4 +95,5 @@ class CollegeHumorIE(InfoExtractor):
|
|||||||
'thumbnail': vdata.get('thumbnail'),
|
'thumbnail': vdata.get('thumbnail'),
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'age_limit': age_limit,
|
'age_limit': age_limit,
|
||||||
|
'duration': duration,
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
@ -12,33 +14,25 @@ from ..utils import (
|
|||||||
|
|
||||||
|
|
||||||
class ComedyCentralIE(MTVServicesInfoExtractor):
|
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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,22 +86,22 @@ class ComedyCentralShowsIE(InfoExtractor):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
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,
|
||||||
|
@ -63,13 +63,15 @@ class InfoExtractor(object):
|
|||||||
* tbr Average bitrate of audio and video in KBit/s
|
* tbr Average bitrate of audio and video in KBit/s
|
||||||
* abr Average audio bitrate in KBit/s
|
* abr Average audio bitrate in KBit/s
|
||||||
* acodec Name of the audio codec in use
|
* acodec Name of the audio codec in use
|
||||||
|
* asr Audio sampling rate in Hertz
|
||||||
* vbr Average video bitrate in KBit/s
|
* vbr Average video bitrate in KBit/s
|
||||||
* vcodec Name of the video codec in use
|
* vcodec Name of the video codec in use
|
||||||
|
* container Name of the container format
|
||||||
* filesize The number of bytes, if known in advance
|
* filesize The number of bytes, if known in advance
|
||||||
* player_url SWF Player URL (used for rtmpdump).
|
* player_url SWF Player URL (used for rtmpdump).
|
||||||
* protocol The protocol that will be used for the actual
|
* protocol The protocol that will be used for the actual
|
||||||
download, lower-case.
|
download, lower-case.
|
||||||
"http", "https", "rtsp", "rtmp" or so.
|
"http", "https", "rtsp", "rtmp", "m3u8" or so.
|
||||||
* preference Order number of this format. If this field is
|
* preference Order number of this format. If this field is
|
||||||
present and not None, the formats get sorted
|
present and not None, the formats get sorted
|
||||||
by this field.
|
by this field.
|
||||||
@ -238,7 +240,7 @@ class InfoExtractor(object):
|
|||||||
except AttributeError:
|
except AttributeError:
|
||||||
url = url_or_request
|
url = url_or_request
|
||||||
if len(url) > 200:
|
if len(url) > 200:
|
||||||
h = u'___' + hashlib.md5(url).hexdigest()
|
h = u'___' + hashlib.md5(url.encode('utf-8')).hexdigest()
|
||||||
url = url[:200 - len(h)] + h
|
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)
|
||||||
@ -397,7 +399,7 @@ class InfoExtractor(object):
|
|||||||
# Helper functions for extracting OpenGraph info
|
# Helper functions for extracting OpenGraph info
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _og_regexes(prop):
|
def _og_regexes(prop):
|
||||||
content_re = r'content=(?:"([^>]+?)"|\'(.+?)\')'
|
content_re = r'content=(?:"([^>]+?)"|\'([^>]+?)\')'
|
||||||
property_re = r'(?:name|property)=[\'"]og:%s[\'"]' % re.escape(prop)
|
property_re = r'(?:name|property)=[\'"]og:%s[\'"]' % re.escape(prop)
|
||||||
template = r'<meta[^>]+?%s[^>]+?%s'
|
template = r'<meta[^>]+?%s[^>]+?%s'
|
||||||
return [
|
return [
|
||||||
@ -463,7 +465,14 @@ class InfoExtractor(object):
|
|||||||
}
|
}
|
||||||
return RATING_TABLE.get(rating.lower(), None)
|
return RATING_TABLE.get(rating.lower(), None)
|
||||||
|
|
||||||
|
def _twitter_search_player(self, html):
|
||||||
|
return self._html_search_meta('twitter:player', html,
|
||||||
|
'twitter card player')
|
||||||
|
|
||||||
def _sort_formats(self, formats):
|
def _sort_formats(self, formats):
|
||||||
|
if not formats:
|
||||||
|
raise ExtractorError(u'No video formats found')
|
||||||
|
|
||||||
def _formats_key(f):
|
def _formats_key(f):
|
||||||
# TODO remove the following workaround
|
# TODO remove the following workaround
|
||||||
from ..utils import determine_ext
|
from ..utils import determine_ext
|
||||||
|
@ -30,7 +30,7 @@ class CondeNastIE(InfoExtractor):
|
|||||||
'vanityfair': 'Vanity Fair',
|
'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 = 'Condé Nast media group: %s' % ', '.join(sorted(_SITES.values()))
|
IE_DESC = 'Condé Nast media group: %s' % ', '.join(sorted(_SITES.values()))
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re, base64, zlib
|
import re, base64, zlib
|
||||||
from hashlib import sha1
|
from hashlib import sha1
|
||||||
from math import pow, sqrt, floor
|
from math import pow, sqrt, floor
|
||||||
@ -18,29 +20,29 @@ from ..aes import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
class CrunchyrollIE(InfoExtractor):
|
class CrunchyrollIE(InfoExtractor):
|
||||||
_VALID_URL = r'(?:https?://)?(?:www\.)?(?P<url>crunchyroll\.com/[^/]*/[^/?&]*?(?P<video_id>[0-9]+))(?:[/?&]|$)'
|
_VALID_URL = r'(?:https?://)?(?:(?P<prefix>www|m)\.)?(?P<url>crunchyroll\.com/(?:[^/]*/[^/?&]*?|media/\?id=)(?P<video_id>[0-9]+))(?:[/?&]|$)'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
u'url': u'http://www.crunchyroll.com/wanna-be-the-strongest-in-the-world/episode-1-an-idol-wrestler-is-born-645513',
|
'url': 'http://www.crunchyroll.com/wanna-be-the-strongest-in-the-world/episode-1-an-idol-wrestler-is-born-645513',
|
||||||
u'file': u'645513.flv',
|
'file': '645513.flv',
|
||||||
#u'md5': u'b1639fd6ddfaa43788c85f6d1dddd412',
|
#'md5': 'b1639fd6ddfaa43788c85f6d1dddd412',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'Wanna be the Strongest in the World Episode 1 – An Idol-Wrestler is Born!',
|
'title': 'Wanna be the Strongest in the World Episode 1 – An Idol-Wrestler is Born!',
|
||||||
u'description': u'md5:2d17137920c64f2f49981a7797d275ef',
|
'description': 'md5:2d17137920c64f2f49981a7797d275ef',
|
||||||
u'thumbnail': u'http://img1.ak.crunchyroll.com/i/spire1-tmb/20c6b5e10f1a47b10516877d3c039cae1380951166_full.jpg',
|
'thumbnail': 'http://img1.ak.crunchyroll.com/i/spire1-tmb/20c6b5e10f1a47b10516877d3c039cae1380951166_full.jpg',
|
||||||
u'uploader': u'Yomiuri Telecasting Corporation (YTV)',
|
'uploader': 'Yomiuri Telecasting Corporation (YTV)',
|
||||||
u'upload_date': u'20131013',
|
'upload_date': '20131013',
|
||||||
},
|
},
|
||||||
u'params': {
|
'params': {
|
||||||
# rtmp
|
# rtmp
|
||||||
u'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
}]
|
}]
|
||||||
|
|
||||||
_FORMAT_IDS = {
|
_FORMAT_IDS = {
|
||||||
u'360': (u'60', u'106'),
|
'360': ('60', '106'),
|
||||||
u'480': (u'61', u'106'),
|
'480': ('61', '106'),
|
||||||
u'720': (u'62', u'106'),
|
'720': ('62', '106'),
|
||||||
u'1080': (u'80', u'108'),
|
'1080': ('80', '108'),
|
||||||
}
|
}
|
||||||
|
|
||||||
def _decrypt_subtitles(self, data, iv, id):
|
def _decrypt_subtitles(self, data, iv, id):
|
||||||
@ -63,7 +65,7 @@ class CrunchyrollIE(InfoExtractor):
|
|||||||
num3 = key ^ num1
|
num3 = key ^ num1
|
||||||
num4 = num3 ^ (num3 >> 3) ^ num2
|
num4 = num3 ^ (num3 >> 3) ^ num2
|
||||||
prefix = intlist_to_bytes(obfuscate_key_aux(20, 97, (1, 2)))
|
prefix = intlist_to_bytes(obfuscate_key_aux(20, 97, (1, 2)))
|
||||||
shaHash = bytes_to_intlist(sha1(prefix + str(num4).encode(u'ascii')).digest())
|
shaHash = bytes_to_intlist(sha1(prefix + str(num4).encode('ascii')).digest())
|
||||||
# Extend 160 Bit hash to 256 Bit
|
# Extend 160 Bit hash to 256 Bit
|
||||||
return shaHash + [0] * 12
|
return shaHash + [0] * 12
|
||||||
|
|
||||||
@ -79,93 +81,98 @@ class CrunchyrollIE(InfoExtractor):
|
|||||||
|
|
||||||
def _convert_subtitles_to_srt(self, subtitles):
|
def _convert_subtitles_to_srt(self, subtitles):
|
||||||
i=1
|
i=1
|
||||||
output = u''
|
output = ''
|
||||||
for start, end, text in re.findall(r'<event [^>]*?start="([^"]+)" [^>]*?end="([^"]+)" [^>]*?text="([^"]+)"[^>]*?>', subtitles):
|
for start, end, text in re.findall(r'<event [^>]*?start="([^"]+)" [^>]*?end="([^"]+)" [^>]*?text="([^"]+)"[^>]*?>', subtitles):
|
||||||
start = start.replace(u'.', u',')
|
start = start.replace('.', ',')
|
||||||
end = end.replace(u'.', u',')
|
end = end.replace('.', ',')
|
||||||
text = clean_html(text)
|
text = clean_html(text)
|
||||||
text = text.replace(u'\\N', u'\n')
|
text = text.replace('\\N', '\n')
|
||||||
if not text:
|
if not text:
|
||||||
continue
|
continue
|
||||||
output += u'%d\n%s --> %s\n%s\n\n' % (i, start, end, text)
|
output += '%d\n%s --> %s\n%s\n\n' % (i, start, end, text)
|
||||||
i+=1
|
i+=1
|
||||||
return output
|
return output
|
||||||
|
|
||||||
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('video_id')
|
||||||
|
|
||||||
webpage_url = u'http://www.' + mobj.group('url')
|
if mobj.group('prefix') == 'm':
|
||||||
video_id = mobj.group(u'video_id')
|
mobile_webpage = self._download_webpage(url, video_id, 'Downloading mobile webpage')
|
||||||
webpage = self._download_webpage(webpage_url, video_id)
|
webpage_url = self._search_regex(r'<link rel="canonical" href="([^"]+)" />', mobile_webpage, 'webpage_url')
|
||||||
note_m = self._html_search_regex(r'<div class="showmedia-trailer-notice">(.+?)</div>', webpage, u'trailer-notice', default=u'')
|
else:
|
||||||
|
webpage_url = 'http://www.' + mobj.group('url')
|
||||||
|
|
||||||
|
webpage = self._download_webpage(webpage_url, video_id, 'Downloading webpage')
|
||||||
|
note_m = self._html_search_regex(r'<div class="showmedia-trailer-notice">(.+?)</div>', webpage, 'trailer-notice', default='')
|
||||||
if note_m:
|
if note_m:
|
||||||
raise ExtractorError(note_m)
|
raise ExtractorError(note_m)
|
||||||
|
|
||||||
video_title = self._html_search_regex(r'<h1[^>]*>(.+?)</h1>', webpage, u'video_title', flags=re.DOTALL)
|
video_title = self._html_search_regex(r'<h1[^>]*>(.+?)</h1>', webpage, 'video_title', flags=re.DOTALL)
|
||||||
video_title = re.sub(r' {2,}', u' ', video_title)
|
video_title = re.sub(r' {2,}', ' ', video_title)
|
||||||
video_description = self._html_search_regex(r'"description":"([^"]+)', webpage, u'video_description', default=u'')
|
video_description = self._html_search_regex(r'"description":"([^"]+)', webpage, 'video_description', default='')
|
||||||
if not video_description:
|
if not video_description:
|
||||||
video_description = None
|
video_description = None
|
||||||
video_upload_date = self._html_search_regex(r'<div>Availability for free users:(.+?)</div>', webpage, u'video_upload_date', fatal=False, flags=re.DOTALL)
|
video_upload_date = self._html_search_regex(r'<div>Availability for free users:(.+?)</div>', webpage, 'video_upload_date', fatal=False, flags=re.DOTALL)
|
||||||
if video_upload_date:
|
if video_upload_date:
|
||||||
video_upload_date = unified_strdate(video_upload_date)
|
video_upload_date = unified_strdate(video_upload_date)
|
||||||
video_uploader = self._html_search_regex(r'<div>\s*Publisher:(.+?)</div>', webpage, u'video_uploader', fatal=False, flags=re.DOTALL)
|
video_uploader = self._html_search_regex(r'<div>\s*Publisher:(.+?)</div>', webpage, 'video_uploader', fatal=False, flags=re.DOTALL)
|
||||||
|
|
||||||
playerdata_url = compat_urllib_parse.unquote(self._html_search_regex(r'"config_url":"([^"]+)', webpage, u'playerdata_url'))
|
playerdata_url = compat_urllib_parse.unquote(self._html_search_regex(r'"config_url":"([^"]+)', webpage, 'playerdata_url'))
|
||||||
playerdata_req = compat_urllib_request.Request(playerdata_url)
|
playerdata_req = compat_urllib_request.Request(playerdata_url)
|
||||||
playerdata_req.data = compat_urllib_parse.urlencode({u'current_page': webpage_url})
|
playerdata_req.data = compat_urllib_parse.urlencode({'current_page': webpage_url})
|
||||||
playerdata_req.add_header(u'Content-Type', u'application/x-www-form-urlencoded')
|
playerdata_req.add_header('Content-Type', 'application/x-www-form-urlencoded')
|
||||||
playerdata = self._download_webpage(playerdata_req, video_id, note=u'Downloading media info')
|
playerdata = self._download_webpage(playerdata_req, video_id, note='Downloading media info')
|
||||||
|
|
||||||
stream_id = self._search_regex(r'<media_id>([^<]+)', playerdata, u'stream_id')
|
stream_id = self._search_regex(r'<media_id>([^<]+)', playerdata, 'stream_id')
|
||||||
video_thumbnail = self._search_regex(r'<episode_image_url>([^<]+)', playerdata, u'thumbnail', fatal=False)
|
video_thumbnail = self._search_regex(r'<episode_image_url>([^<]+)', playerdata, 'thumbnail', fatal=False)
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
for fmt in re.findall(r'\?p([0-9]{3,4})=1', webpage):
|
for fmt in re.findall(r'\?p([0-9]{3,4})=1', webpage):
|
||||||
stream_quality, stream_format = self._FORMAT_IDS[fmt]
|
stream_quality, stream_format = self._FORMAT_IDS[fmt]
|
||||||
video_format = fmt+u'p'
|
video_format = fmt+'p'
|
||||||
streamdata_req = compat_urllib_request.Request(u'http://www.crunchyroll.com/xml/')
|
streamdata_req = compat_urllib_request.Request('http://www.crunchyroll.com/xml/')
|
||||||
# urlencode doesn't work!
|
# urlencode doesn't work!
|
||||||
streamdata_req.data = u'req=RpcApiVideoEncode%5FGetStreamInfo&video%5Fencode%5Fquality='+stream_quality+u'&media%5Fid='+stream_id+u'&video%5Fformat='+stream_format
|
streamdata_req.data = 'req=RpcApiVideoEncode%5FGetStreamInfo&video%5Fencode%5Fquality='+stream_quality+'&media%5Fid='+stream_id+'&video%5Fformat='+stream_format
|
||||||
streamdata_req.add_header(u'Content-Type', u'application/x-www-form-urlencoded')
|
streamdata_req.add_header('Content-Type', 'application/x-www-form-urlencoded')
|
||||||
streamdata_req.add_header(u'Content-Length', str(len(streamdata_req.data)))
|
streamdata_req.add_header('Content-Length', str(len(streamdata_req.data)))
|
||||||
streamdata = self._download_webpage(streamdata_req, video_id, note=u'Downloading media info for '+video_format)
|
streamdata = self._download_webpage(streamdata_req, video_id, note='Downloading media info for '+video_format)
|
||||||
video_url = self._search_regex(r'<host>([^<]+)', streamdata, u'video_url')
|
video_url = self._search_regex(r'<host>([^<]+)', streamdata, 'video_url')
|
||||||
video_play_path = self._search_regex(r'<file>([^<]+)', streamdata, u'video_play_path')
|
video_play_path = self._search_regex(r'<file>([^<]+)', streamdata, 'video_play_path')
|
||||||
formats.append({
|
formats.append({
|
||||||
u'url': video_url,
|
'url': video_url,
|
||||||
u'play_path': video_play_path,
|
'play_path': video_play_path,
|
||||||
u'ext': 'flv',
|
'ext': 'flv',
|
||||||
u'format': video_format,
|
'format': video_format,
|
||||||
u'format_id': video_format,
|
'format_id': video_format,
|
||||||
})
|
})
|
||||||
|
|
||||||
subtitles = {}
|
subtitles = {}
|
||||||
for sub_id, sub_name in re.findall(r'\?ssid=([0-9]+)" title="([^"]+)', webpage):
|
for sub_id, sub_name in re.findall(r'\?ssid=([0-9]+)" title="([^"]+)', webpage):
|
||||||
sub_page = self._download_webpage(u'http://www.crunchyroll.com/xml/?req=RpcApiSubtitle_GetXml&subtitle_script_id='+sub_id,\
|
sub_page = self._download_webpage('http://www.crunchyroll.com/xml/?req=RpcApiSubtitle_GetXml&subtitle_script_id='+sub_id,\
|
||||||
video_id, note=u'Downloading subtitles for '+sub_name)
|
video_id, note='Downloading subtitles for '+sub_name)
|
||||||
id = self._search_regex(r'id=\'([0-9]+)', sub_page, u'subtitle_id', fatal=False)
|
id = self._search_regex(r'id=\'([0-9]+)', sub_page, 'subtitle_id', fatal=False)
|
||||||
iv = self._search_regex(r'<iv>([^<]+)', sub_page, u'subtitle_iv', fatal=False)
|
iv = self._search_regex(r'<iv>([^<]+)', sub_page, 'subtitle_iv', fatal=False)
|
||||||
data = self._search_regex(r'<data>([^<]+)', sub_page, u'subtitle_data', fatal=False)
|
data = self._search_regex(r'<data>([^<]+)', sub_page, 'subtitle_data', fatal=False)
|
||||||
if not id or not iv or not data:
|
if not id or not iv or not data:
|
||||||
continue
|
continue
|
||||||
id = int(id)
|
id = int(id)
|
||||||
iv = base64.b64decode(iv)
|
iv = base64.b64decode(iv)
|
||||||
data = base64.b64decode(data)
|
data = base64.b64decode(data)
|
||||||
|
|
||||||
subtitle = self._decrypt_subtitles(data, iv, id).decode(u'utf-8')
|
subtitle = self._decrypt_subtitles(data, iv, id).decode('utf-8')
|
||||||
lang_code = self._search_regex(r'lang_code=\'([^\']+)', subtitle, u'subtitle_lang_code', fatal=False)
|
lang_code = self._search_regex(r'lang_code=\'([^\']+)', subtitle, 'subtitle_lang_code', fatal=False)
|
||||||
if not lang_code:
|
if not lang_code:
|
||||||
continue
|
continue
|
||||||
subtitles[lang_code] = self._convert_subtitles_to_srt(subtitle)
|
subtitles[lang_code] = self._convert_subtitles_to_srt(subtitle)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
u'id': video_id,
|
'id': video_id,
|
||||||
u'title': video_title,
|
'title': video_title,
|
||||||
u'description': video_description,
|
'description': video_description,
|
||||||
u'thumbnail': video_thumbnail,
|
'thumbnail': video_thumbnail,
|
||||||
u'uploader': video_uploader,
|
'uploader': video_uploader,
|
||||||
u'upload_date': video_upload_date,
|
'upload_date': video_upload_date,
|
||||||
u'subtitles': subtitles,
|
'subtitles': subtitles,
|
||||||
u'formats': formats,
|
'formats': formats,
|
||||||
}
|
}
|
||||||
|
@ -1,48 +1,60 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import json
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
unescapeHTML,
|
unescapeHTML,
|
||||||
|
find_xpath_attr,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class CSpanIE(InfoExtractor):
|
class CSpanIE(InfoExtractor):
|
||||||
_VALID_URL = r'http://www\.c-spanvideo\.org/program/(.*)'
|
_VALID_URL = r'http://(?:www\.)?c-span\.org/video/\?(?P<id>\d+)'
|
||||||
IE_DESC = 'C-SPAN'
|
IE_DESC = 'C-SPAN'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'http://www.c-spanvideo.org/program/HolderonV',
|
'url': 'http://www.c-span.org/video/?313572-1/HolderonV',
|
||||||
'file': '315139.mp4',
|
|
||||||
'md5': '8e44ce11f0f725527daccc453f553eb0',
|
'md5': '8e44ce11f0f725527daccc453f553eb0',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
|
'id': '315139',
|
||||||
|
'ext': 'mp4',
|
||||||
'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)
|
page_id = mobj.group('id')
|
||||||
webpage = self._download_webpage(url, prog_name)
|
webpage = self._download_webpage(url, page_id)
|
||||||
video_id = self._search_regex(r'programid=(.*?)&', webpage, 'video id')
|
video_id = self._search_regex(r'data-progid=\'(\d+)\'>', webpage, 'video id')
|
||||||
|
|
||||||
title = self._html_search_regex(
|
description = self._html_search_regex(
|
||||||
r'<!-- title -->\n\s*<h1[^>]*>(.*?)</h1>', webpage, 'title')
|
[
|
||||||
description = self._og_search_description(webpage)
|
# The full description
|
||||||
|
r'<div class=\'expandable\'>(.*?)<a href=\'#\'',
|
||||||
|
# If the description is small enough the other div is not
|
||||||
|
# present, otherwise this is a stripped version
|
||||||
|
r'<p class=\'initial\'>(.*?)</p>'
|
||||||
|
],
|
||||||
|
webpage, 'description', flags=re.DOTALL)
|
||||||
|
|
||||||
info_url = 'http://c-spanvideo.org/videoLibrary/assets/player/ajax-player.php?os=android&html5=program&id=' + video_id
|
info_url = 'http://c-spanvideo.org/videoLibrary/assets/player/ajax-player.php?os=android&html5=program&id=' + video_id
|
||||||
data_json = self._download_webpage(
|
data = self._download_json(info_url, video_id)
|
||||||
info_url, video_id, 'Downloading video info')
|
|
||||||
data = json.loads(data_json)
|
|
||||||
|
|
||||||
url = unescapeHTML(data['video']['files'][0]['path']['#text'])
|
url = unescapeHTML(data['video']['files'][0]['path']['#text'])
|
||||||
|
|
||||||
|
doc = self._download_xml('http://www.c-span.org/common/services/flashXml.php?programid=' + video_id,
|
||||||
|
video_id)
|
||||||
|
|
||||||
|
def find_string(s):
|
||||||
|
return find_xpath_attr(doc, './/string', 'name', s).text
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': title,
|
'title': find_string('title'),
|
||||||
'url': url,
|
'url': url,
|
||||||
'description': description,
|
'description': description,
|
||||||
'thumbnail': self._og_search_thumbnail(webpage),
|
'thumbnail': find_string('poster'),
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,25 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from .canalplus import CanalplusIE
|
from .canalplus import CanalplusIE
|
||||||
|
|
||||||
|
|
||||||
class D8IE(CanalplusIE):
|
class D8IE(CanalplusIE):
|
||||||
_VALID_URL = r'https?://www\.d8\.tv/.*?/(?P<path>.*)'
|
_VALID_URL = r'https?://www\.d8\.tv/.*?/(?P<path>.*)'
|
||||||
_VIDEO_INFO_TEMPLATE = 'http://service.canal-plus.com/video/rest/getVideosLiees/d8/%s'
|
_VIDEO_INFO_TEMPLATE = 'http://service.canal-plus.com/video/rest/getVideosLiees/d8/%s'
|
||||||
IE_NAME = u'd8.tv'
|
IE_NAME = 'd8.tv'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.d8.tv/d8-docs-mags/pid6589-d8-campagne-intime.html',
|
'url': 'http://www.d8.tv/d8-docs-mags/pid6589-d8-campagne-intime.html',
|
||||||
u'file': u'966289.flv',
|
'file': '966289.flv',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'Campagne intime - Documentaire exceptionnel',
|
'title': 'Campagne intime - Documentaire exceptionnel',
|
||||||
u'description': u'md5:d2643b799fb190846ae09c61e59a859f',
|
'description': 'md5:d2643b799fb190846ae09c61e59a859f',
|
||||||
u'upload_date': u'20131108',
|
'upload_date': '20131108',
|
||||||
},
|
},
|
||||||
u'params': {
|
'params': {
|
||||||
# rtmp
|
# rtmp
|
||||||
u'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
|
'skip': 'videos get deleted after a while',
|
||||||
}
|
}
|
||||||
|
46
youtube_dl/extractor/discovery.py
Normal file
46
youtube_dl/extractor/discovery.py
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
import json
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
|
class DiscoveryIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'http://dsc\.discovery\.com\/[a-zA-Z0-9\-]*/[a-zA-Z0-9\-]*/videos/(?P<id>[a-zA-Z0-9\-]*)(.htm)?'
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://dsc.discovery.com/tv-shows/mythbusters/videos/mission-impossible-outtakes.htm',
|
||||||
|
'file': '614784.mp4',
|
||||||
|
'md5': 'e12614f9ee303a6ccef415cb0793eba2',
|
||||||
|
'info_dict': {
|
||||||
|
'title': 'MythBusters: Mission Impossible Outtakes',
|
||||||
|
'description': ('Watch Jamie Hyneman and Adam Savage practice being'
|
||||||
|
' each other -- to the point of confusing Jamie\'s dog -- and '
|
||||||
|
'don\'t miss Adam moon-walking as Jamie ... behind Jamie\'s'
|
||||||
|
' back.'),
|
||||||
|
'duration': 156,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
|
video_list_json = self._search_regex(r'var videoListJSON = ({.*?});',
|
||||||
|
webpage, 'video list', flags=re.DOTALL)
|
||||||
|
video_list = json.loads(video_list_json)
|
||||||
|
info = video_list['clips'][0]
|
||||||
|
formats = []
|
||||||
|
for f in info['mp4']:
|
||||||
|
formats.append(
|
||||||
|
{'url': f['src'], r'ext': r'mp4', 'tbr': int(f['bitrate'][:-1])})
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': info['contentId'],
|
||||||
|
'title': video_list['name'],
|
||||||
|
'formats': formats,
|
||||||
|
'description': info['videoCaption'],
|
||||||
|
'thumbnail': info.get('videoStillURL') or info.get('thumbnailURL'),
|
||||||
|
'duration': info['duration'],
|
||||||
|
}
|
58
youtube_dl/extractor/elpais.py
Normal file
58
youtube_dl/extractor/elpais.py
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import unified_strdate
|
||||||
|
|
||||||
|
|
||||||
|
class ElPaisIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:[^.]+\.)?elpais\.com/.*/(?P<id>[^/#?]+)\.html(?:$|[?#])'
|
||||||
|
IE_DESCR = 'El País'
|
||||||
|
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://blogs.elpais.com/la-voz-de-inaki/2014/02/tiempo-nuevo-recetas-viejas.html',
|
||||||
|
'md5': '98406f301f19562170ec071b83433d55',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'tiempo-nuevo-recetas-viejas',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Tiempo nuevo, recetas viejas',
|
||||||
|
'description': 'De lunes a viernes, a partir de las ocho de la mañana, Iñaki Gabilondo nos cuenta su visión de la actualidad nacional e internacional.',
|
||||||
|
'upload_date': '20140206',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
|
prefix = self._html_search_regex(
|
||||||
|
r'var url_cache = "([^"]+)";', webpage, 'URL prefix')
|
||||||
|
video_suffix = self._search_regex(
|
||||||
|
r"URLMediaFile = url_cache \+ '([^']+)'", webpage, 'video URL')
|
||||||
|
video_url = prefix + video_suffix
|
||||||
|
thumbnail_suffix = self._search_regex(
|
||||||
|
r"URLMediaStill = url_cache \+ '([^']+)'", webpage, 'thumbnail URL',
|
||||||
|
fatal=False)
|
||||||
|
thumbnail = (
|
||||||
|
None if thumbnail_suffix is None
|
||||||
|
else prefix + thumbnail_suffix)
|
||||||
|
title = self._html_search_regex(
|
||||||
|
'<h2 class="entry-header entry-title.*?>(.*?)</h2>',
|
||||||
|
webpage, 'title')
|
||||||
|
date_str = self._search_regex(
|
||||||
|
r'<p class="date-header date-int updated"\s+title="([^"]+)">',
|
||||||
|
webpage, 'upload date', fatal=False)
|
||||||
|
upload_date = (None if date_str is None else unified_strdate(date_str))
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'url': video_url,
|
||||||
|
'title': title,
|
||||||
|
'description': self._og_search_description(webpage),
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
'upload_date': upload_date,
|
||||||
|
}
|
38
youtube_dl/extractor/firstpost.py
Normal file
38
youtube_dl/extractor/firstpost.py
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
|
class FirstpostIE(InfoExtractor):
|
||||||
|
IE_NAME = 'Firstpost.com'
|
||||||
|
_VALID_URL = r'http://(?:www\.)?firstpost\.com/[^/]+/.*-(?P<id>[0-9]+)\.html'
|
||||||
|
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://www.firstpost.com/india/india-to-launch-indigenous-aircraft-carrier-monday-1025403.html',
|
||||||
|
'md5': 'ee9114957692f01fb1263ed87039112a',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '1025403',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'India to launch indigenous aircraft carrier INS Vikrant today',
|
||||||
|
'description': 'Its flight deck is over twice the size of a football field, its power unit can light up the entire Kochi city and the cabling is enough to cover the distance between here to Delhi.',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
video_url = self._html_search_regex(
|
||||||
|
r'<div.*?name="div_video".*?flashvars="([^"]+)">',
|
||||||
|
webpage, 'video URL')
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'url': video_url,
|
||||||
|
'title': self._og_search_title(webpage),
|
||||||
|
'description': self._og_search_description(webpage),
|
||||||
|
'thumbnail': self._og_search_thumbnail(webpage),
|
||||||
|
}
|
@ -1,4 +1,7 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import json
|
import json
|
||||||
|
|
||||||
@ -30,7 +33,7 @@ class FranceTVBaseInfoExtractor(InfoExtractor):
|
|||||||
|
|
||||||
|
|
||||||
class PluzzIE(FranceTVBaseInfoExtractor):
|
class PluzzIE(FranceTVBaseInfoExtractor):
|
||||||
IE_NAME = u'pluzz.francetv.fr'
|
IE_NAME = 'pluzz.francetv.fr'
|
||||||
_VALID_URL = r'https?://pluzz\.francetv\.fr/videos/(.*?)\.html'
|
_VALID_URL = r'https?://pluzz\.francetv\.fr/videos/(.*?)\.html'
|
||||||
|
|
||||||
# Can't use tests, videos expire in 7 days
|
# Can't use tests, videos expire in 7 days
|
||||||
@ -44,17 +47,17 @@ class PluzzIE(FranceTVBaseInfoExtractor):
|
|||||||
|
|
||||||
|
|
||||||
class FranceTvInfoIE(FranceTVBaseInfoExtractor):
|
class FranceTvInfoIE(FranceTVBaseInfoExtractor):
|
||||||
IE_NAME = u'francetvinfo.fr'
|
IE_NAME = 'francetvinfo.fr'
|
||||||
_VALID_URL = r'https?://www\.francetvinfo\.fr/replay.*/(?P<title>.+)\.html'
|
_VALID_URL = r'https?://www\.francetvinfo\.fr/replay.*/(?P<title>.+)\.html'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.francetvinfo.fr/replay-jt/france-3/soir-3/jt-grand-soir-3-lundi-26-aout-2013_393427.html',
|
'url': 'http://www.francetvinfo.fr/replay-jt/france-3/soir-3/jt-grand-soir-3-lundi-26-aout-2013_393427.html',
|
||||||
u'file': u'84981923.mp4',
|
'file': '84981923.mp4',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'Soir 3',
|
'title': 'Soir 3',
|
||||||
},
|
},
|
||||||
u'params': {
|
'params': {
|
||||||
u'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,13 +65,13 @@ class FranceTvInfoIE(FranceTVBaseInfoExtractor):
|
|||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
page_title = mobj.group('title')
|
page_title = mobj.group('title')
|
||||||
webpage = self._download_webpage(url, page_title)
|
webpage = self._download_webpage(url, page_title)
|
||||||
video_id = self._search_regex(r'id-video=(\d+?)"', webpage, u'video id')
|
video_id = self._search_regex(r'id-video=(\d+?)[@"]', webpage, 'video id')
|
||||||
return self._extract_video(video_id)
|
return self._extract_video(video_id)
|
||||||
|
|
||||||
|
|
||||||
class FranceTVIE(FranceTVBaseInfoExtractor):
|
class FranceTVIE(FranceTVBaseInfoExtractor):
|
||||||
IE_NAME = u'francetv'
|
IE_NAME = 'francetv'
|
||||||
IE_DESC = u'France 2, 3, 4, 5 and Ô'
|
IE_DESC = 'France 2, 3, 4, 5 and Ô'
|
||||||
_VALID_URL = r'''(?x)https?://www\.france[2345o]\.fr/
|
_VALID_URL = r'''(?x)https?://www\.france[2345o]\.fr/
|
||||||
(?:
|
(?:
|
||||||
emissions/.*?/(videos|emissions)/(?P<id>[^/?]+)
|
emissions/.*?/(videos|emissions)/(?P<id>[^/?]+)
|
||||||
@ -78,73 +81,73 @@ class FranceTVIE(FranceTVBaseInfoExtractor):
|
|||||||
_TESTS = [
|
_TESTS = [
|
||||||
# france2
|
# france2
|
||||||
{
|
{
|
||||||
u'url': u'http://www.france2.fr/emissions/13h15-le-samedi-le-dimanche/videos/75540104',
|
'url': 'http://www.france2.fr/emissions/13h15-le-samedi-le-dimanche/videos/75540104',
|
||||||
u'file': u'75540104.mp4',
|
'file': '75540104.mp4',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'13h15, le samedi...',
|
'title': '13h15, le samedi...',
|
||||||
u'description': u'md5:2e5b58ba7a2d3692b35c792be081a03d',
|
'description': 'md5:2e5b58ba7a2d3692b35c792be081a03d',
|
||||||
},
|
},
|
||||||
u'params': {
|
'params': {
|
||||||
# m3u8 download
|
# m3u8 download
|
||||||
u'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
# france3
|
# france3
|
||||||
{
|
{
|
||||||
u'url': u'http://www.france3.fr/emissions/pieces-a-conviction/diffusions/13-11-2013_145575',
|
'url': 'http://www.france3.fr/emissions/pieces-a-conviction/diffusions/13-11-2013_145575',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'id': u'000702326_CAPP_PicesconvictionExtrait313022013_120220131722_Au',
|
'id': '000702326_CAPP_PicesconvictionExtrait313022013_120220131722_Au',
|
||||||
u'ext': u'flv',
|
'ext': 'flv',
|
||||||
u'title': u'Le scandale du prix des médicaments',
|
'title': 'Le scandale du prix des médicaments',
|
||||||
u'description': u'md5:1384089fbee2f04fc6c9de025ee2e9ce',
|
'description': 'md5:1384089fbee2f04fc6c9de025ee2e9ce',
|
||||||
},
|
},
|
||||||
u'params': {
|
'params': {
|
||||||
# rtmp download
|
# rtmp download
|
||||||
u'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
# france4
|
# france4
|
||||||
{
|
{
|
||||||
u'url': u'http://www.france4.fr/emissions/hero-corp/videos/rhozet_herocorp_bonus_1_20131106_1923_06112013172108_F4',
|
'url': 'http://www.france4.fr/emissions/hero-corp/videos/rhozet_herocorp_bonus_1_20131106_1923_06112013172108_F4',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'id': u'rhozet_herocorp_bonus_1_20131106_1923_06112013172108_F4',
|
'id': 'rhozet_herocorp_bonus_1_20131106_1923_06112013172108_F4',
|
||||||
u'ext': u'flv',
|
'ext': 'flv',
|
||||||
u'title': u'Hero Corp Making of - Extrait 1',
|
'title': 'Hero Corp Making of - Extrait 1',
|
||||||
u'description': u'md5:c87d54871b1790679aec1197e73d650a',
|
'description': 'md5:c87d54871b1790679aec1197e73d650a',
|
||||||
},
|
},
|
||||||
u'params': {
|
'params': {
|
||||||
# rtmp download
|
# rtmp download
|
||||||
u'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
# france5
|
# france5
|
||||||
{
|
{
|
||||||
u'url': u'http://www.france5.fr/emissions/c-a-dire/videos/92837968',
|
'url': 'http://www.france5.fr/emissions/c-a-dire/videos/92837968',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'id': u'92837968',
|
'id': '92837968',
|
||||||
u'ext': u'mp4',
|
'ext': 'mp4',
|
||||||
u'title': u'C à dire ?!',
|
'title': 'C à dire ?!',
|
||||||
u'description': u'md5:fb1db1cbad784dcce7c7a7bd177c8e2f',
|
'description': 'md5:fb1db1cbad784dcce7c7a7bd177c8e2f',
|
||||||
},
|
},
|
||||||
u'params': {
|
'params': {
|
||||||
# m3u8 download
|
# m3u8 download
|
||||||
u'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
# franceo
|
# franceo
|
||||||
{
|
{
|
||||||
u'url': u'http://www.franceo.fr/jt/info-afrique/04-12-2013',
|
'url': 'http://www.franceo.fr/jt/info-afrique/04-12-2013',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'id': u'92327925',
|
'id': '92327925',
|
||||||
u'ext': u'mp4',
|
'ext': 'mp4',
|
||||||
u'title': u'Infô-Afrique',
|
'title': 'Infô-Afrique',
|
||||||
u'description': u'md5:ebf346da789428841bee0fd2a935ea55',
|
'description': 'md5:ebf346da789428841bee0fd2a935ea55',
|
||||||
},
|
},
|
||||||
u'params': {
|
'params': {
|
||||||
# m3u8 download
|
# m3u8 download
|
||||||
u'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
u'skip': u'The id changes frequently',
|
'skip': 'The id changes frequently',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -160,26 +163,26 @@ class FranceTVIE(FranceTVBaseInfoExtractor):
|
|||||||
'\.fr/\?id-video=([^"/&]+)'),
|
'\.fr/\?id-video=([^"/&]+)'),
|
||||||
(r'<a class="video" id="ftv_player_(.+?)"'),
|
(r'<a class="video" id="ftv_player_(.+?)"'),
|
||||||
]
|
]
|
||||||
video_id = self._html_search_regex(id_res, webpage, u'video ID')
|
video_id = self._html_search_regex(id_res, webpage, 'video ID')
|
||||||
else:
|
else:
|
||||||
video_id = mobj.group('id')
|
video_id = mobj.group('id')
|
||||||
return self._extract_video(video_id)
|
return self._extract_video(video_id)
|
||||||
|
|
||||||
|
|
||||||
class GenerationQuoiIE(InfoExtractor):
|
class GenerationQuoiIE(InfoExtractor):
|
||||||
IE_NAME = u'france2.fr:generation-quoi'
|
IE_NAME = 'france2.fr:generation-quoi'
|
||||||
_VALID_URL = r'https?://generation-quoi\.france2\.fr/portrait/(?P<name>.*)(\?|$)'
|
_VALID_URL = r'https?://generation-quoi\.france2\.fr/portrait/(?P<name>.*)(\?|$)'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://generation-quoi.france2.fr/portrait/garde-a-vous',
|
'url': 'http://generation-quoi.france2.fr/portrait/garde-a-vous',
|
||||||
u'file': u'k7FJX8VBcvvLmX4wA5Q.mp4',
|
'file': 'k7FJX8VBcvvLmX4wA5Q.mp4',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'Génération Quoi - Garde à Vous',
|
'title': 'Génération Quoi - Garde à Vous',
|
||||||
u'uploader': u'Génération Quoi',
|
'uploader': 'Génération Quoi',
|
||||||
},
|
},
|
||||||
u'params': {
|
'params': {
|
||||||
# It uses Dailymotion
|
# It uses Dailymotion
|
||||||
u'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,20 +197,20 @@ class GenerationQuoiIE(InfoExtractor):
|
|||||||
|
|
||||||
|
|
||||||
class CultureboxIE(FranceTVBaseInfoExtractor):
|
class CultureboxIE(FranceTVBaseInfoExtractor):
|
||||||
IE_NAME = u'culturebox.francetvinfo.fr'
|
IE_NAME = 'culturebox.francetvinfo.fr'
|
||||||
_VALID_URL = r'https?://culturebox\.francetvinfo\.fr/(?P<name>.*?)(\?|$)'
|
_VALID_URL = r'https?://culturebox\.francetvinfo\.fr/(?P<name>.*?)(\?|$)'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://culturebox.francetvinfo.fr/einstein-on-the-beach-au-theatre-du-chatelet-146813',
|
'url': 'http://culturebox.francetvinfo.fr/einstein-on-the-beach-au-theatre-du-chatelet-146813',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'id': u'EV_6785',
|
'id': 'EV_6785',
|
||||||
u'ext': u'mp4',
|
'ext': 'mp4',
|
||||||
u'title': u'Einstein on the beach au Théâtre du Châtelet',
|
'title': 'Einstein on the beach au Théâtre du Châtelet',
|
||||||
u'description': u'md5:9ce2888b1efefc617b5e58b3f6200eeb',
|
'description': 'md5:9ce2888b1efefc617b5e58b3f6200eeb',
|
||||||
},
|
},
|
||||||
u'params': {
|
'params': {
|
||||||
# m3u8 download
|
# m3u8 download
|
||||||
u'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,5 +218,5 @@ class CultureboxIE(FranceTVBaseInfoExtractor):
|
|||||||
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)
|
||||||
video_id = self._search_regex(r'"http://videos\.francetv\.fr/video/(.*?)"', webpage, u'video id')
|
video_id = self._search_regex(r'"http://videos\.francetv\.fr/video/(.*?)"', webpage, 'video id')
|
||||||
return self._extract_video(video_id)
|
return self._extract_video(video_id)
|
||||||
|
37
youtube_dl/extractor/freespeech.py
Normal file
37
youtube_dl/extractor/freespeech.py
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
import json
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
|
class FreespeechIE(InfoExtractor):
|
||||||
|
IE_NAME = 'freespeech.org'
|
||||||
|
_VALID_URL = r'https://www\.freespeech\.org/video/(?P<title>.+)'
|
||||||
|
_TEST = {
|
||||||
|
'add_ie': ['Youtube'],
|
||||||
|
'url': 'https://www.freespeech.org/video/obama-romney-campaign-colorado-ahead-debate-0',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'poKsVCZ64uU',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Obama, Romney Campaign in Colorado Ahead of Debate',
|
||||||
|
'description': 'Obama, Romney Campaign in Colorado Ahead of Debate',
|
||||||
|
'uploader': 'freespeechtv',
|
||||||
|
'uploader_id': 'freespeechtv',
|
||||||
|
'upload_date': '20121002',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
title = mobj.group('title')
|
||||||
|
webpage = self._download_webpage(url, title)
|
||||||
|
info_json = self._search_regex(r'jQuery.extend\(Drupal.settings, ({.*?})\);', webpage, 'info')
|
||||||
|
info = json.loads(info_json)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'_type': 'url',
|
||||||
|
'url': info['jw_player']['basic_video_node_player']['file'],
|
||||||
|
'ie_key': 'Youtube',
|
||||||
|
}
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
@ -6,13 +8,16 @@ from .common import InfoExtractor
|
|||||||
class FunnyOrDieIE(InfoExtractor):
|
class FunnyOrDieIE(InfoExtractor):
|
||||||
_VALID_URL = r'^(?:https?://)?(?:www\.)?funnyordie\.com/videos/(?P<id>[0-9a-f]+)/.*$'
|
_VALID_URL = r'^(?:https?://)?(?:www\.)?funnyordie\.com/videos/(?P<id>[0-9a-f]+)/.*$'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.funnyordie.com/videos/0732f586d7/heart-shaped-box-literal-video-version',
|
'url': 'http://www.funnyordie.com/videos/0732f586d7/heart-shaped-box-literal-video-version',
|
||||||
u'file': u'0732f586d7.mp4',
|
'file': '0732f586d7.mp4',
|
||||||
u'md5': u'f647e9e90064b53b6e046e75d0241fbd',
|
'md5': 'f647e9e90064b53b6e046e75d0241fbd',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"description": u"Lyrics changed to match the video. Spoken cameo by Obscurus Lupa (from ThatGuyWithTheGlasses.com). Based on a concept by Dustin McLean (DustFilms.com). Performed, edited, and written by David A. Scott.",
|
'description': ('Lyrics changed to match the video. Spoken cameo '
|
||||||
u"title": u"Heart-Shaped Box: Literal Video Version"
|
'by Obscurus Lupa (from ThatGuyWithTheGlasses.com). Based on a '
|
||||||
}
|
'concept by Dustin McLean (DustFilms.com). Performed, edited, '
|
||||||
|
'and written by David A. Scott.'),
|
||||||
|
'title': 'Heart-Shaped Box: Literal Video Version',
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@ -23,13 +28,12 @@ class FunnyOrDieIE(InfoExtractor):
|
|||||||
|
|
||||||
video_url = self._search_regex(
|
video_url = self._search_regex(
|
||||||
[r'type="video/mp4" src="(.*?)"', r'src="([^>]*?)" type=\'video/mp4\''],
|
[r'type="video/mp4" src="(.*?)"', r'src="([^>]*?)" type=\'video/mp4\''],
|
||||||
webpage, u'video URL', flags=re.DOTALL)
|
webpage, 'video URL', flags=re.DOTALL)
|
||||||
|
|
||||||
info = {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': self._og_search_title(webpage),
|
'title': self._og_search_title(webpage),
|
||||||
'description': self._og_search_description(webpage),
|
'description': self._og_search_description(webpage),
|
||||||
}
|
}
|
||||||
return [info]
|
|
||||||
|
@ -28,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
|
||||||
@ -36,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,7 +1,5 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
|
||||||
|
|
||||||
from .mtv import MTVServicesInfoExtractor
|
from .mtv import MTVServicesInfoExtractor
|
||||||
|
|
||||||
|
|
||||||
@ -18,12 +16,3 @@ class GametrailersIE(MTVServicesInfoExtractor):
|
|||||||
}
|
}
|
||||||
|
|
||||||
_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, 'mgid')
|
|
||||||
return self._get_videos_info(mgid)
|
|
||||||
|
@ -38,18 +38,6 @@ class GenericIE(InfoExtractor):
|
|||||||
'title': 'R\u00e9gis plante sa Jeep',
|
'title': 'R\u00e9gis plante sa Jeep',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
# embedded vimeo video
|
|
||||||
{
|
|
||||||
'add_ie': ['Vimeo'],
|
|
||||||
'url': 'http://skillsmatter.com/podcast/home/move-semanticsperfect-forwarding-and-rvalue-references',
|
|
||||||
'file': '22444065.mp4',
|
|
||||||
'md5': '2903896e23df39722c33f015af0666e2',
|
|
||||||
'info_dict': {
|
|
||||||
'title': 'ACCU 2011: Move Semantics,Perfect Forwarding, and Rvalue references- Scott Meyers- 13/04/2011',
|
|
||||||
'uploader_id': 'skillsmatter',
|
|
||||||
'uploader': 'Skills Matter',
|
|
||||||
}
|
|
||||||
},
|
|
||||||
# bandcamp page with custom domain
|
# bandcamp page with custom domain
|
||||||
{
|
{
|
||||||
'add_ie': ['Bandcamp'],
|
'add_ie': ['Bandcamp'],
|
||||||
@ -78,6 +66,18 @@ class GenericIE(InfoExtractor):
|
|||||||
'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
# https://github.com/rg3/youtube-dl/issues/2253
|
||||||
|
'url': 'http://bcove.me/i6nfkrc3',
|
||||||
|
'file': '3101154703001.mp4',
|
||||||
|
'md5': '0ba9446db037002366bab3b3eb30c88c',
|
||||||
|
'info_dict': {
|
||||||
|
'title': 'Still no power',
|
||||||
|
'uploader': 'thestar.com',
|
||||||
|
'description': 'Mississauga resident David Farmer is still out of power as a result of the ice storm a month ago. To keep the house warm, Farmer cuts wood from his property for a wood burning stove downstairs.',
|
||||||
|
},
|
||||||
|
'add_ie': ['Brightcove'],
|
||||||
|
},
|
||||||
# Direct link to a video
|
# Direct link to a video
|
||||||
{
|
{
|
||||||
'url': 'http://media.w3.org/2010/05/sintel/trailer.mp4',
|
'url': 'http://media.w3.org/2010/05/sintel/trailer.mp4',
|
||||||
@ -162,8 +162,19 @@ class GenericIE(InfoExtractor):
|
|||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
parsed_url = compat_urlparse.urlparse(url)
|
parsed_url = compat_urlparse.urlparse(url)
|
||||||
if not parsed_url.scheme:
|
if not parsed_url.scheme:
|
||||||
self._downloader.report_warning('The url doesn\'t specify the protocol, trying with http')
|
default_search = self._downloader.params.get('default_search')
|
||||||
return self.url_result('http://' + url)
|
if default_search is None:
|
||||||
|
default_search = 'auto'
|
||||||
|
|
||||||
|
if default_search == 'auto':
|
||||||
|
if '/' in url:
|
||||||
|
self._downloader.report_warning('The url doesn\'t specify the protocol, trying with http')
|
||||||
|
return self.url_result('http://' + url)
|
||||||
|
else:
|
||||||
|
return self.url_result('ytsearch:' + url)
|
||||||
|
else:
|
||||||
|
assert ':' in default_search
|
||||||
|
return self.url_result(default_search + url)
|
||||||
video_id = os.path.splitext(url.split('/')[-1])[0]
|
video_id = os.path.splitext(url.split('/')[-1])[0]
|
||||||
|
|
||||||
self.to_screen('%s: Requesting header' % video_id)
|
self.to_screen('%s: Requesting header' % video_id)
|
||||||
@ -223,15 +234,25 @@ class GenericIE(InfoExtractor):
|
|||||||
r'^(?:https?://)?([^/]*)/.*', url, 'video uploader')
|
r'^(?:https?://)?([^/]*)/.*', url, 'video uploader')
|
||||||
|
|
||||||
# Look for BrightCove:
|
# Look for BrightCove:
|
||||||
bc_url = BrightcoveIE._extract_brightcove_url(webpage)
|
bc_urls = BrightcoveIE._extract_brightcove_urls(webpage)
|
||||||
if bc_url is not None:
|
if bc_urls:
|
||||||
self.to_screen('Brightcove video detected.')
|
self.to_screen('Brightcove video detected.')
|
||||||
surl = smuggle_url(bc_url, {'Referer': url})
|
entries = [{
|
||||||
return self.url_result(surl, 'Brightcove')
|
'_type': 'url',
|
||||||
|
'url': smuggle_url(bc_url, {'Referer': url}),
|
||||||
|
'ie_key': 'Brightcove'
|
||||||
|
} for bc_url in bc_urls]
|
||||||
|
|
||||||
|
return {
|
||||||
|
'_type': 'playlist',
|
||||||
|
'title': video_title,
|
||||||
|
'id': video_id,
|
||||||
|
'entries': entries,
|
||||||
|
}
|
||||||
|
|
||||||
# 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})
|
||||||
@ -239,7 +260,7 @@ class GenericIE(InfoExtractor):
|
|||||||
|
|
||||||
# Look for embedded (swf embed) Vimeo player
|
# Look for embedded (swf embed) Vimeo player
|
||||||
mobj = re.search(
|
mobj = re.search(
|
||||||
r'<embed[^>]+?src="(https?://(?:www\.)?vimeo.com/moogaloop.swf.+?)"', webpage)
|
r'<embed[^>]+?src="(https?://(?:www\.)?vimeo\.com/moogaloop\.swf.+?)"', webpage)
|
||||||
if mobj:
|
if mobj:
|
||||||
return self.url_result(mobj.group(1), 'Vimeo')
|
return self.url_result(mobj.group(1), 'Vimeo')
|
||||||
|
|
||||||
@ -309,7 +330,7 @@ class GenericIE(InfoExtractor):
|
|||||||
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|de)/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')
|
||||||
|
|
||||||
@ -321,15 +342,21 @@ class GenericIE(InfoExtractor):
|
|||||||
|
|
||||||
# Look for embedded Facebook player
|
# Look for embedded Facebook player
|
||||||
mobj = re.search(
|
mobj = re.search(
|
||||||
r'<iframe[^>]+?src=(["\'])(?P<url>https://www.facebook.com/video/embed.+?)\1', webpage)
|
r'<iframe[^>]+?src=(["\'])(?P<url>https://www\.facebook\.com/video/embed.+?)\1', webpage)
|
||||||
if mobj is not None:
|
if mobj is not None:
|
||||||
return self.url_result(mobj.group('url'), 'Facebook')
|
return self.url_result(mobj.group('url'), 'Facebook')
|
||||||
|
|
||||||
|
# Look for embedded Huffington Post player
|
||||||
|
mobj = re.search(
|
||||||
|
r'<iframe[^>]+?src=(["\'])(?P<url>https?://embed\.live\.huffingtonpost\.com/.+?)\1', webpage)
|
||||||
|
if mobj is not None:
|
||||||
|
return self.url_result(mobj.group('url'), 'HuffPost')
|
||||||
|
|
||||||
# Start with something easy: JW Player in SWFObject
|
# Start with something easy: JW Player in SWFObject
|
||||||
mobj = re.search(r'flashvars: [\'"](?:.*&)?file=(http[^\'"&]*)', webpage)
|
mobj = re.search(r'flashvars: [\'"](?:.*&)?file=(http[^\'"&]*)', webpage)
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
# Look for gorilla-vid style embedding
|
# Look for gorilla-vid style embedding
|
||||||
mobj = re.search(r'(?s)jw_plugins.*?file:\s*["\'](.*?)["\']', webpage)
|
mobj = re.search(r'(?s)(?:jw_plugins|JWPlayerOptions).*?file\s*:\s*["\'](.*?)["\']', webpage)
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
# Broaden the search a little bit
|
# Broaden the search a little bit
|
||||||
mobj = re.search(r'[^A-Za-z0-9]?(?:file|source)=(http[^\'"&]*)', webpage)
|
mobj = re.search(r'[^A-Za-z0-9]?(?:file|source)=(http[^\'"&]*)', webpage)
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import itertools
|
import itertools
|
||||||
import re
|
import re
|
||||||
|
|
||||||
@ -8,32 +10,42 @@ from ..utils import (
|
|||||||
|
|
||||||
|
|
||||||
class GoogleSearchIE(SearchInfoExtractor):
|
class GoogleSearchIE(SearchInfoExtractor):
|
||||||
IE_DESC = u'Google Video search'
|
IE_DESC = 'Google Video search'
|
||||||
_MORE_PAGES_INDICATOR = r'id="pnnext" class="pn"'
|
|
||||||
_MAX_RESULTS = 1000
|
_MAX_RESULTS = 1000
|
||||||
IE_NAME = u'video.google:search'
|
IE_NAME = 'video.google:search'
|
||||||
_SEARCH_KEY = 'gvsearch'
|
_SEARCH_KEY = 'gvsearch'
|
||||||
|
|
||||||
def _get_n_results(self, query, n):
|
def _get_n_results(self, query, n):
|
||||||
"""Get a specified number of results for a query"""
|
"""Get a specified number of results for a query"""
|
||||||
|
|
||||||
|
entries = []
|
||||||
res = {
|
res = {
|
||||||
'_type': 'playlist',
|
'_type': 'playlist',
|
||||||
'id': query,
|
'id': query,
|
||||||
'entries': []
|
'title': query,
|
||||||
}
|
}
|
||||||
|
|
||||||
for pagenum in itertools.count(1):
|
for pagenum in itertools.count():
|
||||||
result_url = u'http://www.google.com/search?tbm=vid&q=%s&start=%s&hl=en' % (compat_urllib_parse.quote_plus(query), pagenum*10)
|
result_url = (
|
||||||
webpage = self._download_webpage(result_url, u'gvsearch:' + query,
|
'http://www.google.com/search?tbm=vid&q=%s&start=%s&hl=en'
|
||||||
note='Downloading result page ' + str(pagenum))
|
% (compat_urllib_parse.quote_plus(query), pagenum * 10))
|
||||||
|
|
||||||
for mobj in re.finditer(r'<h3 class="r"><a href="([^"]+)"', webpage):
|
webpage = self._download_webpage(
|
||||||
e = {
|
result_url, 'gvsearch:' + query,
|
||||||
|
note='Downloading result page ' + str(pagenum + 1))
|
||||||
|
|
||||||
|
for hit_idx, mobj in enumerate(re.finditer(
|
||||||
|
r'<h3 class="r"><a href="([^"]+)"', webpage)):
|
||||||
|
|
||||||
|
# Skip playlists
|
||||||
|
if not re.search(r'id="vidthumb%d"' % (hit_idx + 1), webpage):
|
||||||
|
continue
|
||||||
|
|
||||||
|
entries.append({
|
||||||
'_type': 'url',
|
'_type': 'url',
|
||||||
'url': mobj.group(1)
|
'url': mobj.group(1)
|
||||||
}
|
})
|
||||||
res['entries'].append(e)
|
|
||||||
|
|
||||||
if (pagenum * 10 > n) or not re.search(self._MORE_PAGES_INDICATOR, webpage):
|
if (len(entries) >= n) or not re.search(r'class="pn" id="pnnext"', webpage):
|
||||||
|
res['entries'] = entries[:n]
|
||||||
return res
|
return res
|
||||||
|
@ -13,7 +13,7 @@ from ..utils import (
|
|||||||
|
|
||||||
|
|
||||||
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 = {
|
||||||
'url': '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',
|
||||||
'file': '1435540.mp3',
|
'file': '1435540.mp3',
|
||||||
|
82
youtube_dl/extractor/huffpost.py
Normal file
82
youtube_dl/extractor/huffpost.py
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
parse_duration,
|
||||||
|
unified_strdate,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class HuffPostIE(InfoExtractor):
|
||||||
|
IE_DESC = 'Huffington Post'
|
||||||
|
_VALID_URL = r'''(?x)
|
||||||
|
https?://(embed\.)?live\.huffingtonpost\.com/
|
||||||
|
(?:
|
||||||
|
r/segment/[^/]+/|
|
||||||
|
HPLEmbedPlayer/\?segmentId=
|
||||||
|
)
|
||||||
|
(?P<id>[0-9a-f]+)'''
|
||||||
|
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://live.huffingtonpost.com/r/segment/legalese-it/52dd3e4b02a7602131000677',
|
||||||
|
'file': '52dd3e4b02a7602131000677.mp4',
|
||||||
|
'md5': '55f5e8981c1c80a64706a44b74833de8',
|
||||||
|
'info_dict': {
|
||||||
|
'title': 'Legalese It! with @MikeSacksHP',
|
||||||
|
'description': 'This week on Legalese It, Mike talks to David Bosco about his new book on the ICC, "Rough Justice," he also discusses the Virginia AG\'s historic stance on gay marriage, the execution of Edgar Tamayo, the ICC\'s delay of Kenya\'s President and more. ',
|
||||||
|
'duration': 1549,
|
||||||
|
'upload_date': '20140124',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
api_url = 'http://embed.live.huffingtonpost.com/api/segments/%s.json' % video_id
|
||||||
|
data = self._download_json(api_url, video_id)['data']
|
||||||
|
|
||||||
|
video_title = data['title']
|
||||||
|
duration = parse_duration(data['running_time'])
|
||||||
|
upload_date = unified_strdate(data['schedule']['starts_at'])
|
||||||
|
description = data.get('description')
|
||||||
|
|
||||||
|
thumbnails = []
|
||||||
|
for url in data['images'].values():
|
||||||
|
m = re.match('.*-([0-9]+x[0-9]+)\.', url)
|
||||||
|
if not m:
|
||||||
|
continue
|
||||||
|
thumbnails.append({
|
||||||
|
'url': url,
|
||||||
|
'resolution': m.group(1),
|
||||||
|
})
|
||||||
|
|
||||||
|
formats = [{
|
||||||
|
'format': key,
|
||||||
|
'format_id': key.replace('/', '.'),
|
||||||
|
'ext': 'mp4',
|
||||||
|
'url': url,
|
||||||
|
'vcodec': 'none' if key.startswith('audio/') else None,
|
||||||
|
} for key, url in data['sources']['live'].items()]
|
||||||
|
if data.get('fivemin_id'):
|
||||||
|
fid = data['fivemin_id']
|
||||||
|
fcat = str(int(fid) // 100 + 1)
|
||||||
|
furl = 'http://avideos.5min.com/2/' + fcat[-3:] + '/' + fcat + '/' + fid + '.mp4'
|
||||||
|
formats.append({
|
||||||
|
'format': 'fivemin',
|
||||||
|
'url': furl,
|
||||||
|
'preference': 1,
|
||||||
|
})
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': video_title,
|
||||||
|
'description': description,
|
||||||
|
'formats': formats,
|
||||||
|
'duration': duration,
|
||||||
|
'upload_date': upload_date,
|
||||||
|
'thumbnails': thumbnails,
|
||||||
|
}
|
@ -67,23 +67,13 @@ class ImdbListIE(InfoExtractor):
|
|||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
list_id = mobj.group('id')
|
list_id = mobj.group('id')
|
||||||
|
|
||||||
# RSS XML is sometimes malformed
|
webpage = self._download_webpage(url, list_id)
|
||||||
rss = self._download_webpage('http://rss.imdb.com/list/%s' % list_id, list_id, 'Downloading list RSS')
|
entries = [
|
||||||
list_title = self._html_search_regex(r'<title>(.*?)</title>', rss, 'list title')
|
self.url_result('http://www.imdb.com' + m, 'Imdb')
|
||||||
|
for m in re.findall(r'href="(/video/imdb/vi[^"]+)"\s+data-type="playlist"', webpage)]
|
||||||
# Export is independent of actual author_id, but returns 404 if no author_id is provided.
|
|
||||||
# However, passing dummy author_id seems to be enough.
|
list_title = self._html_search_regex(
|
||||||
csv = self._download_webpage('http://www.imdb.com/list/export?list_id=%s&author_id=ur00000000' % list_id,
|
r'<h1 class="header">(.*?)</h1>', webpage, 'list title')
|
||||||
list_id, '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)
|
||||||
|
@ -1,39 +1,36 @@
|
|||||||
|
# encoding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
class InaIE(InfoExtractor):
|
class InaIE(InfoExtractor):
|
||||||
"""Information Extractor for Ina.fr"""
|
_VALID_URL = r'http://(?:www\.)?ina\.fr/video/(?P<id>I?[A-Z0-9]+)'
|
||||||
_VALID_URL = r'(?:http://)?(?:www\.)?ina\.fr/video/(?P<id>I?[A-F0-9]+)/.*'
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.ina.fr/video/I12055569/francois-hollande-je-crois-que-c-est-clair-video.html',
|
'url': 'http://www.ina.fr/video/I12055569/francois-hollande-je-crois-que-c-est-clair-video.html',
|
||||||
u'file': u'I12055569.mp4',
|
'md5': 'a667021bf2b41f8dc6049479d9bb38a3',
|
||||||
u'md5': u'a667021bf2b41f8dc6049479d9bb38a3',
|
'info_dict': {
|
||||||
u'info_dict': {
|
'id': 'I12055569',
|
||||||
u"title": u"Fran\u00e7ois Hollande \"Je crois que c'est clair\""
|
'ext': 'mp4',
|
||||||
|
'title': 'François Hollande "Je crois que c\'est clair"',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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')
|
||||||
mrss_url='http://player.ina.fr/notices/%s.mrss' % video_id
|
mrss_url = 'http://player.ina.fr/notices/%s.mrss' % video_id
|
||||||
video_extension = 'mp4'
|
info_doc = self._download_xml(mrss_url, video_id)
|
||||||
webpage = self._download_webpage(mrss_url, video_id)
|
|
||||||
|
|
||||||
self.report_extraction(video_id)
|
self.report_extraction(video_id)
|
||||||
|
|
||||||
video_url = self._html_search_regex(r'<media:player url="(?P<mp4url>http://mp4.ina.fr/[^"]+\.mp4)',
|
video_url = info_doc.find('.//{http://search.yahoo.com/mrss/}player').attrib['url']
|
||||||
webpage, u'video URL')
|
|
||||||
|
|
||||||
video_title = self._search_regex(r'<title><!\[CDATA\[(?P<titre>.*?)]]></title>',
|
return {
|
||||||
webpage, u'title')
|
'id': video_id,
|
||||||
|
'url': video_url,
|
||||||
return [{
|
'title': info_doc.find('.//title').text,
|
||||||
'id': video_id,
|
}
|
||||||
'url': video_url,
|
|
||||||
'ext': video_extension,
|
|
||||||
'title': video_title,
|
|
||||||
}]
|
|
||||||
|
@ -1,62 +1,55 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
compat_urllib_parse,
|
compat_urllib_parse,
|
||||||
|
|
||||||
ExtractorError,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class InfoQIE(InfoExtractor):
|
class InfoQIE(InfoExtractor):
|
||||||
_VALID_URL = r'^(?:https?://)?(?:www\.)?infoq\.com/[^/]+/[^/]+$'
|
_VALID_URL = r'https?://(?:www\.)?infoq\.com/[^/]+/(?P<id>[^/]+)$'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u"name": u"InfoQ",
|
"name": "InfoQ",
|
||||||
u"url": u"http://www.infoq.com/presentations/A-Few-of-My-Favorite-Python-Things",
|
"url": "http://www.infoq.com/presentations/A-Few-of-My-Favorite-Python-Things",
|
||||||
u"file": u"12-jan-pythonthings.mp4",
|
"file": "12-jan-pythonthings.mp4",
|
||||||
u"info_dict": {
|
"info_dict": {
|
||||||
u"description": u"Mike Pirnat presents some tips and tricks, standard libraries and third party packages that make programming in Python a richer experience.",
|
"description": "Mike Pirnat presents some tips and tricks, standard libraries and third party packages that make programming in Python a richer experience.",
|
||||||
u"title": u"A Few of My Favorite [Python] Things"
|
"title": "A Few of My Favorite [Python] Things",
|
||||||
|
},
|
||||||
|
"params": {
|
||||||
|
"skip_download": True,
|
||||||
},
|
},
|
||||||
u"params": {
|
|
||||||
u"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')
|
||||||
|
|
||||||
webpage = self._download_webpage(url, video_id=url)
|
webpage = self._download_webpage(url, video_id)
|
||||||
self.report_extraction(url)
|
|
||||||
|
|
||||||
# Extract video URL
|
# Extract video URL
|
||||||
mobj = re.search(r"jsclassref ?= ?'([^']*)'", webpage)
|
encoded_id = self._search_regex(r"jsclassref ?= ?'([^']*)'", webpage, 'encoded id')
|
||||||
if mobj is None:
|
real_id = compat_urllib_parse.unquote(base64.b64decode(encoded_id.encode('ascii')).decode('utf-8'))
|
||||||
raise ExtractorError(u'Unable to extract video url')
|
|
||||||
real_id = compat_urllib_parse.unquote(base64.b64decode(mobj.group(1).encode('ascii')).decode('utf-8'))
|
|
||||||
video_url = 'rtmpe://video.infoq.com/cfx/st/' + real_id
|
video_url = 'rtmpe://video.infoq.com/cfx/st/' + real_id
|
||||||
|
|
||||||
# Extract title
|
# Extract title
|
||||||
video_title = self._search_regex(r'contentTitle = "(.*?)";',
|
video_title = self._search_regex(r'contentTitle = "(.*?)";',
|
||||||
webpage, u'title')
|
webpage, 'title')
|
||||||
|
|
||||||
# Extract description
|
# Extract description
|
||||||
video_description = self._html_search_regex(r'<meta name="description" content="(.*)"(?:\s*/)?>',
|
video_description = self._html_search_regex(r'<meta name="description" content="(.*)"(?:\s*/)?>',
|
||||||
webpage, u'description', fatal=False)
|
webpage, 'description', fatal=False)
|
||||||
|
|
||||||
video_filename = video_url.split('/')[-1]
|
video_filename = video_url.split('/')[-1]
|
||||||
video_id, extension = video_filename.split('.')
|
video_id, extension = video_filename.split('.')
|
||||||
|
|
||||||
info = {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
'uploader': None,
|
|
||||||
'upload_date': None,
|
|
||||||
'title': video_title,
|
'title': video_title,
|
||||||
'ext': extension, # Extension is always(?) mp4, but seems to be flv
|
'ext': extension, # Extension is always(?) mp4, but seems to be flv
|
||||||
'thumbnail': None,
|
|
||||||
'description': video_description,
|
'description': video_description,
|
||||||
}
|
}
|
||||||
|
|
||||||
return [info]
|
|
85
youtube_dl/extractor/iprima.py
Normal file
85
youtube_dl/extractor/iprima.py
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
from random import random
|
||||||
|
from math import floor
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import compat_urllib_request
|
||||||
|
|
||||||
|
|
||||||
|
class IPrimaIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://play\.iprima\.cz/(?P<videogroup>.+)/(?P<videoid>.+)'
|
||||||
|
|
||||||
|
_TESTS = [{
|
||||||
|
'url': 'http://play.iprima.cz/particka/particka-92',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '39152',
|
||||||
|
'ext': 'flv',
|
||||||
|
'title': 'Partička (92)',
|
||||||
|
'description': 'md5:3740fda51464da35a2d4d0670b8e4fd6',
|
||||||
|
'thumbnail': 'http://play.iprima.cz/sites/default/files/image_crops/image_620x349/3/491483_particka-92_image_620x349.jpg',
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
'skip_download': True,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('videoid')
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
|
player_url = 'http://embed.livebox.cz/iprimaplay/player-embed-v2.js?__tok%s__=%s' % (
|
||||||
|
floor(random()*1073741824),
|
||||||
|
floor(random()*1073741824))
|
||||||
|
|
||||||
|
req = compat_urllib_request.Request(player_url)
|
||||||
|
req.add_header('Referer', url)
|
||||||
|
playerpage = self._download_webpage(req, video_id)
|
||||||
|
|
||||||
|
base_url = ''.join(re.findall(r"embed\['stream'\] = '(.+?)'.+'(\?auth=)'.+'(.+?)';", playerpage)[1])
|
||||||
|
|
||||||
|
zoneGEO = self._html_search_regex(r'"zoneGEO":(.+?),', webpage, 'zoneGEO')
|
||||||
|
|
||||||
|
if zoneGEO != '0':
|
||||||
|
base_url = base_url.replace('token', 'token_'+zoneGEO)
|
||||||
|
|
||||||
|
formats = []
|
||||||
|
for format_id in ['lq', 'hq', 'hd']:
|
||||||
|
filename = self._html_search_regex(r'"%s_id":(.+?),' % format_id, webpage, 'filename')
|
||||||
|
|
||||||
|
if filename == 'null':
|
||||||
|
continue
|
||||||
|
|
||||||
|
real_id = self._search_regex(r'Prima-[0-9]{10}-([0-9]+)_', filename, 'real video id')
|
||||||
|
|
||||||
|
if format_id == 'lq':
|
||||||
|
quality = 0
|
||||||
|
elif format_id == 'hq':
|
||||||
|
quality = 1
|
||||||
|
elif format_id == 'hd':
|
||||||
|
quality = 2
|
||||||
|
filename = 'hq/'+filename
|
||||||
|
|
||||||
|
formats.append({
|
||||||
|
'format_id': format_id,
|
||||||
|
'url': base_url,
|
||||||
|
'quality': quality,
|
||||||
|
'play_path': 'mp4:'+filename.replace('"', '')[:-4],
|
||||||
|
'rtmp_live': True,
|
||||||
|
'ext': 'flv',
|
||||||
|
})
|
||||||
|
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': real_id,
|
||||||
|
'title': self._og_search_title(webpage),
|
||||||
|
'thumbnail': self._og_search_thumbnail(webpage),
|
||||||
|
'formats': formats,
|
||||||
|
'description': self._og_search_description(webpage),
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import json
|
import json
|
||||||
@ -11,38 +12,38 @@ from ..utils import (
|
|||||||
|
|
||||||
|
|
||||||
class IviIE(InfoExtractor):
|
class IviIE(InfoExtractor):
|
||||||
IE_DESC = u'ivi.ru'
|
IE_DESC = 'ivi.ru'
|
||||||
IE_NAME = u'ivi'
|
IE_NAME = 'ivi'
|
||||||
_VALID_URL = r'^https?://(?:www\.)?ivi\.ru/watch(?:/(?P<compilationid>[^/]+))?/(?P<videoid>\d+)'
|
_VALID_URL = r'^https?://(?:www\.)?ivi\.ru/watch(?:/(?P<compilationid>[^/]+))?/(?P<videoid>\d+)'
|
||||||
|
|
||||||
_TESTS = [
|
_TESTS = [
|
||||||
# Single movie
|
# Single movie
|
||||||
{
|
{
|
||||||
u'url': u'http://www.ivi.ru/watch/53141',
|
'url': 'http://www.ivi.ru/watch/53141',
|
||||||
u'file': u'53141.mp4',
|
'file': '53141.mp4',
|
||||||
u'md5': u'6ff5be2254e796ed346251d117196cf4',
|
'md5': '6ff5be2254e796ed346251d117196cf4',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'Иван Васильевич меняет профессию',
|
'title': 'Иван Васильевич меняет профессию',
|
||||||
u'description': u'md5:14d8eda24e9d93d29b5857012c6d6346',
|
'description': 'md5:b924063ea1677c8fe343d8a72ac2195f',
|
||||||
u'duration': 5498,
|
'duration': 5498,
|
||||||
u'thumbnail': u'http://thumbs.ivi.ru/f20.vcp.digitalaccess.ru/contents/d/1/c3c885163a082c29bceeb7b5a267a6.jpg',
|
'thumbnail': 'http://thumbs.ivi.ru/f20.vcp.digitalaccess.ru/contents/d/1/c3c885163a082c29bceeb7b5a267a6.jpg',
|
||||||
},
|
},
|
||||||
u'skip': u'Only works from Russia',
|
'skip': 'Only works from Russia',
|
||||||
},
|
},
|
||||||
# Serial's serie
|
# Serial's serie
|
||||||
{
|
{
|
||||||
u'url': u'http://www.ivi.ru/watch/dezhurnyi_angel/74791',
|
'url': 'http://www.ivi.ru/watch/dezhurnyi_angel/74791',
|
||||||
u'file': u'74791.mp4',
|
'file': '74791.mp4',
|
||||||
u'md5': u'3e6cc9a848c1d2ebcc6476444967baa9',
|
'md5': '3e6cc9a848c1d2ebcc6476444967baa9',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'Дежурный ангел - 1 серия',
|
'title': 'Дежурный ангел - 1 серия',
|
||||||
u'duration': 2490,
|
'duration': 2490,
|
||||||
u'thumbnail': u'http://thumbs.ivi.ru/f7.vcp.digitalaccess.ru/contents/8/e/bc2f6c2b6e5d291152fdd32c059141.jpg',
|
'thumbnail': 'http://thumbs.ivi.ru/f7.vcp.digitalaccess.ru/contents/8/e/bc2f6c2b6e5d291152fdd32c059141.jpg',
|
||||||
},
|
},
|
||||||
u'skip': u'Only works from Russia',
|
'skip': 'Only works from Russia',
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
# Sorted by quality
|
# Sorted by quality
|
||||||
_known_formats = ['MP4-low-mobile', 'MP4-mobile', 'FLV-lo', 'MP4-lo', 'FLV-hi', 'MP4-hi', 'MP4-SHQ']
|
_known_formats = ['MP4-low-mobile', 'MP4-mobile', 'FLV-lo', 'MP4-lo', 'FLV-hi', 'MP4-hi', 'MP4-SHQ']
|
||||||
|
|
||||||
@ -54,7 +55,7 @@ class IviIE(InfoExtractor):
|
|||||||
return m.group('description') if m is not None else None
|
return m.group('description') if m is not None else None
|
||||||
|
|
||||||
def _extract_comment_count(self, html):
|
def _extract_comment_count(self, html):
|
||||||
m = re.search(u'(?s)<a href="#" id="view-comments" class="action-button dim gradient">\s*Комментарии:\s*(?P<commentcount>\d+)\s*</a>', html)
|
m = re.search('(?s)<a href="#" id="view-comments" class="action-button dim gradient">\s*Комментарии:\s*(?P<commentcount>\d+)\s*</a>', html)
|
||||||
return int(m.group('commentcount')) if m is not None else 0
|
return int(m.group('commentcount')) if m is not None else 0
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@ -63,49 +64,49 @@ class IviIE(InfoExtractor):
|
|||||||
|
|
||||||
api_url = 'http://api.digitalaccess.ru/api/json/'
|
api_url = 'http://api.digitalaccess.ru/api/json/'
|
||||||
|
|
||||||
data = {u'method': u'da.content.get',
|
data = {'method': 'da.content.get',
|
||||||
u'params': [video_id, {u'site': u's183',
|
'params': [video_id, {'site': 's183',
|
||||||
u'referrer': u'http://www.ivi.ru/watch/%s' % video_id,
|
'referrer': 'http://www.ivi.ru/watch/%s' % video_id,
|
||||||
u'contentid': video_id
|
'contentid': video_id
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
request = compat_urllib_request.Request(api_url, json.dumps(data))
|
request = compat_urllib_request.Request(api_url, json.dumps(data))
|
||||||
|
|
||||||
video_json_page = self._download_webpage(request, video_id, u'Downloading video JSON')
|
video_json_page = self._download_webpage(request, video_id, 'Downloading video JSON')
|
||||||
video_json = json.loads(video_json_page)
|
video_json = json.loads(video_json_page)
|
||||||
|
|
||||||
if u'error' in video_json:
|
if 'error' in video_json:
|
||||||
error = video_json[u'error']
|
error = video_json['error']
|
||||||
if error[u'origin'] == u'NoRedisValidData':
|
if error['origin'] == 'NoRedisValidData':
|
||||||
raise ExtractorError(u'Video %s does not exist' % video_id, expected=True)
|
raise ExtractorError('Video %s does not exist' % video_id, expected=True)
|
||||||
raise ExtractorError(u'Unable to download video %s: %s' % (video_id, error[u'message']), expected=True)
|
raise ExtractorError('Unable to download video %s: %s' % (video_id, error['message']), expected=True)
|
||||||
|
|
||||||
result = video_json[u'result']
|
result = video_json['result']
|
||||||
|
|
||||||
formats = [{
|
formats = [{
|
||||||
'url': x[u'url'],
|
'url': x['url'],
|
||||||
'format_id': x[u'content_format'],
|
'format_id': x['content_format'],
|
||||||
'preference': self._known_formats.index(x[u'content_format']),
|
'preference': self._known_formats.index(x['content_format']),
|
||||||
} for x in result[u'files'] if x[u'content_format'] in self._known_formats]
|
} for x in result['files'] if x['content_format'] in self._known_formats]
|
||||||
|
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
if not formats:
|
if not formats:
|
||||||
raise ExtractorError(u'No media links available for %s' % video_id)
|
raise ExtractorError('No media links available for %s' % video_id)
|
||||||
|
|
||||||
duration = result[u'duration']
|
duration = result['duration']
|
||||||
compilation = result[u'compilation']
|
compilation = result['compilation']
|
||||||
title = result[u'title']
|
title = result['title']
|
||||||
|
|
||||||
title = '%s - %s' % (compilation, title) if compilation is not None else title
|
title = '%s - %s' % (compilation, title) if compilation is not None else title
|
||||||
|
|
||||||
previews = result[u'preview']
|
previews = result['preview']
|
||||||
previews.sort(key=lambda fmt: self._known_thumbnails.index(fmt['content_format']))
|
previews.sort(key=lambda fmt: self._known_thumbnails.index(fmt['content_format']))
|
||||||
thumbnail = previews[-1][u'url'] if len(previews) > 0 else None
|
thumbnail = previews[-1]['url'] if len(previews) > 0 else None
|
||||||
|
|
||||||
video_page = self._download_webpage(url, video_id, u'Downloading video page')
|
video_page = self._download_webpage(url, video_id, 'Downloading video page')
|
||||||
description = self._extract_description(video_page)
|
description = self._extract_description(video_page)
|
||||||
comment_count = self._extract_comment_count(video_page)
|
comment_count = self._extract_comment_count(video_page)
|
||||||
|
|
||||||
@ -121,8 +122,8 @@ class IviIE(InfoExtractor):
|
|||||||
|
|
||||||
|
|
||||||
class IviCompilationIE(InfoExtractor):
|
class IviCompilationIE(InfoExtractor):
|
||||||
IE_DESC = u'ivi.ru compilations'
|
IE_DESC = 'ivi.ru compilations'
|
||||||
IE_NAME = u'ivi:compilation'
|
IE_NAME = 'ivi:compilation'
|
||||||
_VALID_URL = r'^https?://(?:www\.)?ivi\.ru/watch/(?!\d+)(?P<compilationid>[a-z\d_-]+)(?:/season(?P<seasonid>\d+))?$'
|
_VALID_URL = r'^https?://(?:www\.)?ivi\.ru/watch/(?!\d+)(?P<compilationid>[a-z\d_-]+)(?:/season(?P<seasonid>\d+))?$'
|
||||||
|
|
||||||
def _extract_entries(self, html, compilation_id):
|
def _extract_entries(self, html, compilation_id):
|
||||||
@ -135,22 +136,23 @@ class IviCompilationIE(InfoExtractor):
|
|||||||
season_id = mobj.group('seasonid')
|
season_id = mobj.group('seasonid')
|
||||||
|
|
||||||
if season_id is not None: # Season link
|
if season_id is not None: # Season link
|
||||||
season_page = self._download_webpage(url, compilation_id, u'Downloading season %s web page' % season_id)
|
season_page = self._download_webpage(url, compilation_id, 'Downloading season %s web page' % season_id)
|
||||||
playlist_id = '%s/season%s' % (compilation_id, season_id)
|
playlist_id = '%s/season%s' % (compilation_id, season_id)
|
||||||
playlist_title = self._html_search_meta(u'title', season_page, u'title')
|
playlist_title = self._html_search_meta('title', season_page, 'title')
|
||||||
entries = self._extract_entries(season_page, compilation_id)
|
entries = self._extract_entries(season_page, compilation_id)
|
||||||
else: # Compilation link
|
else: # Compilation link
|
||||||
compilation_page = self._download_webpage(url, compilation_id, u'Downloading compilation web page')
|
compilation_page = self._download_webpage(url, compilation_id, 'Downloading compilation web page')
|
||||||
playlist_id = compilation_id
|
playlist_id = compilation_id
|
||||||
playlist_title = self._html_search_meta(u'title', compilation_page, u'title')
|
playlist_title = self._html_search_meta('title', compilation_page, 'title')
|
||||||
seasons = re.findall(r'<a href="/watch/%s/season(\d+)">[^<]+</a>' % compilation_id, compilation_page)
|
seasons = re.findall(r'<a href="/watch/%s/season(\d+)">[^<]+</a>' % compilation_id, compilation_page)
|
||||||
if len(seasons) == 0: # No seasons in this compilation
|
if len(seasons) == 0: # No seasons in this compilation
|
||||||
entries = self._extract_entries(compilation_page, compilation_id)
|
entries = self._extract_entries(compilation_page, compilation_id)
|
||||||
else:
|
else:
|
||||||
entries = []
|
entries = []
|
||||||
for season_id in seasons:
|
for season_id in seasons:
|
||||||
season_page = self._download_webpage('http://www.ivi.ru/watch/%s/season%s' % (compilation_id, season_id),
|
season_page = self._download_webpage(
|
||||||
compilation_id, u'Downloading season %s web page' % season_id)
|
'http://www.ivi.ru/watch/%s/season%s' % (compilation_id, season_id),
|
||||||
|
compilation_id, 'Downloading season %s web page' % season_id)
|
||||||
entries.extend(self._extract_entries(season_page, compilation_id))
|
entries.extend(self._extract_entries(season_page, compilation_id))
|
||||||
|
|
||||||
return self.playlist_result(entries, playlist_id, playlist_title)
|
return self.playlist_result(entries, playlist_id, playlist_title)
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
@ -5,36 +7,34 @@ from .common import InfoExtractor
|
|||||||
|
|
||||||
class KeekIE(InfoExtractor):
|
class KeekIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?keek\.com/(?:!|\w+/keeks/)(?P<videoID>\w+)'
|
_VALID_URL = r'https?://(?:www\.)?keek\.com/(?:!|\w+/keeks/)(?P<videoID>\w+)'
|
||||||
IE_NAME = u'keek'
|
IE_NAME = 'keek'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'https://www.keek.com/ytdl/keeks/NODfbab',
|
'url': 'https://www.keek.com/ytdl/keeks/NODfbab',
|
||||||
u'file': u'NODfbab.mp4',
|
'file': 'NODfbab.mp4',
|
||||||
u'md5': u'9b0636f8c0f7614afa4ea5e4c6e57e83',
|
'md5': '9b0636f8c0f7614afa4ea5e4c6e57e83',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"uploader": u"ytdl",
|
'uploader': 'ytdl',
|
||||||
u"title": u"test chars: \"'/\\\u00e4<>This is a test video for youtube-dl.For more information, contact phihag@phihag.de ."
|
'title': 'test chars: "\'/\\\u00e4<>This is a test video for youtube-dl.For more information, contact phihag@phihag.de .',
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
m = re.match(self._VALID_URL, url)
|
m = re.match(self._VALID_URL, url)
|
||||||
video_id = m.group('videoID')
|
video_id = m.group('videoID')
|
||||||
|
|
||||||
video_url = u'http://cdn.keek.com/keek/video/%s' % video_id
|
video_url = 'http://cdn.keek.com/keek/video/%s' % video_id
|
||||||
thumbnail = u'http://cdn.keek.com/keek/thumbnail/%s/w100/h75' % video_id
|
thumbnail = 'http://cdn.keek.com/keek/thumbnail/%s/w100/h75' % video_id
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
video_title = self._og_search_title(webpage)
|
uploader = self._html_search_regex(
|
||||||
|
r'<div class="user-name-and-bio">[\S\s]+?<h2>(?P<uploader>.+?)</h2>',
|
||||||
|
webpage, 'uploader', fatal=False)
|
||||||
|
|
||||||
uploader = self._html_search_regex(r'<div class="user-name-and-bio">[\S\s]+?<h2>(?P<uploader>.+?)</h2>',
|
return {
|
||||||
webpage, u'uploader', fatal=False)
|
'id': video_id,
|
||||||
|
'url': video_url,
|
||||||
info = {
|
'ext': 'mp4',
|
||||||
'id': video_id,
|
'title': self._og_search_title(webpage),
|
||||||
'url': video_url,
|
'thumbnail': thumbnail,
|
||||||
'ext': 'mp4',
|
'uploader': uploader
|
||||||
'title': video_title,
|
|
||||||
'thumbnail': thumbnail,
|
|
||||||
'uploader': uploader
|
|
||||||
}
|
}
|
||||||
return [info]
|
|
||||||
|
63
youtube_dl/extractor/la7.py
Normal file
63
youtube_dl/extractor/la7.py
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
parse_duration,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class LA7IE(InfoExtractor):
|
||||||
|
IE_NAME = 'la7.tv'
|
||||||
|
_VALID_URL = r'''(?x)
|
||||||
|
https?://(?:www\.)?la7\.tv/
|
||||||
|
(?:
|
||||||
|
richplayer/\?assetid=|
|
||||||
|
\?contentId=
|
||||||
|
)
|
||||||
|
(?P<id>[0-9]+)'''
|
||||||
|
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://www.la7.tv/richplayer/?assetid=50355319',
|
||||||
|
'file': '50355319.mp4',
|
||||||
|
'md5': 'ec7d1f0224d20ba293ab56cf2259651f',
|
||||||
|
'info_dict': {
|
||||||
|
'title': 'IL DIVO',
|
||||||
|
'description': 'Un film di Paolo Sorrentino con Toni Servillo, Anna Bonaiuto, Giulio Bosetti e Flavio Bucci',
|
||||||
|
'duration': 6254,
|
||||||
|
},
|
||||||
|
'skip': 'Blocked in the US',
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
xml_url = 'http://www.la7.tv/repliche/content/index.php?contentId=%s' % video_id
|
||||||
|
doc = self._download_xml(xml_url, video_id)
|
||||||
|
|
||||||
|
video_title = doc.find('title').text
|
||||||
|
description = doc.find('description').text
|
||||||
|
duration = parse_duration(doc.find('duration').text)
|
||||||
|
thumbnail = doc.find('img').text
|
||||||
|
view_count = int(doc.find('views').text)
|
||||||
|
|
||||||
|
prefix = doc.find('.//fqdn').text.strip().replace('auto:', 'http:')
|
||||||
|
|
||||||
|
formats = [{
|
||||||
|
'format': vnode.find('quality').text,
|
||||||
|
'tbr': int(vnode.find('quality').text),
|
||||||
|
'url': vnode.find('fms').text.strip().replace('mp4:', prefix),
|
||||||
|
} for vnode in doc.findall('.//videos/video')]
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': video_title,
|
||||||
|
'description': description,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
'duration': duration,
|
||||||
|
'formats': formats,
|
||||||
|
'view_count': view_count,
|
||||||
|
}
|
63
youtube_dl/extractor/lifenews.py
Normal file
63
youtube_dl/extractor/lifenews.py
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
# encoding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import unified_strdate
|
||||||
|
|
||||||
|
|
||||||
|
class LifeNewsIE(InfoExtractor):
|
||||||
|
IE_NAME = 'lifenews'
|
||||||
|
IE_DESC = 'LIFE | NEWS'
|
||||||
|
_VALID_URL = r'http://lifenews\.ru/(?:mobile/)?news/(?P<id>\d+)'
|
||||||
|
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://lifenews.ru/news/126342',
|
||||||
|
'file': '126342.mp4',
|
||||||
|
'md5': 'e1b50a5c5fb98a6a544250f2e0db570a',
|
||||||
|
'info_dict': {
|
||||||
|
'title': 'МВД разыскивает мужчин, оставивших в IKEA сумку с автоматом',
|
||||||
|
'description': 'Камеры наблюдения гипермаркета зафиксировали троих мужчин, спрятавших оружейный арсенал в камере хранения.',
|
||||||
|
'thumbnail': 'http://lifenews.ru/static/posts/2014/1/126342/.video.jpg',
|
||||||
|
'upload_date': '20140130',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
webpage = self._download_webpage('http://lifenews.ru/mobile/news/%s' % video_id, video_id, 'Downloading page')
|
||||||
|
|
||||||
|
video_url = self._html_search_regex(
|
||||||
|
r'<video.*?src="([^"]+)".*?></video>', webpage, 'video URL')
|
||||||
|
|
||||||
|
thumbnail = self._html_search_regex(
|
||||||
|
r'<video.*?poster="([^"]+)".*?"></video>', webpage, 'video thumbnail')
|
||||||
|
|
||||||
|
title = self._og_search_title(webpage)
|
||||||
|
TITLE_SUFFIX = ' - Первый по срочным новостям — LIFE | NEWS'
|
||||||
|
if title.endswith(TITLE_SUFFIX):
|
||||||
|
title = title[:-len(TITLE_SUFFIX)]
|
||||||
|
|
||||||
|
description = self._og_search_description(webpage)
|
||||||
|
|
||||||
|
view_count = self._html_search_regex(
|
||||||
|
r'<div class=\'views\'>(\d+)</div>', webpage, 'view count')
|
||||||
|
comment_count = self._html_search_regex(
|
||||||
|
r'<div class=\'comments\'>(\d+)</div>', webpage, 'comment count')
|
||||||
|
|
||||||
|
upload_date = self._html_search_regex(
|
||||||
|
r'<time datetime=\'([^\']+)\'>', webpage, 'upload date')
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'url': video_url,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
'title': title,
|
||||||
|
'description': description,
|
||||||
|
'view_count': view_count,
|
||||||
|
'comment_count': comment_count,
|
||||||
|
'upload_date': unified_strdate(upload_date),
|
||||||
|
}
|
@ -1,52 +1,63 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import json
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
|
||||||
ExtractorError,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class LiveLeakIE(InfoExtractor):
|
class LiveLeakIE(InfoExtractor):
|
||||||
|
|
||||||
_VALID_URL = r'^(?:http://)?(?:\w+\.)?liveleak\.com/view\?(?:.*?)i=(?P<video_id>[\w_]+)(?:.*)'
|
_VALID_URL = r'^(?:http://)?(?:\w+\.)?liveleak\.com/view\?(?:.*?)i=(?P<video_id>[\w_]+)(?:.*)'
|
||||||
IE_NAME = u'liveleak'
|
_TESTS = [{
|
||||||
_TEST = {
|
'url': 'http://www.liveleak.com/view?i=757_1364311680',
|
||||||
u'url': u'http://www.liveleak.com/view?i=757_1364311680',
|
'file': '757_1364311680.mp4',
|
||||||
u'file': u'757_1364311680.mp4',
|
'md5': '0813c2430bea7a46bf13acf3406992f4',
|
||||||
u'md5': u'0813c2430bea7a46bf13acf3406992f4',
|
'info_dict': {
|
||||||
u'info_dict': {
|
'description': 'extremely bad day for this guy..!',
|
||||||
u"description": u"extremely bad day for this guy..!",
|
'uploader': 'ljfriel2',
|
||||||
u"uploader": u"ljfriel2",
|
'title': 'Most unlucky car accident'
|
||||||
u"title": u"Most unlucky car accident"
|
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
'url': 'http://www.liveleak.com/view?i=f93_1390833151',
|
||||||
|
'file': 'f93_1390833151.mp4',
|
||||||
|
'md5': 'd3f1367d14cc3c15bf24fbfbe04b9abf',
|
||||||
|
'info_dict': {
|
||||||
|
'description': 'German Television Channel NDR does an exclusive interview with Edward Snowden.\r\nUploaded on LiveLeak cause German Television thinks the rest of the world isn\'t intereseted in Edward Snowden.',
|
||||||
|
'uploader': 'ARD_Stinkt',
|
||||||
|
'title': 'German Television does first Edward Snowden Interview (ENGLISH)',
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
|
||||||
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:
|
|
||||||
raise ExtractorError(u'Invalid URL: %s' % url)
|
|
||||||
|
|
||||||
video_id = mobj.group('video_id')
|
video_id = mobj.group('video_id')
|
||||||
|
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
sources_raw = self._search_regex(
|
||||||
|
r'(?s)sources:\s*(\[.*?\]),', webpage, 'video URLs', default=None)
|
||||||
|
if sources_raw is None:
|
||||||
|
sources_raw = '[{ %s}]' % (
|
||||||
|
self._search_regex(r'(file: ".*?"),', webpage, 'video URL'))
|
||||||
|
|
||||||
video_url = self._search_regex(r'file: "(.*?)",',
|
sources_json = re.sub(r'\s([a-z]+):\s', r'"\1": ', sources_raw)
|
||||||
webpage, u'video URL')
|
sources = json.loads(sources_json)
|
||||||
|
|
||||||
|
formats = [{
|
||||||
|
'format_note': s.get('label'),
|
||||||
|
'url': s['file'],
|
||||||
|
} for s in sources]
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
video_title = self._og_search_title(webpage).replace('LiveLeak.com -', '').strip()
|
video_title = self._og_search_title(webpage).replace('LiveLeak.com -', '').strip()
|
||||||
|
|
||||||
video_description = self._og_search_description(webpage)
|
video_description = self._og_search_description(webpage)
|
||||||
|
video_uploader = self._html_search_regex(
|
||||||
|
r'By:.*?(\w+)</a>', webpage, 'uploader', fatal=False)
|
||||||
|
|
||||||
video_uploader = self._html_search_regex(r'By:.*?(\w+)</a>',
|
return {
|
||||||
webpage, u'uploader', fatal=False)
|
'id': video_id,
|
||||||
|
|
||||||
info = {
|
|
||||||
'id': video_id,
|
|
||||||
'url': video_url,
|
|
||||||
'ext': 'mp4',
|
|
||||||
'title': video_title,
|
'title': video_title,
|
||||||
'description': video_description,
|
'description': video_description,
|
||||||
'uploader': video_uploader
|
'uploader': video_uploader,
|
||||||
|
'formats': formats,
|
||||||
}
|
}
|
||||||
|
|
||||||
return [info]
|
|
||||||
|
56
youtube_dl/extractor/m6.py
Normal file
56
youtube_dl/extractor/m6.py
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
# encoding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
|
class M6IE(InfoExtractor):
|
||||||
|
IE_NAME = 'm6'
|
||||||
|
_VALID_URL = r'http://(?:www\.)?m6\.fr/[^/]+/videos/(?P<id>\d+)-[^\.]+\.html'
|
||||||
|
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://www.m6.fr/emission-les_reines_du_shopping/videos/11323908-emeline_est_la_reine_du_shopping_sur_le_theme_ma_fete_d_8217_anniversaire.html',
|
||||||
|
'md5': '242994a87de2c316891428e0176bcb77',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '11323908',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Emeline est la Reine du Shopping sur le thème « Ma fête d’anniversaire ! »',
|
||||||
|
'description': 'md5:1212ae8fb4b7baa4dc3886c5676007c2',
|
||||||
|
'duration': 100,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
rss = self._download_xml('http://ws.m6.fr/v1/video/info/m6/bonus/%s' % video_id, video_id,
|
||||||
|
'Downloading video RSS')
|
||||||
|
|
||||||
|
title = rss.find('./channel/item/title').text
|
||||||
|
description = rss.find('./channel/item/description').text
|
||||||
|
thumbnail = rss.find('./channel/item/visuel_clip_big').text
|
||||||
|
duration = int(rss.find('./channel/item/duration').text)
|
||||||
|
view_count = int(rss.find('./channel/item/nombre_vues').text)
|
||||||
|
|
||||||
|
formats = []
|
||||||
|
for format_id in ['lq', 'sd', 'hq', 'hd']:
|
||||||
|
video_url = rss.find('./channel/item/url_video_%s' % format_id)
|
||||||
|
if video_url is None:
|
||||||
|
continue
|
||||||
|
formats.append({
|
||||||
|
'url': video_url.text,
|
||||||
|
'format_id': format_id,
|
||||||
|
})
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': title,
|
||||||
|
'description': description,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
'duration': duration,
|
||||||
|
'view_count': view_count,
|
||||||
|
'formats': formats,
|
||||||
|
}
|
59
youtube_dl/extractor/malemotion.py
Normal file
59
youtube_dl/extractor/malemotion.py
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
compat_urllib_parse,
|
||||||
|
)
|
||||||
|
|
||||||
|
class MalemotionIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'^(?:https?://)?malemotion\.com/video/(.+?)\.(?P<id>.+?)(#|$)'
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://malemotion.com/video/bien-dur.10ew',
|
||||||
|
'file': '10ew.mp4',
|
||||||
|
'md5': 'b3cc49f953b107e4a363cdff07d100ce',
|
||||||
|
'info_dict': {
|
||||||
|
"title": "Bien dur",
|
||||||
|
"age_limit": 18,
|
||||||
|
},
|
||||||
|
'skip': 'This video has been deleted.'
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group("id")
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
|
self.report_extraction(video_id)
|
||||||
|
|
||||||
|
# Extract video URL
|
||||||
|
video_url = compat_urllib_parse.unquote(
|
||||||
|
self._search_regex(r'<source type="video/mp4" src="(.+?)"', webpage, 'video URL'))
|
||||||
|
|
||||||
|
# Extract title
|
||||||
|
video_title = self._html_search_regex(
|
||||||
|
r'<title>(.*?)</title', webpage, 'title')
|
||||||
|
|
||||||
|
# Extract video thumbnail
|
||||||
|
video_thumbnail = self._search_regex(
|
||||||
|
r'<video .+?poster="(.+?)"', webpage, 'thumbnail', fatal=False)
|
||||||
|
|
||||||
|
formats = [{
|
||||||
|
'url': video_url,
|
||||||
|
'ext': 'mp4',
|
||||||
|
'format_id': 'mp4',
|
||||||
|
'preference': 1,
|
||||||
|
}]
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'formats': formats,
|
||||||
|
'uploader': None,
|
||||||
|
'upload_date': None,
|
||||||
|
'title': video_title,
|
||||||
|
'thumbnail': video_thumbnail,
|
||||||
|
'description': None,
|
||||||
|
'age_limit': 18,
|
||||||
|
}
|
114
youtube_dl/extractor/mooshare.py
Normal file
114
youtube_dl/extractor/mooshare.py
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
import time
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
ExtractorError,
|
||||||
|
compat_urllib_request,
|
||||||
|
compat_urllib_parse,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class MooshareIE(InfoExtractor):
|
||||||
|
IE_NAME = 'mooshare'
|
||||||
|
IE_DESC = 'Mooshare.biz'
|
||||||
|
_VALID_URL = r'http://mooshare\.biz/(?P<id>[\da-z]{12})'
|
||||||
|
|
||||||
|
_TESTS = [
|
||||||
|
{
|
||||||
|
'url': 'http://mooshare.biz/8dqtk4bjbp8g',
|
||||||
|
'md5': '4e14f9562928aecd2e42c6f341c8feba',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '8dqtk4bjbp8g',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Comedy Football 2011 - (part 1-2)',
|
||||||
|
'duration': 893,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': 'http://mooshare.biz/aipjtoc4g95j',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'aipjtoc4g95j',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Orange Caramel Dashing Through the Snow',
|
||||||
|
'duration': 212,
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
# rtmp download
|
||||||
|
'skip_download': True,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
page = self._download_webpage(url, video_id, 'Downloading page')
|
||||||
|
|
||||||
|
if re.search(r'>Video Not Found or Deleted<', page) is not None:
|
||||||
|
raise ExtractorError(u'Video %s does not exist' % video_id, expected=True)
|
||||||
|
|
||||||
|
hash_key = self._html_search_regex(r'<input type="hidden" name="hash" value="([^"]+)">', page, 'hash')
|
||||||
|
title = self._html_search_regex(r'(?m)<div class="blockTitle">\s*<h2>Watch ([^<]+)</h2>', page, 'title')
|
||||||
|
|
||||||
|
download_form = {
|
||||||
|
'op': 'download1',
|
||||||
|
'id': video_id,
|
||||||
|
'hash': hash_key,
|
||||||
|
}
|
||||||
|
|
||||||
|
request = compat_urllib_request.Request(
|
||||||
|
'http://mooshare.biz/%s' % video_id, compat_urllib_parse.urlencode(download_form))
|
||||||
|
request.add_header('Content-Type', 'application/x-www-form-urlencoded')
|
||||||
|
|
||||||
|
self.to_screen('%s: Waiting for timeout' % video_id)
|
||||||
|
time.sleep(5)
|
||||||
|
|
||||||
|
video_page = self._download_webpage(request, video_id, 'Downloading video page')
|
||||||
|
|
||||||
|
thumbnail = self._html_search_regex(r'image:\s*"([^"]+)",', video_page, 'thumbnail', fatal=False)
|
||||||
|
duration_str = self._html_search_regex(r'duration:\s*"(\d+)",', video_page, 'duration', fatal=False)
|
||||||
|
duration = int(duration_str) if duration_str is not None else None
|
||||||
|
|
||||||
|
formats = []
|
||||||
|
|
||||||
|
# SD video
|
||||||
|
mobj = re.search(r'(?m)file:\s*"(?P<url>[^"]+)",\s*provider:', video_page)
|
||||||
|
if mobj is not None:
|
||||||
|
formats.append({
|
||||||
|
'url': mobj.group('url'),
|
||||||
|
'format_id': 'sd',
|
||||||
|
'format': 'SD',
|
||||||
|
})
|
||||||
|
|
||||||
|
# HD video
|
||||||
|
mobj = re.search(r'\'hd-2\': { file: \'(?P<url>[^\']+)\' },', video_page)
|
||||||
|
if mobj is not None:
|
||||||
|
formats.append({
|
||||||
|
'url': mobj.group('url'),
|
||||||
|
'format_id': 'hd',
|
||||||
|
'format': 'HD',
|
||||||
|
})
|
||||||
|
|
||||||
|
# rtmp video
|
||||||
|
mobj = re.search(r'(?m)file: "(?P<playpath>[^"]+)",\s*streamer: "(?P<rtmpurl>rtmp://[^"]+)",', video_page)
|
||||||
|
if mobj is not None:
|
||||||
|
formats.append({
|
||||||
|
'url': mobj.group('rtmpurl'),
|
||||||
|
'play_path': mobj.group('playpath'),
|
||||||
|
'rtmp_live': False,
|
||||||
|
'ext': 'mp4',
|
||||||
|
'format_id': 'rtmp',
|
||||||
|
'format': 'HD',
|
||||||
|
})
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': title,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
'duration': duration,
|
||||||
|
'formats': formats,
|
||||||
|
}
|
@ -82,13 +82,17 @@ class MTVServicesInfoExtractor(InfoExtractor):
|
|||||||
title_el = find_xpath_attr(
|
title_el = find_xpath_attr(
|
||||||
itemdoc, './/{http://search.yahoo.com/mrss/}category',
|
itemdoc, './/{http://search.yahoo.com/mrss/}category',
|
||||||
'scheme', 'urn:mtvn:video_title')
|
'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:
|
if title_el is None:
|
||||||
title_el = itemdoc.find('.//title')
|
title_el = itemdoc.find('.//title')
|
||||||
|
if title_el.text is None:
|
||||||
|
title_el = None
|
||||||
|
if title_el is None:
|
||||||
|
title_el = itemdoc.find('.//{http://search.yahoo.com/mrss/}title')
|
||||||
|
|
||||||
title = title_el.text
|
title = title_el.text
|
||||||
if title is None:
|
if title is None:
|
||||||
raise ExtractorError('Could not find video title')
|
raise ExtractorError('Could not find video title')
|
||||||
|
title = title.strip()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'title': title,
|
'title': title,
|
||||||
@ -111,11 +115,16 @@ class MTVServicesInfoExtractor(InfoExtractor):
|
|||||||
title = url_basename(url)
|
title = url_basename(url)
|
||||||
webpage = self._download_webpage(url, title)
|
webpage = self._download_webpage(url, title)
|
||||||
try:
|
try:
|
||||||
# the url is in the format http://media.mtvnservices.com/fb/{mgid}.swf
|
# the url can be http://media.mtvnservices.com/fb/{mgid}.swf
|
||||||
fb_url = self._og_search_video_url(webpage)
|
# or http://media.mtvnservices.com/{mgid}
|
||||||
mgid = url_basename(fb_url).rpartition('.')[0]
|
og_url = self._og_search_video_url(webpage)
|
||||||
|
mgid = url_basename(og_url)
|
||||||
|
if mgid.endswith('.swf'):
|
||||||
|
mgid = mgid[:-4]
|
||||||
except RegexNotFoundError:
|
except RegexNotFoundError:
|
||||||
mgid = self._search_regex(r'data-mgid="(.*?)"', webpage, u'mgid')
|
mgid = self._search_regex(
|
||||||
|
[r'data-mgid="(.*?)"', r'swfobject.embedSWF\(".*?(mgid:.*?)"'],
|
||||||
|
webpage, u'mgid')
|
||||||
return self._get_videos_info(mgid)
|
return self._get_videos_info(mgid)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
@ -11,13 +12,13 @@ from ..utils import (
|
|||||||
class MySpassIE(InfoExtractor):
|
class MySpassIE(InfoExtractor):
|
||||||
_VALID_URL = r'http://www\.myspass\.de/.*'
|
_VALID_URL = r'http://www\.myspass\.de/.*'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.myspass.de/myspass/shows/tvshows/absolute-mehrheit/Absolute-Mehrheit-vom-17022013-Die-Highlights-Teil-2--/11741/',
|
'url': 'http://www.myspass.de/myspass/shows/tvshows/absolute-mehrheit/Absolute-Mehrheit-vom-17022013-Die-Highlights-Teil-2--/11741/',
|
||||||
u'file': u'11741.mp4',
|
'file': '11741.mp4',
|
||||||
u'md5': u'0b49f4844a068f8b33f4b7c88405862b',
|
'md5': '0b49f4844a068f8b33f4b7c88405862b',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"description": u"Wer kann in die Fu\u00dfstapfen von Wolfgang Kubicki treten und die Mehrheit der Zuschauer hinter sich versammeln? Wird vielleicht sogar die Absolute Mehrheit geknackt und der Jackpot von 200.000 Euro mit nach Hause genommen?",
|
"description": "Wer kann in die Fu\u00dfstapfen von Wolfgang Kubicki treten und die Mehrheit der Zuschauer hinter sich versammeln? Wird vielleicht sogar die Absolute Mehrheit geknackt und der Jackpot von 200.000 Euro mit nach Hause genommen?",
|
||||||
u"title": u"Absolute Mehrheit vom 17.02.2013 - Die Highlights, Teil 2"
|
"title": "Absolute Mehrheit vom 17.02.2013 - Die Highlights, Teil 2",
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@ -37,12 +38,11 @@ class MySpassIE(InfoExtractor):
|
|||||||
# extract values from metadata
|
# extract values from metadata
|
||||||
url_flv_el = metadata.find('url_flv')
|
url_flv_el = metadata.find('url_flv')
|
||||||
if url_flv_el is None:
|
if url_flv_el is None:
|
||||||
raise ExtractorError(u'Unable to extract download url')
|
raise ExtractorError('Unable to extract download url')
|
||||||
video_url = url_flv_el.text
|
video_url = url_flv_el.text
|
||||||
extension = os.path.splitext(video_url)[1][1:]
|
|
||||||
title_el = metadata.find('title')
|
title_el = metadata.find('title')
|
||||||
if title_el is None:
|
if title_el is None:
|
||||||
raise ExtractorError(u'Unable to extract title')
|
raise ExtractorError('Unable to extract title')
|
||||||
title = title_el.text
|
title = title_el.text
|
||||||
format_id_el = metadata.find('format_id')
|
format_id_el = metadata.find('format_id')
|
||||||
if format_id_el is None:
|
if format_id_el is None:
|
||||||
@ -59,13 +59,12 @@ class MySpassIE(InfoExtractor):
|
|||||||
thumbnail = imagePreview_el.text
|
thumbnail = imagePreview_el.text
|
||||||
else:
|
else:
|
||||||
thumbnail = None
|
thumbnail = None
|
||||||
info = {
|
|
||||||
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
'title': title,
|
'title': title,
|
||||||
'ext': extension,
|
|
||||||
'format': format,
|
'format': format,
|
||||||
'thumbnail': thumbnail,
|
'thumbnail': thumbnail,
|
||||||
'description': description
|
'description': description,
|
||||||
}
|
}
|
||||||
return [info]
|
|
||||||
|
@ -1,48 +1,39 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
|
||||||
ExtractorError,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class NBAIE(InfoExtractor):
|
class NBAIE(InfoExtractor):
|
||||||
_VALID_URL = r'^(?:https?://)?(?:watch\.|www\.)?nba\.com/(?:nba/)?video(/[^?]*?)(?:/index\.html)?(?:\?.*)?$'
|
_VALID_URL = r'^(?:https?://)?(?:watch\.|www\.)?nba\.com/(?:nba/)?video(/[^?]*?)(?:/index\.html)?(?:\?.*)?$'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.nba.com/video/games/nets/2012/12/04/0021200253-okc-bkn-recap.nba/index.html',
|
'url': 'http://www.nba.com/video/games/nets/2012/12/04/0021200253-okc-bkn-recap.nba/index.html',
|
||||||
u'file': u'0021200253-okc-bkn-recap.nba.mp4',
|
'file': u'0021200253-okc-bkn-recap.nba.mp4',
|
||||||
u'md5': u'c0edcfc37607344e2ff8f13c378c88a4',
|
'md5': u'c0edcfc37607344e2ff8f13c378c88a4',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"description": u"Kevin Durant scores 32 points and dishes out six assists as the Thunder beat the Nets in Brooklyn.",
|
'description': 'Kevin Durant scores 32 points and dishes out six assists as the Thunder beat the Nets in Brooklyn.',
|
||||||
u"title": u"Thunder vs. Nets"
|
'title': 'Thunder vs. Nets',
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
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:
|
|
||||||
raise ExtractorError(u'Invalid URL: %s' % 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)
|
||||||
|
|
||||||
video_url = u'http://ht-mobile.cdn.turner.com/nba/big' + video_id + '_nba_1280x720.mp4'
|
video_url = 'http://ht-mobile.cdn.turner.com/nba/big' + video_id + '_nba_1280x720.mp4'
|
||||||
|
|
||||||
shortened_video_id = video_id.rpartition('/')[2]
|
shortened_video_id = video_id.rpartition('/')[2]
|
||||||
title = self._og_search_title(webpage, default=shortened_video_id).replace('NBA.com: ', '')
|
title = self._og_search_title(webpage, default=shortened_video_id).replace('NBA.com: ', '')
|
||||||
|
|
||||||
# It isn't there in the HTML it returns to us
|
|
||||||
# uploader_date = self._html_search_regex(r'<b>Date:</b> (.*?)</div>', webpage, 'upload_date', fatal=False)
|
|
||||||
|
|
||||||
description = self._html_search_regex(r'<meta name="description" (?:content|value)="(.*?)" />', webpage, 'description', fatal=False)
|
description = self._html_search_regex(r'<meta name="description" (?:content|value)="(.*?)" />', webpage, 'description', fatal=False)
|
||||||
|
|
||||||
info = {
|
return {
|
||||||
'id': shortened_video_id,
|
'id': shortened_video_id,
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': title,
|
'title': title,
|
||||||
# 'uploader_date': uploader_date,
|
|
||||||
'description': description,
|
'description': description,
|
||||||
}
|
}
|
||||||
return [info]
|
|
||||||
|
@ -1,19 +1,21 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
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>[0-9]+)'
|
||||||
_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',
|
'md5': 'fe6033d297591288fa1c1f780386f07a',
|
||||||
u'md5': u'fe6033d297591288fa1c1f780386f07a',
|
'info_dict': {
|
||||||
u'info_dict': {
|
'id': '549479',
|
||||||
u"title": u"B7 - BusMode",
|
'ext': 'mp3',
|
||||||
u"uploader": u"Burn7",
|
'title': 'B7 - BusMode',
|
||||||
|
'uploader': 'Burn7',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,17 +24,19 @@ class NewgroundsIE(InfoExtractor):
|
|||||||
music_id = mobj.group('id')
|
music_id = mobj.group('id')
|
||||||
webpage = self._download_webpage(url, music_id)
|
webpage = self._download_webpage(url, music_id)
|
||||||
|
|
||||||
title = self._html_search_regex(r',"name":"([^"]+)",', webpage, u'music title')
|
title = self._html_search_regex(
|
||||||
uploader = self._html_search_regex(r',"artist":"([^"]+)",', webpage, u'music uploader')
|
r',"name":"([^"]+)",', webpage, 'music title')
|
||||||
|
uploader = self._html_search_regex(
|
||||||
|
r',"artist":"([^"]+)",', webpage, 'music uploader')
|
||||||
|
|
||||||
music_url_json_string = self._html_search_regex(r'({"url":"[^"]+"),', webpage, u'music url') + '}'
|
music_url_json_string = self._html_search_regex(
|
||||||
|
r'({"url":"[^"]+"),', webpage, 'music url') + '}'
|
||||||
music_url_json = json.loads(music_url_json_string)
|
music_url_json = json.loads(music_url_json_string)
|
||||||
music_url = music_url_json['url']
|
music_url = music_url_json['url']
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': music_id,
|
'id': music_id,
|
||||||
'title': title,
|
'title': title,
|
||||||
'url': music_url,
|
'url': music_url,
|
||||||
'uploader': uploader,
|
'uploader': uploader,
|
||||||
'ext': determine_ext(music_url),
|
|
||||||
}
|
}
|
||||||
|
76
youtube_dl/extractor/nfb.py
Normal file
76
youtube_dl/extractor/nfb.py
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
compat_urllib_request,
|
||||||
|
compat_urllib_parse,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class NFBIE(InfoExtractor):
|
||||||
|
IE_NAME = 'nfb'
|
||||||
|
IE_DESC = 'National Film Board of Canada'
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?(nfb|onf)\.ca/film/(?P<id>[\da-z_-]+)'
|
||||||
|
|
||||||
|
_TEST = {
|
||||||
|
'url': 'https://www.nfb.ca/film/qallunaat_why_white_people_are_funny',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'qallunaat_why_white_people_are_funny',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Qallunaat! Why White People Are Funny ',
|
||||||
|
'description': 'md5:836d8aff55e087d04d9f6df554d4e038',
|
||||||
|
'duration': 3128,
|
||||||
|
'uploader': 'Mark Sandiford',
|
||||||
|
'uploader_id': 'mark-sandiford',
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
# rtmp download
|
||||||
|
'skip_download': True,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
page = self._download_webpage('https://www.nfb.ca/film/%s' % video_id, video_id, 'Downloading film page')
|
||||||
|
|
||||||
|
uploader_id = self._html_search_regex(r'<a class="director-link" href="/explore-all-directors/([^/]+)/"',
|
||||||
|
page, 'director id', fatal=False)
|
||||||
|
uploader = self._html_search_regex(r'<em class="director-name" itemprop="name">([^<]+)</em>',
|
||||||
|
page, 'director name', fatal=False)
|
||||||
|
|
||||||
|
request = compat_urllib_request.Request('https://www.nfb.ca/film/%s/player_config' % video_id,
|
||||||
|
compat_urllib_parse.urlencode({'getConfig': 'true'}))
|
||||||
|
request.add_header('Content-Type', 'application/x-www-form-urlencoded')
|
||||||
|
request.add_header('X-NFB-Referer', 'http://www.nfb.ca/medias/flash/NFBVideoPlayer.swf')
|
||||||
|
|
||||||
|
config = self._download_xml(request, video_id, 'Downloading player config XML')
|
||||||
|
|
||||||
|
thumbnail = config.find("./player/stream/media[@type='posterImage']/assets/asset[@quality='high']/default/url").text
|
||||||
|
video = config.find("./player/stream/media[@type='video']")
|
||||||
|
duration = int(video.get('duration'))
|
||||||
|
title = video.find('title').text
|
||||||
|
description = video.find('description').text
|
||||||
|
|
||||||
|
# It seems assets always go from lower to better quality, so no need to sort
|
||||||
|
formats = [{
|
||||||
|
'url': x.find('default/streamerURI').text + '/',
|
||||||
|
'play_path': x.find('default/url').text,
|
||||||
|
'rtmp_live': False,
|
||||||
|
'ext': 'mp4',
|
||||||
|
'format_id': x.get('quality'),
|
||||||
|
} for x in video.findall('assets/asset')]
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': title,
|
||||||
|
'description': description,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
'duration': duration,
|
||||||
|
'uploader': uploader,
|
||||||
|
'uploader_id': uploader_id,
|
||||||
|
'formats': formats,
|
||||||
|
}
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
|
|
||||||
@ -9,13 +11,13 @@ class NineGagIE(InfoExtractor):
|
|||||||
_VALID_URL = r'^https?://(?:www\.)?9gag\.tv/v/(?P<id>[0-9]+)'
|
_VALID_URL = r'^https?://(?:www\.)?9gag\.tv/v/(?P<id>[0-9]+)'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u"url": u"http://9gag.tv/v/1912",
|
"url": "http://9gag.tv/v/1912",
|
||||||
u"file": u"1912.mp4",
|
"file": "1912.mp4",
|
||||||
u"info_dict": {
|
"info_dict": {
|
||||||
u"description": u"This 3-minute video will make you smile and then make you feel untalented and insignificant. Anyway, you should share this awesomeness. (Thanks, Dino!)",
|
"description": "This 3-minute video will make you smile and then make you feel untalented and insignificant. Anyway, you should share this awesomeness. (Thanks, Dino!)",
|
||||||
u"title": u"\"People Are Awesome 2013\" Is Absolutely Awesome"
|
"title": "\"People Are Awesome 2013\" Is Absolutely Awesome"
|
||||||
},
|
},
|
||||||
u'add_ie': [u'Youtube']
|
'add_ie': ['Youtube']
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@ -25,7 +27,7 @@ class NineGagIE(InfoExtractor):
|
|||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
data_json = self._html_search_regex(r'''(?x)
|
data_json = self._html_search_regex(r'''(?x)
|
||||||
<div\s*id="tv-video"\s*data-video-source="youtube"\s*
|
<div\s*id="tv-video"\s*data-video-source="youtube"\s*
|
||||||
data-video-meta="([^"]+)"''', webpage, u'video metadata')
|
data-video-meta="([^"]+)"''', webpage, 'video metadata')
|
||||||
|
|
||||||
data = json.loads(data_json)
|
data = json.loads(data_json)
|
||||||
|
|
||||||
|
61
youtube_dl/extractor/normalboots.py
Normal file
61
youtube_dl/extractor/normalboots.py
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
from ..utils import (
|
||||||
|
ExtractorError,
|
||||||
|
unified_strdate,
|
||||||
|
)
|
||||||
|
|
||||||
|
class NormalbootsIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'(?:http://)?(?:www\.)?normalboots\.com/video/(?P<videoid>[0-9a-z-]*)/?$'
|
||||||
|
_TEST = {
|
||||||
|
u'url': u'http://normalboots.com/video/home-alone-games-jontron/',
|
||||||
|
u'file': u'home-alone-games-jontron.mp4',
|
||||||
|
u'md5': u'8bf6de238915dd501105b44ef5f1e0f6',
|
||||||
|
u'info_dict': {
|
||||||
|
u'title': u'Home Alone Games - JonTron - NormalBoots',
|
||||||
|
u'description': u'Jon is late for Christmas. Typical. Thanks to: Paul Ritchey for Co-Writing/Filming: http://www.youtube.com/user/ContinueShow Michael Azzi for Christmas Intro Animation: http://michafrar.tumblr.com/ Jerrod Waters for Christmas Intro Music: http://www.youtube.com/user/xXJerryTerryXx Casey Ormond for \u2018Tense Battle Theme\u2019:\xa0http://www.youtube.com/Kiamet/',
|
||||||
|
u'uploader': u'JonTron',
|
||||||
|
u'upload_date': u'20140125',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
if mobj is None:
|
||||||
|
raise ExtractorError(u'Invalid URL: %s' % url)
|
||||||
|
video_id = mobj.group('videoid')
|
||||||
|
|
||||||
|
info = {
|
||||||
|
'id': video_id,
|
||||||
|
'uploader': None,
|
||||||
|
'upload_date': None,
|
||||||
|
}
|
||||||
|
|
||||||
|
if url[:4] != 'http':
|
||||||
|
url = 'http://' + url
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
video_title = self._og_search_title(webpage)
|
||||||
|
video_description = self._og_search_description(webpage)
|
||||||
|
video_thumbnail = self._og_search_thumbnail(webpage)
|
||||||
|
video_uploader = self._html_search_regex(r'Posted\sby\s<a\shref="[A-Za-z0-9/]*">(?P<uploader>[A-Za-z]*)\s</a>',
|
||||||
|
webpage, 'uploader')
|
||||||
|
raw_upload_date = self._html_search_regex('<span style="text-transform:uppercase; font-size:inherit;">[A-Za-z]+, (?P<date>.*)</span>',
|
||||||
|
webpage, 'date')
|
||||||
|
video_upload_date = unified_strdate(raw_upload_date)
|
||||||
|
video_upload_date = unified_strdate(raw_upload_date)
|
||||||
|
|
||||||
|
player_url = self._html_search_regex(r'<iframe\swidth="[0-9]+"\sheight="[0-9]+"\ssrc="(?P<url>[\S]+)"', webpage, 'url')
|
||||||
|
player_page = self._download_webpage(player_url, video_id)
|
||||||
|
video_url = u'http://player.screenwavemedia.com/' + self._html_search_regex(r"'file':\s'(?P<file>[0-9A-Za-z-_\.]+)'", player_page, 'file')
|
||||||
|
|
||||||
|
info['url'] = video_url
|
||||||
|
info['title'] = video_title
|
||||||
|
info['description'] = video_description
|
||||||
|
info['thumbnail'] = video_thumbnail
|
||||||
|
info['uploader'] = video_uploader
|
||||||
|
info['upload_date'] = video_upload_date
|
||||||
|
|
||||||
|
return info
|
@ -19,7 +19,8 @@ class NovamovIE(InfoExtractor):
|
|||||||
'info_dict': {
|
'info_dict': {
|
||||||
'title': 'search engine optimization',
|
'title': 'search engine optimization',
|
||||||
'description': 'search engine optimization is used to rank the web page in the google search engine'
|
'description': 'search engine optimization is used to rank the web page in the google search engine'
|
||||||
}
|
},
|
||||||
|
'skip': '"Invalid token" errors abound (in web interface as well as youtube-dl, there is nothing we can do about it.)'
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
|
49
youtube_dl/extractor/nowness.py
Normal file
49
youtube_dl/extractor/nowness.py
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .brightcove import BrightcoveIE
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
ExtractorError,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class NownessIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?nowness\.com/[^?#]*?/(?P<id>[0-9]+)/(?P<slug>[^/]+?)(?:$|[?#])'
|
||||||
|
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://www.nowness.com/day/2013/6/27/3131/candor--the-art-of-gesticulation',
|
||||||
|
'file': '2520295746001.mp4',
|
||||||
|
'md5': '0ece2f70a7bd252c7b00f3070182d418',
|
||||||
|
'info_dict': {
|
||||||
|
'description': 'Candor: The Art of Gesticulation',
|
||||||
|
'uploader': 'Nowness',
|
||||||
|
'title': 'Candor: The Art of Gesticulation',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('slug')
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
player_url = self._search_regex(
|
||||||
|
r'"([^"]+/content/issue-[0-9.]+.js)"', webpage, 'player URL')
|
||||||
|
real_id = self._search_regex(
|
||||||
|
r'\sdata-videoId="([0-9]+)"', webpage, 'internal video ID')
|
||||||
|
|
||||||
|
player_code = self._download_webpage(
|
||||||
|
player_url, video_id,
|
||||||
|
note='Downloading player JavaScript',
|
||||||
|
errnote='Player download failed')
|
||||||
|
player_code = player_code.replace("'+d+'", real_id)
|
||||||
|
|
||||||
|
bc_url = BrightcoveIE._extract_brightcove_url(player_code)
|
||||||
|
if bc_url is None:
|
||||||
|
raise ExtractorError('Could not find player definition')
|
||||||
|
return {
|
||||||
|
'_type': 'url',
|
||||||
|
'url': bc_url,
|
||||||
|
'ie_key': 'Brightcove',
|
||||||
|
}
|
@ -5,7 +5,7 @@ from .common import InfoExtractor
|
|||||||
from ..utils import unescapeHTML
|
from ..utils import unescapeHTML
|
||||||
|
|
||||||
class OoyalaIE(InfoExtractor):
|
class OoyalaIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://.+?\.ooyala\.com/.*?embedCode=(?P<id>.+?)(&|$)'
|
_VALID_URL = r'https?://.+?\.ooyala\.com/.*?(?:embedCode|ec)=(?P<id>.+?)(&|$)'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
# From http://it.slashdot.org/story/13/04/25/178216/recovering-data-from-broken-hard-drives-and-ssds-video
|
# From http://it.slashdot.org/story/13/04/25/178216/recovering-data-from-broken-hard-drives-and-ssds-video
|
||||||
|
@ -1,34 +1,68 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import json
|
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
class PBSIE(InfoExtractor):
|
class PBSIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://video\.pbs\.org/video/(?P<id>\d+)/?'
|
_VALID_URL = r'''(?x)https?://
|
||||||
|
(?:
|
||||||
|
# Direct video URL
|
||||||
|
video\.pbs\.org/video/(?P<id>[0-9]+)/? |
|
||||||
|
# Article with embedded player
|
||||||
|
(?:www\.)?pbs\.org/(?:[^/]+/){2,5}(?P<presumptive_id>[^/]+)/?(?:$|[?\#]) |
|
||||||
|
# Player
|
||||||
|
video\.pbs\.org/partnerplayer/(?P<player_id>[^/]+)/
|
||||||
|
)
|
||||||
|
'''
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://video.pbs.org/video/2365006249/',
|
'url': 'http://www.pbs.org/tpt/constitution-usa-peter-sagal/watch/a-more-perfect-union/',
|
||||||
u'file': u'2365006249.mp4',
|
'md5': 'ce1888486f0908d555a8093cac9a7362',
|
||||||
u'md5': 'ce1888486f0908d555a8093cac9a7362',
|
'info_dict': {
|
||||||
u'info_dict': {
|
'id': '2365006249',
|
||||||
u'title': u'A More Perfect Union',
|
'ext': 'mp4',
|
||||||
u'description': u'md5:ba0c207295339c8d6eced00b7c363c6a',
|
'title': 'A More Perfect Union',
|
||||||
u'duration': 3190,
|
'description': 'md5:ba0c207295339c8d6eced00b7c363c6a',
|
||||||
|
'duration': 3190,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
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')
|
|
||||||
|
presumptive_id = mobj.group('presumptive_id')
|
||||||
|
display_id = presumptive_id
|
||||||
|
if presumptive_id:
|
||||||
|
webpage = self._download_webpage(url, display_id)
|
||||||
|
url = self._search_regex(
|
||||||
|
r'<iframe\s+id=["\']partnerPlayer["\'].*?\s+src=["\'](.*?)["\']>',
|
||||||
|
webpage, 'player URL')
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
|
||||||
|
player_id = mobj.group('player_id')
|
||||||
|
if not display_id:
|
||||||
|
display_id = player_id
|
||||||
|
if player_id:
|
||||||
|
player_page = self._download_webpage(
|
||||||
|
url, display_id, note='Downloading player page',
|
||||||
|
errnote='Could not download player page')
|
||||||
|
video_id = self._search_regex(
|
||||||
|
r'<div\s+id="video_([0-9]+)"', player_page, 'video ID')
|
||||||
|
else:
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
display_id = video_id
|
||||||
|
|
||||||
info_url = 'http://video.pbs.org/videoInfo/%s?format=json' % video_id
|
info_url = 'http://video.pbs.org/videoInfo/%s?format=json' % video_id
|
||||||
info_page = self._download_webpage(info_url, video_id)
|
info = self._download_json(info_url, display_id)
|
||||||
info =json.loads(info_page)
|
|
||||||
return {'id': video_id,
|
return {
|
||||||
'title': info['title'],
|
'id': video_id,
|
||||||
'url': info['alternate_encoding']['url'],
|
'title': info['title'],
|
||||||
'ext': 'mp4',
|
'url': info['alternate_encoding']['url'],
|
||||||
'description': info['program'].get('description'),
|
'ext': 'mp4',
|
||||||
'thumbnail': info.get('image_url'),
|
'description': info['program'].get('description'),
|
||||||
'duration': info.get('duration'),
|
'thumbnail': info.get('image_url'),
|
||||||
}
|
'duration': info.get('duration'),
|
||||||
|
}
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
@ -7,12 +9,12 @@ from ..utils import compat_urllib_parse
|
|||||||
class PornHdIE(InfoExtractor):
|
class PornHdIE(InfoExtractor):
|
||||||
_VALID_URL = r'(?:http://)?(?:www\.)?pornhd\.com/(?:[a-z]{2,4}/)?videos/(?P<video_id>[0-9]+)/(?P<video_title>.+)'
|
_VALID_URL = r'(?:http://)?(?:www\.)?pornhd\.com/(?:[a-z]{2,4}/)?videos/(?P<video_id>[0-9]+)/(?P<video_title>.+)'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.pornhd.com/videos/1962/sierra-day-gets-his-cum-all-over-herself-hd-porn-video',
|
'url': 'http://www.pornhd.com/videos/1962/sierra-day-gets-his-cum-all-over-herself-hd-porn-video',
|
||||||
u'file': u'1962.flv',
|
'file': '1962.flv',
|
||||||
u'md5': u'35272469887dca97abd30abecc6cdf75',
|
'md5': '35272469887dca97abd30abecc6cdf75',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"title": u"sierra-day-gets-his-cum-all-over-herself-hd-porn-video",
|
"title": "sierra-day-gets-his-cum-all-over-herself-hd-porn-video",
|
||||||
u"age_limit": 18,
|
"age_limit": 18,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,9 +26,13 @@ class PornHdIE(InfoExtractor):
|
|||||||
|
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
video_url = self._html_search_regex(
|
next_url = self._html_search_regex(
|
||||||
r'&hd=(http.+?)&', webpage, u'video URL')
|
r'&hd=(http.+?)&', webpage, 'video URL')
|
||||||
video_url = compat_urllib_parse.unquote(video_url)
|
next_url = compat_urllib_parse.unquote(next_url)
|
||||||
|
|
||||||
|
video_url = self._download_webpage(
|
||||||
|
next_url, video_id, note='Retrieving video URL',
|
||||||
|
errnote='Could not retrieve video URL')
|
||||||
age_limit = 18
|
age_limit = 18
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
|
# encoding: utf-8
|
||||||
|
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 (
|
||||||
compat_urllib_parse_urlparse,
|
|
||||||
|
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -12,16 +13,17 @@ from ..utils import (
|
|||||||
class RBMARadioIE(InfoExtractor):
|
class RBMARadioIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?rbmaradio\.com/shows/(?P<videoID>[^/]+)$'
|
_VALID_URL = r'https?://(?:www\.)?rbmaradio\.com/shows/(?P<videoID>[^/]+)$'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.rbmaradio.com/shows/ford-lopatin-live-at-primavera-sound-2011',
|
'url': 'http://www.rbmaradio.com/shows/ford-lopatin-live-at-primavera-sound-2011',
|
||||||
u'file': u'ford-lopatin-live-at-primavera-sound-2011.mp3',
|
'md5': '6bc6f9bcb18994b4c983bc3bf4384d95',
|
||||||
u'md5': u'6bc6f9bcb18994b4c983bc3bf4384d95',
|
'info_dict': {
|
||||||
u'info_dict': {
|
'id': 'ford-lopatin-live-at-primavera-sound-2011',
|
||||||
u"uploader_id": u"ford-lopatin",
|
'ext': 'mp3',
|
||||||
u"location": u"Spain",
|
"uploader_id": "ford-lopatin",
|
||||||
u"description": u"Joel Ford and Daniel \u2019Oneohtrix Point Never\u2019 Lopatin fly their midified pop extravaganza to Spain. Live at Primavera Sound 2011.",
|
"location": "Spain",
|
||||||
u"uploader": u"Ford & Lopatin",
|
"description": "Joel Ford and Daniel ’Oneohtrix Point Never’ Lopatin fly their midified pop extravaganza to Spain. Live at Primavera Sound 2011.",
|
||||||
u"title": u"Live at Primavera Sound 2011"
|
"uploader": "Ford & Lopatin",
|
||||||
}
|
"title": "Live at Primavera Sound 2011",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@ -31,26 +33,23 @@ class RBMARadioIE(InfoExtractor):
|
|||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
json_data = self._search_regex(r'window\.gon.*?gon\.show=(.+?);$',
|
json_data = self._search_regex(r'window\.gon.*?gon\.show=(.+?);$',
|
||||||
webpage, u'json data', flags=re.MULTILINE)
|
webpage, 'json data', flags=re.MULTILINE)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
data = json.loads(json_data)
|
data = json.loads(json_data)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
raise ExtractorError(u'Invalid JSON: ' + str(e))
|
raise ExtractorError('Invalid JSON: ' + str(e))
|
||||||
|
|
||||||
video_url = data['akamai_url'] + '&cbr=256'
|
video_url = data['akamai_url'] + '&cbr=256'
|
||||||
url_parts = compat_urllib_parse_urlparse(video_url)
|
|
||||||
video_ext = url_parts.path.rpartition('.')[2]
|
return {
|
||||||
info = {
|
'id': video_id,
|
||||||
'id': video_id,
|
'url': video_url,
|
||||||
'url': video_url,
|
'title': data['title'],
|
||||||
'ext': video_ext,
|
'description': data.get('teaser_text'),
|
||||||
'title': data['title'],
|
'location': data.get('country_of_origin'),
|
||||||
'description': data.get('teaser_text'),
|
'uploader': data.get('host', {}).get('name'),
|
||||||
'location': data.get('country_of_origin'),
|
'uploader_id': data.get('host', {}).get('slug'),
|
||||||
'uploader': data.get('host', {}).get('name'),
|
'thumbnail': data.get('image', {}).get('large_url_2x'),
|
||||||
'uploader_id': data.get('host', {}).get('slug'),
|
'duration': data.get('duration'),
|
||||||
'thumbnail': data.get('image', {}).get('large_url_2x'),
|
|
||||||
'duration': data.get('duration'),
|
|
||||||
}
|
}
|
||||||
return [info]
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
@ -11,12 +13,12 @@ class Ro220IE(InfoExtractor):
|
|||||||
IE_NAME = '220.ro'
|
IE_NAME = '220.ro'
|
||||||
_VALID_URL = r'(?x)(?:https?://)?(?:www\.)?220\.ro/(?P<category>[^/]+)/(?P<shorttitle>[^/]+)/(?P<video_id>[^/]+)'
|
_VALID_URL = r'(?x)(?:https?://)?(?:www\.)?220\.ro/(?P<category>[^/]+)/(?P<shorttitle>[^/]+)/(?P<video_id>[^/]+)'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u"url": u"http://www.220.ro/sport/Luati-Le-Banii-Sez-4-Ep-1/LYV6doKo7f/",
|
"url": "http://www.220.ro/sport/Luati-Le-Banii-Sez-4-Ep-1/LYV6doKo7f/",
|
||||||
u'file': u'LYV6doKo7f.mp4',
|
'file': 'LYV6doKo7f.mp4',
|
||||||
u'md5': u'03af18b73a07b4088753930db7a34add',
|
'md5': '03af18b73a07b4088753930db7a34add',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"title": u"Luati-le Banii sez 4 ep 1",
|
"title": "Luati-le Banii sez 4 ep 1",
|
||||||
u"description": u"Iata-ne reveniti dupa o binemeritata vacanta. Va astept si pe Facebook cu pareri si comentarii.",
|
"description": "Iata-ne reveniti dupa o binemeritata vacanta. Va astept si pe Facebook cu pareri si comentarii.",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,10 +29,10 @@ class Ro220IE(InfoExtractor):
|
|||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
flashVars_str = self._search_regex(
|
flashVars_str = self._search_regex(
|
||||||
r'<param name="flashVars" value="([^"]+)"',
|
r'<param name="flashVars" value="([^"]+)"',
|
||||||
webpage, u'flashVars')
|
webpage, 'flashVars')
|
||||||
flashVars = compat_parse_qs(flashVars_str)
|
flashVars = compat_parse_qs(flashVars_str)
|
||||||
|
|
||||||
info = {
|
return {
|
||||||
'_type': 'video',
|
'_type': 'video',
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
@ -39,4 +41,3 @@ class Ro220IE(InfoExtractor):
|
|||||||
'description': clean_html(flashVars['desc'][0]),
|
'description': clean_html(flashVars['desc'][0]),
|
||||||
'thumbnail': flashVars['preview'][0],
|
'thumbnail': flashVars['preview'][0],
|
||||||
}
|
}
|
||||||
return info
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from .videodetective import VideoDetectiveIE
|
from .videodetective import VideoDetectiveIE
|
||||||
|
|
||||||
|
|
||||||
@ -7,10 +9,10 @@ class RottenTomatoesIE(VideoDetectiveIE):
|
|||||||
_VALID_URL = r'https?://www\.rottentomatoes\.com/m/[^/]+/trailers/(?P<id>\d+)'
|
_VALID_URL = r'https?://www\.rottentomatoes\.com/m/[^/]+/trailers/(?P<id>\d+)'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.rottentomatoes.com/m/toy_story_3/trailers/11028566/',
|
'url': 'http://www.rottentomatoes.com/m/toy_story_3/trailers/11028566/',
|
||||||
u'file': '613340.mp4',
|
'file': '613340.mp4',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'TOY STORY 3',
|
'title': 'TOY STORY 3',
|
||||||
u'description': u'From the creators of the beloved TOY STORY films, comes a story that will reunite the gang in a whole new way.',
|
'description': 'From the creators of the beloved TOY STORY films, comes a story that will reunite the gang in a whole new way.',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
@ -12,78 +15,77 @@ class RTLnowIE(InfoExtractor):
|
|||||||
"""Information Extractor for RTL NOW, RTL2 NOW, RTL NITRO, SUPER RTL NOW, VOX NOW and n-tv NOW"""
|
"""Information Extractor for RTL NOW, RTL2 NOW, RTL NITRO, SUPER RTL NOW, VOX NOW and n-tv NOW"""
|
||||||
_VALID_URL = r'(?:http://)?(?P<url>(?P<domain>rtl-now\.rtl\.de|rtl2now\.rtl2\.de|(?:www\.)?voxnow\.de|(?:www\.)?rtlnitronow\.de|(?:www\.)?superrtlnow\.de|(?:www\.)?n-tvnow\.de)/+[a-zA-Z0-9-]+/[a-zA-Z0-9-]+\.php\?(?:container_id|film_id)=(?P<video_id>[0-9]+)&player=1(?:&season=[0-9]+)?(?:&.*)?)'
|
_VALID_URL = r'(?:http://)?(?P<url>(?P<domain>rtl-now\.rtl\.de|rtl2now\.rtl2\.de|(?:www\.)?voxnow\.de|(?:www\.)?rtlnitronow\.de|(?:www\.)?superrtlnow\.de|(?:www\.)?n-tvnow\.de)/+[a-zA-Z0-9-]+/[a-zA-Z0-9-]+\.php\?(?:container_id|film_id)=(?P<video_id>[0-9]+)&player=1(?:&season=[0-9]+)?(?:&.*)?)'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
u'url': u'http://rtl-now.rtl.de/ahornallee/folge-1.php?film_id=90419&player=1&season=1',
|
'url': 'http://rtl-now.rtl.de/ahornallee/folge-1.php?film_id=90419&player=1&season=1',
|
||||||
u'file': u'90419.flv',
|
'file': '90419.flv',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'upload_date': u'20070416',
|
'upload_date': '20070416',
|
||||||
u'title': u'Ahornallee - Folge 1 - Der Einzug',
|
'title': 'Ahornallee - Folge 1 - Der Einzug',
|
||||||
u'description': u'Folge 1 - Der Einzug',
|
'description': 'Folge 1 - Der Einzug',
|
||||||
},
|
},
|
||||||
u'params': {
|
'params': {
|
||||||
u'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
u'skip': u'Only works from Germany',
|
'skip': 'Only works from Germany',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
u'url': u'http://rtl2now.rtl2.de/aerger-im-revier/episode-15-teil-1.php?film_id=69756&player=1&season=2&index=5',
|
'url': 'http://rtl2now.rtl2.de/aerger-im-revier/episode-15-teil-1.php?film_id=69756&player=1&season=2&index=5',
|
||||||
u'file': u'69756.flv',
|
'file': '69756.flv',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'upload_date': u'20120519',
|
'upload_date': '20120519',
|
||||||
u'title': u'Ärger im Revier - Ein junger Ladendieb, ein handfester Streit...',
|
'title': 'Ärger im Revier - Ein junger Ladendieb, ein handfester Streit...',
|
||||||
u'description': u'Ärger im Revier - Ein junger Ladendieb, ein handfester Streit u.a.',
|
'description': 'Ärger im Revier - Ein junger Ladendieb, ein handfester Streit u.a.',
|
||||||
u'thumbnail': u'http://autoimg.static-fra.de/rtl2now/219850/1500x1500/image2.jpg',
|
'thumbnail': 'http://autoimg.static-fra.de/rtl2now/219850/1500x1500/image2.jpg',
|
||||||
},
|
},
|
||||||
u'params': {
|
'params': {
|
||||||
u'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
u'skip': u'Only works from Germany',
|
'skip': 'Only works from Germany',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
u'url': u'http://www.voxnow.de/voxtours/suedafrika-reporter-ii.php?film_id=13883&player=1&season=17',
|
'url': 'http://www.voxnow.de/voxtours/suedafrika-reporter-ii.php?film_id=13883&player=1&season=17',
|
||||||
u'file': u'13883.flv',
|
'file': '13883.flv',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'upload_date': u'20090627',
|
'upload_date': '20090627',
|
||||||
u'title': u'Voxtours - Südafrika-Reporter II',
|
'title': 'Voxtours - Südafrika-Reporter II',
|
||||||
u'description': u'Südafrika-Reporter II',
|
'description': 'Südafrika-Reporter II',
|
||||||
},
|
},
|
||||||
u'params': {
|
'params': {
|
||||||
u'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
u'url': u'http://superrtlnow.de/medicopter-117/angst.php?film_id=99205&player=1',
|
'url': 'http://superrtlnow.de/medicopter-117/angst.php?film_id=99205&player=1',
|
||||||
u'file': u'99205.flv',
|
'file': '99205.flv',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'upload_date': u'20080928',
|
'upload_date': '20080928',
|
||||||
u'title': u'Medicopter 117 - Angst!',
|
'title': 'Medicopter 117 - Angst!',
|
||||||
u'description': u'Angst!',
|
'description': 'Angst!',
|
||||||
u'thumbnail': u'http://autoimg.static-fra.de/superrtlnow/287529/1500x1500/image2.jpg'
|
'thumbnail': 'http://autoimg.static-fra.de/superrtlnow/287529/1500x1500/image2.jpg'
|
||||||
},
|
},
|
||||||
u'params': {
|
'params': {
|
||||||
u'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
u'url': u'http://www.n-tvnow.de/top-gear/episode-1-2013-01-01-00-00-00.php?film_id=124903&player=1&season=10',
|
'url': 'http://www.n-tvnow.de/top-gear/episode-1-2013-01-01-00-00-00.php?film_id=124903&player=1&season=10',
|
||||||
u'file': u'124903.flv',
|
'file': '124903.flv',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'upload_date': u'20130101',
|
'upload_date': '20130101',
|
||||||
u'title': u'Top Gear vom 01.01.2013',
|
'title': 'Top Gear vom 01.01.2013',
|
||||||
u'description': u'Episode 1',
|
'description': 'Episode 1',
|
||||||
},
|
},
|
||||||
u'params': {
|
'params': {
|
||||||
u'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
u'skip': u'Only works from Germany',
|
'skip': 'Only works from Germany',
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
def _real_extract(self,url):
|
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
|
||||||
webpage_url = u'http://' + mobj.group('url')
|
webpage_url = 'http://' + mobj.group('url')
|
||||||
video_page_url = u'http://' + mobj.group('domain') + u'/'
|
video_page_url = 'http://' + mobj.group('domain') + '/'
|
||||||
video_id = mobj.group(u'video_id')
|
video_id = mobj.group('video_id')
|
||||||
|
|
||||||
webpage = self._download_webpage(webpage_url, video_id)
|
webpage = self._download_webpage(webpage_url, video_id)
|
||||||
|
|
||||||
@ -94,51 +96,53 @@ class RTLnowIE(InfoExtractor):
|
|||||||
msg = clean_html(note_m.group(1))
|
msg = clean_html(note_m.group(1))
|
||||||
raise ExtractorError(msg)
|
raise ExtractorError(msg)
|
||||||
|
|
||||||
video_title = self._html_search_regex(r'<title>(?P<title>[^<]+?)( \| [^<]*)?</title>',
|
video_title = self._html_search_regex(
|
||||||
webpage, u'title')
|
r'<title>(?P<title>[^<]+?)( \| [^<]*)?</title>',
|
||||||
playerdata_url = self._html_search_regex(r'\'playerdata\': \'(?P<playerdata_url>[^\']+)\'',
|
webpage, 'title')
|
||||||
webpage, u'playerdata_url')
|
playerdata_url = self._html_search_regex(
|
||||||
|
r'\'playerdata\': \'(?P<playerdata_url>[^\']+)\'',
|
||||||
|
webpage, 'playerdata_url')
|
||||||
|
|
||||||
playerdata = self._download_webpage(playerdata_url, video_id)
|
playerdata = self._download_webpage(playerdata_url, video_id)
|
||||||
mobj = re.search(r'<title><!\[CDATA\[(?P<description>.+?)(?:\s+- (?:Sendung )?vom (?P<upload_date_d>[0-9]{2})\.(?P<upload_date_m>[0-9]{2})\.(?:(?P<upload_date_Y>[0-9]{4})|(?P<upload_date_y>[0-9]{2})) [0-9]{2}:[0-9]{2} Uhr)?\]\]></title>', playerdata)
|
mobj = re.search(r'<title><!\[CDATA\[(?P<description>.+?)(?:\s+- (?:Sendung )?vom (?P<upload_date_d>[0-9]{2})\.(?P<upload_date_m>[0-9]{2})\.(?:(?P<upload_date_Y>[0-9]{4})|(?P<upload_date_y>[0-9]{2})) [0-9]{2}:[0-9]{2} Uhr)?\]\]></title>', playerdata)
|
||||||
if mobj:
|
if mobj:
|
||||||
video_description = mobj.group(u'description')
|
video_description = mobj.group('description')
|
||||||
if mobj.group('upload_date_Y'):
|
if mobj.group('upload_date_Y'):
|
||||||
video_upload_date = mobj.group('upload_date_Y')
|
video_upload_date = mobj.group('upload_date_Y')
|
||||||
elif mobj.group('upload_date_y'):
|
elif mobj.group('upload_date_y'):
|
||||||
video_upload_date = u'20' + mobj.group('upload_date_y')
|
video_upload_date = '20' + mobj.group('upload_date_y')
|
||||||
else:
|
else:
|
||||||
video_upload_date = None
|
video_upload_date = None
|
||||||
if video_upload_date:
|
if video_upload_date:
|
||||||
video_upload_date += mobj.group('upload_date_m')+mobj.group('upload_date_d')
|
video_upload_date += mobj.group('upload_date_m') + mobj.group('upload_date_d')
|
||||||
else:
|
else:
|
||||||
video_description = None
|
video_description = None
|
||||||
video_upload_date = None
|
video_upload_date = None
|
||||||
self._downloader.report_warning(u'Unable to extract description and upload date')
|
self._downloader.report_warning('Unable to extract description and upload date')
|
||||||
|
|
||||||
# Thumbnail: not every video has an thumbnail
|
# Thumbnail: not every video has an thumbnail
|
||||||
mobj = re.search(r'<meta property="og:image" content="(?P<thumbnail>[^"]+)">', webpage)
|
mobj = re.search(r'<meta property="og:image" content="(?P<thumbnail>[^"]+)">', webpage)
|
||||||
if mobj:
|
if mobj:
|
||||||
video_thumbnail = mobj.group(u'thumbnail')
|
video_thumbnail = mobj.group('thumbnail')
|
||||||
else:
|
else:
|
||||||
video_thumbnail = None
|
video_thumbnail = None
|
||||||
|
|
||||||
mobj = re.search(r'<filename [^>]+><!\[CDATA\[(?P<url>rtmpe://(?:[^/]+/){2})(?P<play_path>[^\]]+)\]\]></filename>', playerdata)
|
mobj = re.search(r'<filename [^>]+><!\[CDATA\[(?P<url>rtmpe://(?:[^/]+/){2})(?P<play_path>[^\]]+)\]\]></filename>', playerdata)
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
raise ExtractorError(u'Unable to extract media URL')
|
raise ExtractorError('Unable to extract media URL')
|
||||||
video_url = mobj.group(u'url')
|
video_url = mobj.group('url')
|
||||||
video_play_path = u'mp4:' + mobj.group(u'play_path')
|
video_play_path = 'mp4:' + mobj.group('play_path')
|
||||||
video_player_url = video_page_url + u'includes/vodplayer.swf'
|
video_player_url = video_page_url + 'includes/vodplayer.swf'
|
||||||
|
|
||||||
return [{
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
'play_path': video_play_path,
|
'play_path': video_play_path,
|
||||||
'page_url': video_page_url,
|
'page_url': video_page_url,
|
||||||
'player_url': video_player_url,
|
'player_url': video_player_url,
|
||||||
'ext': 'flv',
|
'ext': 'flv',
|
||||||
'title': video_title,
|
'title': video_title,
|
||||||
'description': video_description,
|
'description': video_description,
|
||||||
'upload_date': video_upload_date,
|
'upload_date': video_upload_date,
|
||||||
'thumbnail': video_thumbnail,
|
'thumbnail': video_thumbnail,
|
||||||
}]
|
}
|
||||||
|
@ -1,58 +1,124 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import json
|
import json
|
||||||
|
import itertools
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
compat_urlparse,
|
|
||||||
compat_str,
|
compat_str,
|
||||||
|
unified_strdate,
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class RutubeIE(InfoExtractor):
|
class RutubeIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://rutube\.ru/video/(?P<long_id>\w+)'
|
IE_NAME = 'rutube'
|
||||||
|
IE_DESC = 'Rutube videos'
|
||||||
|
_VALID_URL = r'https?://rutube\.ru/video/(?P<id>[\da-z]{32})'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://rutube.ru/video/3eac3b4561676c17df9132a9a1e62e3e/',
|
'url': 'http://rutube.ru/video/3eac3b4561676c17df9132a9a1e62e3e/',
|
||||||
u'file': u'3eac3b4561676c17df9132a9a1e62e3e.mp4',
|
'file': '3eac3b4561676c17df9132a9a1e62e3e.mp4',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'Раненный кенгуру забежал в аптеку',
|
'title': 'Раненный кенгуру забежал в аптеку',
|
||||||
u'uploader': u'NTDRussian',
|
'description': 'http://www.ntdtv.ru ',
|
||||||
u'uploader_id': u'29790',
|
'duration': 80,
|
||||||
|
'uploader': 'NTDRussian',
|
||||||
|
'uploader_id': '29790',
|
||||||
|
'upload_date': '20131016',
|
||||||
},
|
},
|
||||||
u'params': {
|
'params': {
|
||||||
# It requires ffmpeg (m3u8 download)
|
# It requires ffmpeg (m3u8 download)
|
||||||
u'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_api_response(self, short_id, subpath):
|
|
||||||
api_url = 'http://rutube.ru/api/play/%s/%s/?format=json' % (subpath, short_id)
|
|
||||||
response_json = self._download_webpage(api_url, short_id,
|
|
||||||
u'Downloading %s json' % subpath)
|
|
||||||
return json.loads(response_json)
|
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
long_id = mobj.group('long_id')
|
video_id = mobj.group('id')
|
||||||
webpage = self._download_webpage(url, long_id)
|
|
||||||
og_video = self._og_search_video_url(webpage)
|
api_response = self._download_webpage('http://rutube.ru/api/video/%s/?format=json' % video_id,
|
||||||
short_id = compat_urlparse.urlparse(og_video).path[1:]
|
video_id, 'Downloading video JSON')
|
||||||
options = self._get_api_response(short_id, 'options')
|
video = json.loads(api_response)
|
||||||
trackinfo = self._get_api_response(short_id, 'trackinfo')
|
|
||||||
|
api_response = self._download_webpage('http://rutube.ru/api/play/trackinfo/%s/?format=json' % video_id,
|
||||||
|
video_id, 'Downloading trackinfo JSON')
|
||||||
|
trackinfo = json.loads(api_response)
|
||||||
|
|
||||||
# Some videos don't have the author field
|
# Some videos don't have the author field
|
||||||
author = trackinfo.get('author') or {}
|
author = trackinfo.get('author') or {}
|
||||||
m3u8_url = trackinfo['video_balancer'].get('m3u8')
|
m3u8_url = trackinfo['video_balancer'].get('m3u8')
|
||||||
if m3u8_url is None:
|
if m3u8_url is None:
|
||||||
raise ExtractorError(u'Couldn\'t find m3u8 manifest url')
|
raise ExtractorError('Couldn\'t find m3u8 manifest url')
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': trackinfo['id'],
|
'id': video['id'],
|
||||||
'title': trackinfo['title'],
|
'title': video['title'],
|
||||||
|
'description': video['description'],
|
||||||
|
'duration': video['duration'],
|
||||||
|
'view_count': video['hits'],
|
||||||
'url': m3u8_url,
|
'url': m3u8_url,
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'thumbnail': options['thumbnail_url'],
|
'thumbnail': video['thumbnail_url'],
|
||||||
'uploader': author.get('name'),
|
'uploader': author.get('name'),
|
||||||
'uploader_id': compat_str(author['id']) if author else None,
|
'uploader_id': compat_str(author['id']) if author else None,
|
||||||
|
'upload_date': unified_strdate(video['created_ts']),
|
||||||
|
'age_limit': 18 if video['is_adult'] else 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class RutubeChannelIE(InfoExtractor):
|
||||||
|
IE_NAME = 'rutube:channel'
|
||||||
|
IE_DESC = 'Rutube channels'
|
||||||
|
_VALID_URL = r'http://rutube\.ru/tags/video/(?P<id>\d+)'
|
||||||
|
|
||||||
|
_PAGE_TEMPLATE = 'http://rutube.ru/api/tags/video/%s/?page=%s&format=json'
|
||||||
|
|
||||||
|
def _extract_videos(self, channel_id, channel_title=None):
|
||||||
|
entries = []
|
||||||
|
for pagenum in itertools.count(1):
|
||||||
|
api_response = self._download_webpage(
|
||||||
|
self._PAGE_TEMPLATE % (channel_id, pagenum),
|
||||||
|
channel_id, 'Downloading page %s' % pagenum)
|
||||||
|
page = json.loads(api_response)
|
||||||
|
results = page['results']
|
||||||
|
if not results:
|
||||||
|
break
|
||||||
|
entries.extend(self.url_result(result['video_url'], 'Rutube') for result in results)
|
||||||
|
if not page['has_next']:
|
||||||
|
break
|
||||||
|
return self.playlist_result(entries, channel_id, channel_title)
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
channel_id = mobj.group('id')
|
||||||
|
return self._extract_videos(channel_id)
|
||||||
|
|
||||||
|
|
||||||
|
class RutubeMovieIE(RutubeChannelIE):
|
||||||
|
IE_NAME = 'rutube:movie'
|
||||||
|
IE_DESC = 'Rutube movies'
|
||||||
|
_VALID_URL = r'http://rutube\.ru/metainfo/tv/(?P<id>\d+)'
|
||||||
|
|
||||||
|
_MOVIE_TEMPLATE = 'http://rutube.ru/api/metainfo/tv/%s/?format=json'
|
||||||
|
_PAGE_TEMPLATE = 'http://rutube.ru/api/metainfo/tv/%s/video?page=%s&format=json'
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
movie_id = mobj.group('id')
|
||||||
|
api_response = self._download_webpage(
|
||||||
|
self._MOVIE_TEMPLATE % movie_id, movie_id,
|
||||||
|
'Downloading movie JSON')
|
||||||
|
movie = json.loads(api_response)
|
||||||
|
movie_name = movie['name']
|
||||||
|
return self._extract_videos(movie_id, movie_name)
|
||||||
|
|
||||||
|
|
||||||
|
class RutubePersonIE(RutubeChannelIE):
|
||||||
|
IE_NAME = 'rutube:person'
|
||||||
|
IE_DESC = 'Rutube person videos'
|
||||||
|
_VALID_URL = r'http://rutube\.ru/video/person/(?P<id>\d+)'
|
||||||
|
|
||||||
|
_PAGE_TEMPLATE = 'http://rutube.ru/api/video/person/%s/?page=%s&format=json'
|
||||||
|
@ -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,5 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import os.path
|
import os.path
|
||||||
import re
|
import re
|
||||||
@ -16,76 +17,76 @@ from ..utils import (
|
|||||||
|
|
||||||
|
|
||||||
class SmotriIE(InfoExtractor):
|
class SmotriIE(InfoExtractor):
|
||||||
IE_DESC = u'Smotri.com'
|
IE_DESC = 'Smotri.com'
|
||||||
IE_NAME = u'smotri'
|
IE_NAME = 'smotri'
|
||||||
_VALID_URL = r'^https?://(?:www\.)?(?P<url>smotri\.com/video/view/\?id=(?P<videoid>v(?P<realvideoid>[0-9]+)[a-z0-9]{4}))'
|
_VALID_URL = r'^https?://(?:www\.)?(?P<url>smotri\.com/video/view/\?id=(?P<videoid>v(?P<realvideoid>[0-9]+)[a-z0-9]{4}))'
|
||||||
|
|
||||||
_TESTS = [
|
_TESTS = [
|
||||||
# real video id 2610366
|
# real video id 2610366
|
||||||
{
|
{
|
||||||
u'url': u'http://smotri.com/video/view/?id=v261036632ab',
|
'url': 'http://smotri.com/video/view/?id=v261036632ab',
|
||||||
u'file': u'v261036632ab.mp4',
|
'file': 'v261036632ab.mp4',
|
||||||
u'md5': u'2a7b08249e6f5636557579c368040eb9',
|
'md5': '2a7b08249e6f5636557579c368040eb9',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'катастрофа с камер видеонаблюдения',
|
'title': 'катастрофа с камер видеонаблюдения',
|
||||||
u'uploader': u'rbc2008',
|
'uploader': 'rbc2008',
|
||||||
u'uploader_id': u'rbc08',
|
'uploader_id': 'rbc08',
|
||||||
u'upload_date': u'20131118',
|
'upload_date': '20131118',
|
||||||
u'description': u'катастрофа с камер видеонаблюдения, видео катастрофа с камер видеонаблюдения',
|
'description': 'катастрофа с камер видеонаблюдения, видео катастрофа с камер видеонаблюдения',
|
||||||
u'thumbnail': u'http://frame6.loadup.ru/8b/a9/2610366.3.3.jpg',
|
'thumbnail': 'http://frame6.loadup.ru/8b/a9/2610366.3.3.jpg',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
# real video id 57591
|
# real video id 57591
|
||||||
{
|
{
|
||||||
u'url': u'http://smotri.com/video/view/?id=v57591cb20',
|
'url': 'http://smotri.com/video/view/?id=v57591cb20',
|
||||||
u'file': u'v57591cb20.flv',
|
'file': 'v57591cb20.flv',
|
||||||
u'md5': u'830266dfc21f077eac5afd1883091bcd',
|
'md5': '830266dfc21f077eac5afd1883091bcd',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'test',
|
'title': 'test',
|
||||||
u'uploader': u'Support Photofile@photofile',
|
'uploader': 'Support Photofile@photofile',
|
||||||
u'uploader_id': u'support-photofile',
|
'uploader_id': 'support-photofile',
|
||||||
u'upload_date': u'20070704',
|
'upload_date': '20070704',
|
||||||
u'description': u'test, видео test',
|
'description': 'test, видео test',
|
||||||
u'thumbnail': u'http://frame4.loadup.ru/03/ed/57591.2.3.jpg',
|
'thumbnail': 'http://frame4.loadup.ru/03/ed/57591.2.3.jpg',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
# video-password
|
# video-password
|
||||||
{
|
{
|
||||||
u'url': u'http://smotri.com/video/view/?id=v1390466a13c',
|
'url': 'http://smotri.com/video/view/?id=v1390466a13c',
|
||||||
u'file': u'v1390466a13c.mp4',
|
'file': 'v1390466a13c.mp4',
|
||||||
u'md5': u'f6331cef33cad65a0815ee482a54440b',
|
'md5': 'f6331cef33cad65a0815ee482a54440b',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'TOCCA_A_NOI_-_LE_COSE_NON_VANNO_CAMBIAMOLE_ORA-1',
|
'title': 'TOCCA_A_NOI_-_LE_COSE_NON_VANNO_CAMBIAMOLE_ORA-1',
|
||||||
u'uploader': u'timoxa40',
|
'uploader': 'timoxa40',
|
||||||
u'uploader_id': u'timoxa40',
|
'uploader_id': 'timoxa40',
|
||||||
u'upload_date': u'20100404',
|
'upload_date': '20100404',
|
||||||
u'thumbnail': u'http://frame7.loadup.ru/af/3f/1390466.3.3.jpg',
|
'thumbnail': 'http://frame7.loadup.ru/af/3f/1390466.3.3.jpg',
|
||||||
u'description': u'TOCCA_A_NOI_-_LE_COSE_NON_VANNO_CAMBIAMOLE_ORA-1, видео TOCCA_A_NOI_-_LE_COSE_NON_VANNO_CAMBIAMOLE_ORA-1',
|
'description': 'TOCCA_A_NOI_-_LE_COSE_NON_VANNO_CAMBIAMOLE_ORA-1, видео TOCCA_A_NOI_-_LE_COSE_NON_VANNO_CAMBIAMOLE_ORA-1',
|
||||||
},
|
},
|
||||||
u'params': {
|
'params': {
|
||||||
u'videopassword': u'qwerty',
|
'videopassword': 'qwerty',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
# age limit + video-password
|
# age limit + video-password
|
||||||
{
|
{
|
||||||
u'url': u'http://smotri.com/video/view/?id=v15408898bcf',
|
'url': 'http://smotri.com/video/view/?id=v15408898bcf',
|
||||||
u'file': u'v15408898bcf.flv',
|
'file': 'v15408898bcf.flv',
|
||||||
u'md5': u'91e909c9f0521adf5ee86fbe073aad70',
|
'md5': '91e909c9f0521adf5ee86fbe073aad70',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'этот ролик не покажут по ТВ',
|
'title': 'этот ролик не покажут по ТВ',
|
||||||
u'uploader': u'zzxxx',
|
'uploader': 'zzxxx',
|
||||||
u'uploader_id': u'ueggb',
|
'uploader_id': 'ueggb',
|
||||||
u'upload_date': u'20101001',
|
'upload_date': '20101001',
|
||||||
u'thumbnail': u'http://frame3.loadup.ru/75/75/1540889.1.3.jpg',
|
'thumbnail': 'http://frame3.loadup.ru/75/75/1540889.1.3.jpg',
|
||||||
u'age_limit': 18,
|
'age_limit': 18,
|
||||||
u'description': u'этот ролик не покажут по ТВ, видео этот ролик не покажут по ТВ',
|
'description': 'этот ролик не покажут по ТВ, видео этот ролик не покажут по ТВ',
|
||||||
},
|
},
|
||||||
u'params': {
|
'params': {
|
||||||
u'videopassword': u'333'
|
'videopassword': '333'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
_SUCCESS = 0
|
_SUCCESS = 0
|
||||||
_PASSWORD_NOT_VERIFIED = 1
|
_PASSWORD_NOT_VERIFIED = 1
|
||||||
_PASSWORD_DETECTED = 2
|
_PASSWORD_DETECTED = 2
|
||||||
@ -106,71 +107,71 @@ class SmotriIE(InfoExtractor):
|
|||||||
|
|
||||||
# Download video JSON data
|
# Download video JSON data
|
||||||
video_json_url = 'http://smotri.com/vt.php?id=%s' % real_video_id
|
video_json_url = 'http://smotri.com/vt.php?id=%s' % real_video_id
|
||||||
video_json_page = self._download_webpage(video_json_url, video_id, u'Downloading video JSON')
|
video_json_page = self._download_webpage(video_json_url, video_id, 'Downloading video JSON')
|
||||||
video_json = json.loads(video_json_page)
|
video_json = json.loads(video_json_page)
|
||||||
|
|
||||||
status = video_json['status']
|
status = video_json['status']
|
||||||
if status == self._VIDEO_NOT_FOUND:
|
if status == self._VIDEO_NOT_FOUND:
|
||||||
raise ExtractorError(u'Video %s does not exist' % video_id, expected=True)
|
raise ExtractorError('Video %s does not exist' % video_id, expected=True)
|
||||||
elif status == self._PASSWORD_DETECTED: # The video is protected by a password, retry with
|
elif status == self._PASSWORD_DETECTED: # The video is protected by a password, retry with
|
||||||
# video-password set
|
# video-password set
|
||||||
video_password = self._downloader.params.get('videopassword', None)
|
video_password = self._downloader.params.get('videopassword', None)
|
||||||
if not video_password:
|
if not video_password:
|
||||||
raise ExtractorError(u'This video is protected by a password, use the --video-password option', expected=True)
|
raise ExtractorError('This video is protected by a password, use the --video-password option', expected=True)
|
||||||
video_json_url += '&md5pass=%s' % hashlib.md5(video_password.encode('utf-8')).hexdigest()
|
video_json_url += '&md5pass=%s' % hashlib.md5(video_password.encode('utf-8')).hexdigest()
|
||||||
video_json_page = self._download_webpage(video_json_url, video_id, u'Downloading video JSON (video-password set)')
|
video_json_page = self._download_webpage(video_json_url, video_id, 'Downloading video JSON (video-password set)')
|
||||||
video_json = json.loads(video_json_page)
|
video_json = json.loads(video_json_page)
|
||||||
status = video_json['status']
|
status = video_json['status']
|
||||||
if status == self._PASSWORD_NOT_VERIFIED:
|
if status == self._PASSWORD_NOT_VERIFIED:
|
||||||
raise ExtractorError(u'Video password is invalid', expected=True)
|
raise ExtractorError('Video password is invalid', expected=True)
|
||||||
|
|
||||||
if status != self._SUCCESS:
|
if status != self._SUCCESS:
|
||||||
raise ExtractorError(u'Unexpected status value %s' % status)
|
raise ExtractorError('Unexpected status value %s' % status)
|
||||||
|
|
||||||
# Extract the URL of the video
|
# Extract the URL of the video
|
||||||
video_url = video_json['file_data']
|
video_url = video_json['file_data']
|
||||||
|
|
||||||
# Video JSON does not provide enough meta data
|
# Video JSON does not provide enough meta data
|
||||||
# We will extract some from the video web page instead
|
# We will extract some from the video web page instead
|
||||||
video_page_url = 'http://' + mobj.group('url')
|
video_page_url = 'http://' + mobj.group('url')
|
||||||
video_page = self._download_webpage(video_page_url, video_id, u'Downloading video page')
|
video_page = self._download_webpage(video_page_url, video_id, 'Downloading video page')
|
||||||
|
|
||||||
# Warning if video is unavailable
|
# Warning if video is unavailable
|
||||||
warning = self._html_search_regex(
|
warning = self._html_search_regex(
|
||||||
r'<div class="videoUnModer">(.*?)</div>', video_page,
|
r'<div class="videoUnModer">(.*?)</div>', video_page,
|
||||||
u'warning message', default=None)
|
'warning message', default=None)
|
||||||
if warning is not None:
|
if warning is not None:
|
||||||
self._downloader.report_warning(
|
self._downloader.report_warning(
|
||||||
u'Video %s may not be available; smotri said: %s ' %
|
'Video %s may not be available; smotri said: %s ' %
|
||||||
(video_id, warning))
|
(video_id, warning))
|
||||||
|
|
||||||
# Adult content
|
# Adult content
|
||||||
if re.search(u'EroConfirmText">', video_page) is not None:
|
if re.search('EroConfirmText">', video_page) is not None:
|
||||||
self.report_age_confirmation()
|
self.report_age_confirmation()
|
||||||
confirm_string = self._html_search_regex(
|
confirm_string = self._html_search_regex(
|
||||||
r'<a href="/video/view/\?id=%s&confirm=([^"]+)" title="[^"]+">' % video_id,
|
r'<a href="/video/view/\?id=%s&confirm=([^"]+)" title="[^"]+">' % video_id,
|
||||||
video_page, u'confirm string')
|
video_page, 'confirm string')
|
||||||
confirm_url = video_page_url + '&confirm=%s' % confirm_string
|
confirm_url = video_page_url + '&confirm=%s' % confirm_string
|
||||||
video_page = self._download_webpage(confirm_url, video_id, u'Downloading video page (age confirmed)')
|
video_page = self._download_webpage(confirm_url, video_id, 'Downloading video page (age confirmed)')
|
||||||
adult_content = True
|
adult_content = True
|
||||||
else:
|
else:
|
||||||
adult_content = False
|
adult_content = False
|
||||||
|
|
||||||
# Extract the rest of meta data
|
# Extract the rest of meta data
|
||||||
video_title = self._search_meta(u'name', video_page, u'title')
|
video_title = self._search_meta('name', video_page, 'title')
|
||||||
if not video_title:
|
if not video_title:
|
||||||
video_title = os.path.splitext(url_basename(video_url))[0]
|
video_title = os.path.splitext(url_basename(video_url))[0]
|
||||||
|
|
||||||
video_description = self._search_meta(u'description', video_page)
|
video_description = self._search_meta('description', video_page)
|
||||||
END_TEXT = u' на сайте Smotri.com'
|
END_TEXT = ' на сайте Smotri.com'
|
||||||
if video_description and video_description.endswith(END_TEXT):
|
if video_description and video_description.endswith(END_TEXT):
|
||||||
video_description = video_description[:-len(END_TEXT)]
|
video_description = video_description[:-len(END_TEXT)]
|
||||||
START_TEXT = u'Смотреть онлайн ролик '
|
START_TEXT = 'Смотреть онлайн ролик '
|
||||||
if video_description and video_description.startswith(START_TEXT):
|
if video_description and video_description.startswith(START_TEXT):
|
||||||
video_description = video_description[len(START_TEXT):]
|
video_description = video_description[len(START_TEXT):]
|
||||||
video_thumbnail = self._search_meta(u'thumbnail', video_page)
|
video_thumbnail = self._search_meta('thumbnail', video_page)
|
||||||
|
|
||||||
upload_date_str = self._search_meta(u'uploadDate', video_page, u'upload date')
|
upload_date_str = self._search_meta('uploadDate', video_page, 'upload date')
|
||||||
if upload_date_str:
|
if upload_date_str:
|
||||||
upload_date_m = re.search(r'(?P<year>\d{4})\.(?P<month>\d{2})\.(?P<day>\d{2})T', upload_date_str)
|
upload_date_m = re.search(r'(?P<year>\d{4})\.(?P<month>\d{2})\.(?P<day>\d{2})T', upload_date_str)
|
||||||
video_upload_date = (
|
video_upload_date = (
|
||||||
@ -183,8 +184,8 @@ class SmotriIE(InfoExtractor):
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
video_upload_date = None
|
video_upload_date = None
|
||||||
|
|
||||||
duration_str = self._search_meta(u'duration', video_page)
|
duration_str = self._search_meta('duration', video_page)
|
||||||
if duration_str:
|
if duration_str:
|
||||||
duration_m = re.search(r'T(?P<hours>[0-9]{2})H(?P<minutes>[0-9]{2})M(?P<seconds>[0-9]{2})S', duration_str)
|
duration_m = re.search(r'T(?P<hours>[0-9]{2})H(?P<minutes>[0-9]{2})M(?P<seconds>[0-9]{2})S', duration_str)
|
||||||
video_duration = (
|
video_duration = (
|
||||||
@ -197,19 +198,19 @@ class SmotriIE(InfoExtractor):
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
video_duration = None
|
video_duration = None
|
||||||
|
|
||||||
video_uploader = self._html_search_regex(
|
video_uploader = self._html_search_regex(
|
||||||
u'<div class="DescrUser"><div>Автор.*?onmouseover="popup_user_info[^"]+">(.*?)</a>',
|
'<div class="DescrUser"><div>Автор.*?onmouseover="popup_user_info[^"]+">(.*?)</a>',
|
||||||
video_page, u'uploader', fatal=False, flags=re.MULTILINE|re.DOTALL)
|
video_page, 'uploader', fatal=False, flags=re.MULTILINE|re.DOTALL)
|
||||||
|
|
||||||
video_uploader_id = self._html_search_regex(
|
video_uploader_id = self._html_search_regex(
|
||||||
u'<div class="DescrUser"><div>Автор.*?onmouseover="popup_user_info\\(.*?\'([^\']+)\'\\);">',
|
'<div class="DescrUser"><div>Автор.*?onmouseover="popup_user_info\\(.*?\'([^\']+)\'\\);">',
|
||||||
video_page, u'uploader id', fatal=False, flags=re.MULTILINE|re.DOTALL)
|
video_page, 'uploader id', fatal=False, flags=re.MULTILINE|re.DOTALL)
|
||||||
|
|
||||||
video_view_count = self._html_search_regex(
|
video_view_count = self._html_search_regex(
|
||||||
u'Общее количество просмотров.*?<span class="Number">(\\d+)</span>',
|
'Общее количество просмотров.*?<span class="Number">(\\d+)</span>',
|
||||||
video_page, u'view count', fatal=False, flags=re.MULTILINE|re.DOTALL)
|
video_page, 'view count', fatal=False, flags=re.MULTILINE|re.DOTALL)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
@ -227,8 +228,8 @@ class SmotriIE(InfoExtractor):
|
|||||||
|
|
||||||
|
|
||||||
class SmotriCommunityIE(InfoExtractor):
|
class SmotriCommunityIE(InfoExtractor):
|
||||||
IE_DESC = u'Smotri.com community videos'
|
IE_DESC = 'Smotri.com community videos'
|
||||||
IE_NAME = u'smotri:community'
|
IE_NAME = 'smotri:community'
|
||||||
_VALID_URL = r'^https?://(?:www\.)?smotri\.com/community/video/(?P<communityid>[0-9A-Za-z_\'-]+)'
|
_VALID_URL = r'^https?://(?:www\.)?smotri\.com/community/video/(?P<communityid>[0-9A-Za-z_\'-]+)'
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@ -236,21 +237,21 @@ class SmotriCommunityIE(InfoExtractor):
|
|||||||
community_id = mobj.group('communityid')
|
community_id = mobj.group('communityid')
|
||||||
|
|
||||||
url = 'http://smotri.com/export/rss/video/by/community/-/%s/video.xml' % community_id
|
url = 'http://smotri.com/export/rss/video/by/community/-/%s/video.xml' % community_id
|
||||||
rss = self._download_xml(url, community_id, u'Downloading community RSS')
|
rss = self._download_xml(url, community_id, 'Downloading community RSS')
|
||||||
|
|
||||||
entries = [self.url_result(video_url.text, 'Smotri')
|
entries = [self.url_result(video_url.text, 'Smotri')
|
||||||
for video_url in rss.findall('./channel/item/link')]
|
for video_url in rss.findall('./channel/item/link')]
|
||||||
|
|
||||||
description_text = rss.find('./channel/description').text
|
description_text = rss.find('./channel/description').text
|
||||||
community_title = self._html_search_regex(
|
community_title = self._html_search_regex(
|
||||||
u'^Видео сообщества "([^"]+)"$', description_text, u'community title')
|
'^Видео сообщества "([^"]+)"$', description_text, 'community title')
|
||||||
|
|
||||||
return self.playlist_result(entries, community_id, community_title)
|
return self.playlist_result(entries, community_id, community_title)
|
||||||
|
|
||||||
|
|
||||||
class SmotriUserIE(InfoExtractor):
|
class SmotriUserIE(InfoExtractor):
|
||||||
IE_DESC = u'Smotri.com user videos'
|
IE_DESC = 'Smotri.com user videos'
|
||||||
IE_NAME = u'smotri:user'
|
IE_NAME = 'smotri:user'
|
||||||
_VALID_URL = r'^https?://(?:www\.)?smotri\.com/user/(?P<userid>[0-9A-Za-z_\'-]+)'
|
_VALID_URL = r'^https?://(?:www\.)?smotri\.com/user/(?P<userid>[0-9A-Za-z_\'-]+)'
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@ -258,22 +259,22 @@ class SmotriUserIE(InfoExtractor):
|
|||||||
user_id = mobj.group('userid')
|
user_id = mobj.group('userid')
|
||||||
|
|
||||||
url = 'http://smotri.com/export/rss/user/video/-/%s/video.xml' % user_id
|
url = 'http://smotri.com/export/rss/user/video/-/%s/video.xml' % user_id
|
||||||
rss = self._download_xml(url, user_id, u'Downloading user RSS')
|
rss = self._download_xml(url, user_id, 'Downloading user RSS')
|
||||||
|
|
||||||
entries = [self.url_result(video_url.text, 'Smotri')
|
entries = [self.url_result(video_url.text, 'Smotri')
|
||||||
for video_url in rss.findall('./channel/item/link')]
|
for video_url in rss.findall('./channel/item/link')]
|
||||||
|
|
||||||
description_text = rss.find('./channel/description').text
|
description_text = rss.find('./channel/description').text
|
||||||
user_nickname = self._html_search_regex(
|
user_nickname = self._html_search_regex(
|
||||||
u'^Видео режиссера (.*)$', description_text,
|
'^Видео режиссера (.*)$', description_text,
|
||||||
u'user nickname')
|
'user nickname')
|
||||||
|
|
||||||
return self.playlist_result(entries, user_id, user_nickname)
|
return self.playlist_result(entries, user_id, user_nickname)
|
||||||
|
|
||||||
|
|
||||||
class SmotriBroadcastIE(InfoExtractor):
|
class SmotriBroadcastIE(InfoExtractor):
|
||||||
IE_DESC = u'Smotri.com broadcasts'
|
IE_DESC = 'Smotri.com broadcasts'
|
||||||
IE_NAME = u'smotri:broadcast'
|
IE_NAME = 'smotri:broadcast'
|
||||||
_VALID_URL = r'^https?://(?:www\.)?(?P<url>smotri\.com/live/(?P<broadcastid>[^/]+))/?.*'
|
_VALID_URL = r'^https?://(?:www\.)?(?P<url>smotri\.com/live/(?P<broadcastid>[^/]+))/?.*'
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@ -281,46 +282,40 @@ class SmotriBroadcastIE(InfoExtractor):
|
|||||||
broadcast_id = mobj.group('broadcastid')
|
broadcast_id = mobj.group('broadcastid')
|
||||||
|
|
||||||
broadcast_url = 'http://' + mobj.group('url')
|
broadcast_url = 'http://' + mobj.group('url')
|
||||||
broadcast_page = self._download_webpage(broadcast_url, broadcast_id, u'Downloading broadcast page')
|
broadcast_page = self._download_webpage(broadcast_url, broadcast_id, 'Downloading broadcast page')
|
||||||
|
|
||||||
if re.search(u'>Режиссер с логином <br/>"%s"<br/> <span>не существует<' % broadcast_id, broadcast_page) is not None:
|
if re.search('>Режиссер с логином <br/>"%s"<br/> <span>не существует<' % broadcast_id, broadcast_page) is not None:
|
||||||
raise ExtractorError(u'Broadcast %s does not exist' % broadcast_id, expected=True)
|
raise ExtractorError('Broadcast %s does not exist' % broadcast_id, expected=True)
|
||||||
|
|
||||||
# Adult content
|
# Adult content
|
||||||
if re.search(u'EroConfirmText">', broadcast_page) is not None:
|
if re.search('EroConfirmText">', broadcast_page) is not None:
|
||||||
|
|
||||||
(username, password) = self._get_login_info()
|
(username, password) = self._get_login_info()
|
||||||
if username is None:
|
if username is None:
|
||||||
raise ExtractorError(u'Erotic broadcasts allowed only for registered users, '
|
raise ExtractorError('Erotic broadcasts allowed only for registered users, '
|
||||||
u'use --username and --password options to provide account credentials.', expected=True)
|
'use --username and --password options to provide account credentials.', expected=True)
|
||||||
|
|
||||||
# Log in
|
login_form = {
|
||||||
login_form_strs = {
|
'login-hint53': '1',
|
||||||
u'login-hint53': '1',
|
'confirm_erotic': '1',
|
||||||
u'confirm_erotic': '1',
|
'login': username,
|
||||||
u'login': username,
|
'password': password,
|
||||||
u'password': password,
|
|
||||||
}
|
}
|
||||||
# Convert to UTF-8 *before* urlencode because Python 2.x's urlencode
|
|
||||||
# chokes on unicode
|
|
||||||
login_form = dict((k.encode('utf-8'), v.encode('utf-8')) for k,v in login_form_strs.items())
|
|
||||||
login_data = compat_urllib_parse.urlencode(login_form).encode('utf-8')
|
|
||||||
login_url = broadcast_url + '/?no_redirect=1'
|
|
||||||
request = compat_urllib_request.Request(login_url, login_data)
|
|
||||||
request.add_header('Content-Type', 'application/x-www-form-urlencoded')
|
|
||||||
broadcast_page = self._download_webpage(
|
|
||||||
request, broadcast_id, note=u'Logging in and confirming age')
|
|
||||||
|
|
||||||
if re.search(u'>Неверный логин или пароль<', broadcast_page) is not None:
|
request = compat_urllib_request.Request(broadcast_url + '/?no_redirect=1', compat_urllib_parse.urlencode(login_form))
|
||||||
raise ExtractorError(u'Unable to log in: bad username or password', expected=True)
|
request.add_header('Content-Type', 'application/x-www-form-urlencoded')
|
||||||
|
broadcast_page = self._download_webpage(request, broadcast_id, 'Logging in and confirming age')
|
||||||
|
|
||||||
|
if re.search('>Неверный логин или пароль<', broadcast_page) is not None:
|
||||||
|
raise ExtractorError('Unable to log in: bad username or password', expected=True)
|
||||||
|
|
||||||
adult_content = True
|
adult_content = True
|
||||||
else:
|
else:
|
||||||
adult_content = False
|
adult_content = False
|
||||||
|
|
||||||
ticket = self._html_search_regex(
|
ticket = self._html_search_regex(
|
||||||
u'window\.broadcast_control\.addFlashVar\\(\'file\', \'([^\']+)\'\\);',
|
'window\.broadcast_control\.addFlashVar\\(\'file\', \'([^\']+)\'\\);',
|
||||||
broadcast_page, u'broadcast ticket')
|
broadcast_page, 'broadcast ticket')
|
||||||
|
|
||||||
url = 'http://smotri.com/broadcast/view/url/?ticket=%s' % ticket
|
url = 'http://smotri.com/broadcast/view/url/?ticket=%s' % ticket
|
||||||
|
|
||||||
@ -328,22 +323,22 @@ class SmotriBroadcastIE(InfoExtractor):
|
|||||||
if broadcast_password:
|
if broadcast_password:
|
||||||
url += '&pass=%s' % hashlib.md5(broadcast_password.encode('utf-8')).hexdigest()
|
url += '&pass=%s' % hashlib.md5(broadcast_password.encode('utf-8')).hexdigest()
|
||||||
|
|
||||||
broadcast_json_page = self._download_webpage(url, broadcast_id, u'Downloading broadcast JSON')
|
broadcast_json_page = self._download_webpage(url, broadcast_id, 'Downloading broadcast JSON')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
broadcast_json = json.loads(broadcast_json_page)
|
broadcast_json = json.loads(broadcast_json_page)
|
||||||
|
|
||||||
protected_broadcast = broadcast_json['_pass_protected'] == 1
|
protected_broadcast = broadcast_json['_pass_protected'] == 1
|
||||||
if protected_broadcast and not broadcast_password:
|
if protected_broadcast and not broadcast_password:
|
||||||
raise ExtractorError(u'This broadcast is protected by a password, use the --video-password option', expected=True)
|
raise ExtractorError('This broadcast is protected by a password, use the --video-password option', expected=True)
|
||||||
|
|
||||||
broadcast_offline = broadcast_json['is_play'] == 0
|
broadcast_offline = broadcast_json['is_play'] == 0
|
||||||
if broadcast_offline:
|
if broadcast_offline:
|
||||||
raise ExtractorError(u'Broadcast %s is offline' % broadcast_id, expected=True)
|
raise ExtractorError('Broadcast %s is offline' % broadcast_id, expected=True)
|
||||||
|
|
||||||
rtmp_url = broadcast_json['_server']
|
rtmp_url = broadcast_json['_server']
|
||||||
if not rtmp_url.startswith('rtmp://'):
|
if not rtmp_url.startswith('rtmp://'):
|
||||||
raise ExtractorError(u'Unexpected broadcast rtmp URL')
|
raise ExtractorError('Unexpected broadcast rtmp URL')
|
||||||
|
|
||||||
broadcast_playpath = broadcast_json['_streamName']
|
broadcast_playpath = broadcast_json['_streamName']
|
||||||
broadcast_thumbnail = broadcast_json['_imgURL']
|
broadcast_thumbnail = broadcast_json['_imgURL']
|
||||||
@ -354,8 +349,8 @@ class SmotriBroadcastIE(InfoExtractor):
|
|||||||
rtmp_conn = 'S:%s' % uuid.uuid4().hex
|
rtmp_conn = 'S:%s' % uuid.uuid4().hex
|
||||||
except KeyError:
|
except KeyError:
|
||||||
if protected_broadcast:
|
if protected_broadcast:
|
||||||
raise ExtractorError(u'Bad broadcast password', expected=True)
|
raise ExtractorError('Bad broadcast password', expected=True)
|
||||||
raise ExtractorError(u'Unexpected broadcast JSON')
|
raise ExtractorError('Unexpected broadcast JSON')
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': broadcast_id,
|
'id': broadcast_id,
|
||||||
|
@ -1,42 +1,36 @@
|
|||||||
import re
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from .mtv import MTVServicesInfoExtractor
|
from .mtv import MTVServicesInfoExtractor
|
||||||
|
|
||||||
|
|
||||||
class SouthParkStudiosIE(MTVServicesInfoExtractor):
|
class SouthParkStudiosIE(MTVServicesInfoExtractor):
|
||||||
IE_NAME = u'southparkstudios.com'
|
IE_NAME = 'southparkstudios.com'
|
||||||
_VALID_URL = r'(https?://)?(www\.)?(?P<url>southparkstudios\.com/(clips|full-episodes)/(?P<id>.+?)(\?|#|$))'
|
_VALID_URL = r'https?://(www\.)?(?P<url>southparkstudios\.com/(clips|full-episodes)/(?P<id>.+?)(\?|#|$))'
|
||||||
|
|
||||||
_FEED_URL = 'http://www.southparkstudios.com/feeds/video-player/mrss'
|
_FEED_URL = 'http://www.southparkstudios.com/feeds/video-player/mrss'
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
u'url': u'http://www.southparkstudios.com/clips/104437/bat-daded#tab=featured',
|
'url': 'http://www.southparkstudios.com/clips/104437/bat-daded#tab=featured',
|
||||||
u'file': u'a7bff6c2-ed00-11e0-aca6-0026b9414f30.mp4',
|
'info_dict': {
|
||||||
u'info_dict': {
|
'id': 'a7bff6c2-ed00-11e0-aca6-0026b9414f30',
|
||||||
u'title': u'Bat Daded',
|
'ext': 'mp4',
|
||||||
u'description': u'Randy disqualifies South Park by getting into a fight with Bat Dad.',
|
'title': 'Bat Daded',
|
||||||
|
'description': 'Randy disqualifies South Park by getting into a fight with Bat Dad.',
|
||||||
},
|
},
|
||||||
}]
|
}]
|
||||||
|
|
||||||
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 = 'southpark.de'
|
||||||
_VALID_URL = r'(https?://)?(www\.)?(?P<url>southpark\.de/(clips|alle-episoden)/(?P<id>.+?)(\?|#|$))'
|
_VALID_URL = r'https?://(www\.)?(?P<url>southpark\.de/(clips|alle-episoden)/(?P<id>.+?)(\?|#|$))'
|
||||||
_FEED_URL = 'http://www.southpark.de/feeds/video-player/mrss/'
|
_FEED_URL = 'http://www.southpark.de/feeds/video-player/mrss/'
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
u'url': u'http://www.southpark.de/clips/uygssh/the-government-wont-respect-my-privacy#tab=featured',
|
'url': 'http://www.southpark.de/clips/uygssh/the-government-wont-respect-my-privacy#tab=featured',
|
||||||
u'file': u'85487c96-b3b9-4e39-9127-ad88583d9bf2.mp4',
|
'info_dict': {
|
||||||
u'info_dict': {
|
'id': '85487c96-b3b9-4e39-9127-ad88583d9bf2',
|
||||||
u'title': u'The Government Won\'t Respect My Privacy',
|
'ext': 'mp4',
|
||||||
u'description': u'Cartman explains the benefits of "Shitter" to Stan, Kyle and Craig.',
|
'title': 'The Government Won\'t Respect My Privacy',
|
||||||
|
'description': 'Cartman explains the benefits of "Shitter" to Stan, Kyle and Craig.',
|
||||||
},
|
},
|
||||||
}]
|
}]
|
||||||
|
@ -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 re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
@ -6,20 +8,20 @@ from .common import InfoExtractor
|
|||||||
class SpiegelIE(InfoExtractor):
|
class SpiegelIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?spiegel\.de/video/[^/]*-(?P<videoID>[0-9]+)(?:\.html)?(?:#.*)?$'
|
_VALID_URL = r'https?://(?:www\.)?spiegel\.de/video/[^/]*-(?P<videoID>[0-9]+)(?:\.html)?(?:#.*)?$'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
u'url': u'http://www.spiegel.de/video/vulkan-tungurahua-in-ecuador-ist-wieder-aktiv-video-1259285.html',
|
'url': 'http://www.spiegel.de/video/vulkan-tungurahua-in-ecuador-ist-wieder-aktiv-video-1259285.html',
|
||||||
u'file': u'1259285.mp4',
|
'file': '1259285.mp4',
|
||||||
u'md5': u'2c2754212136f35fb4b19767d242f66e',
|
'md5': '2c2754212136f35fb4b19767d242f66e',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"title": u"Vulkanausbruch in Ecuador: Der \"Feuerschlund\" ist wieder aktiv"
|
'title': 'Vulkanausbruch in Ecuador: Der "Feuerschlund" ist wieder aktiv',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
u'url': u'http://www.spiegel.de/video/schach-wm-videoanalyse-des-fuenften-spiels-video-1309159.html',
|
'url': 'http://www.spiegel.de/video/schach-wm-videoanalyse-des-fuenften-spiels-video-1309159.html',
|
||||||
u'file': u'1309159.mp4',
|
'file': '1309159.mp4',
|
||||||
u'md5': u'f2cdf638d7aa47654e251e1aee360af1',
|
'md5': 'f2cdf638d7aa47654e251e1aee360af1',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'Schach-WM in der Videoanalyse: Carlsen nutzt die Fehlgriffe des Titelverteidigers'
|
'title': 'Schach-WM in der Videoanalyse: Carlsen nutzt die Fehlgriffe des Titelverteidigers',
|
||||||
}
|
},
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@ -29,17 +31,17 @@ class SpiegelIE(InfoExtractor):
|
|||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
video_title = self._html_search_regex(
|
video_title = self._html_search_regex(
|
||||||
r'<div class="module-title">(.*?)</div>', webpage, u'title')
|
r'<div class="module-title">(.*?)</div>', webpage, 'title')
|
||||||
|
|
||||||
xml_url = u'http://video2.spiegel.de/flash/' + video_id + u'.xml'
|
xml_url = 'http://video2.spiegel.de/flash/' + video_id + '.xml'
|
||||||
idoc = self._download_xml(
|
idoc = self._download_xml(
|
||||||
xml_url, video_id,
|
xml_url, video_id,
|
||||||
note=u'Downloading XML', errnote=u'Failed to download XML')
|
note='Downloading XML', errnote='Failed to download XML')
|
||||||
|
|
||||||
formats = [
|
formats = [
|
||||||
{
|
{
|
||||||
'format_id': n.tag.rpartition('type')[2],
|
'format_id': n.tag.rpartition('type')[2],
|
||||||
'url': u'http://video2.spiegel.de/flash/' + n.find('./filename').text,
|
'url': 'http://video2.spiegel.de/flash/' + n.find('./filename').text,
|
||||||
'width': int(n.find('./width').text),
|
'width': int(n.find('./width').text),
|
||||||
'height': int(n.find('./height').text),
|
'height': int(n.find('./height').text),
|
||||||
'abr': int(n.find('./audiobitrate').text),
|
'abr': int(n.find('./audiobitrate').text),
|
||||||
@ -55,10 +57,9 @@ class SpiegelIE(InfoExtractor):
|
|||||||
|
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
info = {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': video_title,
|
'title': video_title,
|
||||||
'duration': duration,
|
'duration': duration,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
}
|
}
|
||||||
return info
|
|
||||||
|
@ -1,36 +1,38 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
class StatigramIE(InfoExtractor):
|
class StatigramIE(InfoExtractor):
|
||||||
_VALID_URL = r'(?:http://)?(?:www\.)?statigr\.am/p/([^/]+)'
|
_VALID_URL = r'https?://(www\.)?statigr\.am/p/(?P<id>[^/]+)'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://statigr.am/p/522207370455279102_24101272',
|
'url': 'http://statigr.am/p/522207370455279102_24101272',
|
||||||
u'file': u'522207370455279102_24101272.mp4',
|
'md5': '6eb93b882a3ded7c378ee1d6884b1814',
|
||||||
u'md5': u'6eb93b882a3ded7c378ee1d6884b1814',
|
'info_dict': {
|
||||||
u'info_dict': {
|
'id': '522207370455279102_24101272',
|
||||||
u'uploader_id': u'aguynamedpatrick',
|
'ext': 'mp4',
|
||||||
u'title': u'Instagram photo by @aguynamedpatrick (Patrick Janelle)',
|
'uploader_id': 'aguynamedpatrick',
|
||||||
|
'title': 'Instagram photo by @aguynamedpatrick (Patrick Janelle)',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
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('id')
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
html_title = self._html_search_regex(
|
html_title = self._html_search_regex(
|
||||||
r'<title>(.+?)</title>',
|
r'<title>(.+?)</title>',
|
||||||
webpage, u'title')
|
webpage, 'title')
|
||||||
title = re.sub(r'(?: *\(Videos?\))? \| Statigram$', '', html_title)
|
title = re.sub(r'(?: *\(Videos?\))? \| Statigram$', '', html_title)
|
||||||
uploader_id = self._html_search_regex(
|
uploader_id = self._html_search_regex(
|
||||||
r'@([^ ]+)', title, u'uploader name', fatal=False)
|
r'@([^ ]+)', title, 'uploader name', fatal=False)
|
||||||
ext = 'mp4'
|
|
||||||
|
|
||||||
return [{
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'url': self._og_search_video_url(webpage),
|
'url': self._og_search_video_url(webpage),
|
||||||
'ext': ext,
|
'title': title,
|
||||||
'title': title,
|
|
||||||
'thumbnail': self._og_search_thumbnail(webpage),
|
'thumbnail': self._og_search_thumbnail(webpage),
|
||||||
'uploader_id' : uploader_id
|
'uploader_id': uploader_id
|
||||||
}]
|
}
|
||||||
|
@ -62,10 +62,13 @@ class SubtitlesInfoExtractor(InfoExtractor):
|
|||||||
subtitles[sub_lang] = subtitle
|
subtitles[sub_lang] = subtitle
|
||||||
return subtitles
|
return subtitles
|
||||||
|
|
||||||
|
def _download_subtitle_url(self, sub_lang, url):
|
||||||
|
return self._download_webpage(url, None, note=False)
|
||||||
|
|
||||||
def _request_subtitle_url(self, sub_lang, url):
|
def _request_subtitle_url(self, sub_lang, url):
|
||||||
""" makes the http request for the subtitle """
|
""" makes the http request for the subtitle """
|
||||||
try:
|
try:
|
||||||
sub = self._download_webpage(url, None, note=False)
|
sub = self._download_subtitle_url(sub_lang, url)
|
||||||
except ExtractorError as err:
|
except ExtractorError as err:
|
||||||
self._downloader.report_warning(u'unable to download video subtitles for %s: %s' % (sub_lang, compat_str(err)))
|
self._downloader.report_warning(u'unable to download video subtitles for %s: %s' % (sub_lang, compat_str(err)))
|
||||||
return
|
return
|
||||||
@ -79,7 +82,11 @@ class SubtitlesInfoExtractor(InfoExtractor):
|
|||||||
returns {sub_lang: url} or {} if not available
|
returns {sub_lang: url} or {} if not available
|
||||||
Must be redefined by the subclasses
|
Must be redefined by the subclasses
|
||||||
"""
|
"""
|
||||||
pass
|
|
||||||
|
# By default, allow implementations to simply pass in the result
|
||||||
|
assert isinstance(webpage, dict), \
|
||||||
|
'_get_available_subtitles not implemented'
|
||||||
|
return webpage
|
||||||
|
|
||||||
def _get_available_automatic_caption(self, video_id, webpage):
|
def _get_available_automatic_caption(self, video_id, webpage):
|
||||||
"""
|
"""
|
||||||
|
@ -1,22 +1,23 @@
|
|||||||
#coding: utf-8
|
#coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import determine_ext
|
||||||
determine_ext,
|
|
||||||
)
|
|
||||||
|
|
||||||
class ThisAVIE(InfoExtractor):
|
class ThisAVIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?thisav\.com/video/(?P<id>[0-9]+)/.*'
|
_VALID_URL = r'https?://(?:www\.)?thisav\.com/video/(?P<id>[0-9]+)/.*'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u"url": u"http://www.thisav.com/video/47734/%98%26sup1%3B%83%9E%83%82---just-fit.html",
|
'url': 'http://www.thisav.com/video/47734/%98%26sup1%3B%83%9E%83%82---just-fit.html',
|
||||||
u"file": u"47734.flv",
|
'md5': '0480f1ef3932d901f0e0e719f188f19b',
|
||||||
u"md5": u"0480f1ef3932d901f0e0e719f188f19b",
|
'info_dict': {
|
||||||
u"info_dict": {
|
'id': '47734',
|
||||||
u"title": u"高樹マリア - Just fit",
|
'ext': 'flv',
|
||||||
u"uploader": u"dj7970",
|
'title': '高樹マリア - Just fit',
|
||||||
u"uploader_id": u"dj7970"
|
'uploader': 'dj7970',
|
||||||
|
'uploader_id': 'dj7970'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,19 +26,18 @@ class ThisAVIE(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._html_search_regex(r'<h1>([^<]*)</h1>', webpage, u'title')
|
title = self._html_search_regex(r'<h1>([^<]*)</h1>', webpage, 'title')
|
||||||
video_url = self._html_search_regex(
|
video_url = self._html_search_regex(
|
||||||
r"addVariable\('file','([^']+)'\);", webpage, u'video url')
|
r"addVariable\('file','([^']+)'\);", webpage, 'video url')
|
||||||
uploader = self._html_search_regex(
|
uploader = self._html_search_regex(
|
||||||
r': <a href="http://www.thisav.com/user/[0-9]+/(?:[^"]+)">([^<]+)</a>',
|
r': <a href="http://www.thisav.com/user/[0-9]+/(?:[^"]+)">([^<]+)</a>',
|
||||||
webpage, u'uploader name', fatal=False)
|
webpage, 'uploader name', fatal=False)
|
||||||
uploader_id = self._html_search_regex(
|
uploader_id = self._html_search_regex(
|
||||||
r': <a href="http://www.thisav.com/user/[0-9]+/([^"]+)">(?:[^<]+)</a>',
|
r': <a href="http://www.thisav.com/user/[0-9]+/([^"]+)">(?:[^<]+)</a>',
|
||||||
webpage, u'uploader id', fatal=False)
|
webpage, 'uploader id', fatal=False)
|
||||||
ext = determine_ext(video_url)
|
ext = determine_ext(video_url)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'_type': 'video',
|
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
'uploader': uploader,
|
'uploader': uploader,
|
||||||
|
50
youtube_dl/extractor/tinypic.py
Normal file
50
youtube_dl/extractor/tinypic.py
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from youtube_dl.utils import ExtractorError
|
||||||
|
|
||||||
|
|
||||||
|
class TinyPicIE(InfoExtractor):
|
||||||
|
IE_NAME = 'tinypic'
|
||||||
|
IE_DESC = 'tinypic.com videos'
|
||||||
|
_VALID_URL = r'http://tinypic\.com/player\.php\?v=(?P<id>[^&]+)&s=\d+'
|
||||||
|
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://tinypic.com/player.php?v=6xw7tc%3E&s=5#.UtqZmbRFCM8',
|
||||||
|
'md5': '609b74432465364e72727ebc6203f044',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '6xw7tc',
|
||||||
|
'ext': 'flv',
|
||||||
|
'title': 'shadow phenomenon weird',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, video_id, 'Downloading page')
|
||||||
|
|
||||||
|
mobj = re.search(r'(?m)fo\.addVariable\("file",\s"(?P<fileid>[\da-z]+)"\);\n'
|
||||||
|
'\s+fo\.addVariable\("s",\s"(?P<serverid>\d+)"\);', webpage)
|
||||||
|
if mobj is None:
|
||||||
|
raise ExtractorError('Video %s does not exist' % video_id, expected=True)
|
||||||
|
|
||||||
|
file_id = mobj.group('fileid')
|
||||||
|
server_id = mobj.group('serverid')
|
||||||
|
|
||||||
|
KEYWORDS_SUFFIX = ', Video, images, photos, videos, myspace, ebay, video hosting, photo hosting'
|
||||||
|
keywords = self._html_search_meta('keywords', webpage, 'title')
|
||||||
|
title = keywords[:-len(KEYWORDS_SUFFIX)] if keywords.endswith(KEYWORDS_SUFFIX) else ''
|
||||||
|
|
||||||
|
video_url = 'http://v%s.tinypic.com/%s.flv' % (server_id, file_id)
|
||||||
|
thumbnail = 'http://v%s.tinypic.com/%s_th.jpg' % (server_id, file_id)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': file_id,
|
||||||
|
'url': video_url,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
'title': title
|
||||||
|
}
|
@ -1,4 +1,6 @@
|
|||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
@ -9,25 +11,25 @@ from ..utils import (
|
|||||||
|
|
||||||
|
|
||||||
class TouTvIE(InfoExtractor):
|
class TouTvIE(InfoExtractor):
|
||||||
IE_NAME = u'tou.tv'
|
IE_NAME = 'tou.tv'
|
||||||
_VALID_URL = r'https?://www\.tou\.tv/(?P<id>[a-zA-Z0-9_-]+(?:/(?P<episode>S[0-9]+E[0-9]+)))'
|
_VALID_URL = r'https?://www\.tou\.tv/(?P<id>[a-zA-Z0-9_-]+(?:/(?P<episode>S[0-9]+E[0-9]+)))'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.tou.tv/30-vies/S04E41',
|
'url': 'http://www.tou.tv/30-vies/S04E41',
|
||||||
u'file': u'30-vies_S04E41.mp4',
|
'file': '30-vies_S04E41.mp4',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'30 vies Saison 4 / Épisode 41',
|
'title': '30 vies Saison 4 / Épisode 41',
|
||||||
u'description': u'md5:da363002db82ccbe4dafeb9cab039b09',
|
'description': 'md5:da363002db82ccbe4dafeb9cab039b09',
|
||||||
u'age_limit': 8,
|
'age_limit': 8,
|
||||||
u'uploader': u'Groupe des Nouveaux Médias',
|
'uploader': 'Groupe des Nouveaux Médias',
|
||||||
u'duration': 1296,
|
'duration': 1296,
|
||||||
u'upload_date': u'20131118',
|
'upload_date': '20131118',
|
||||||
u'thumbnail': u'http://static.tou.tv/medias/images/2013-11-18_19_00_00_30VIES_0341_01_L.jpeg',
|
'thumbnail': 'http://static.tou.tv/medias/images/2013-11-18_19_00_00_30VIES_0341_01_L.jpeg',
|
||||||
},
|
},
|
||||||
u'params': {
|
'params': {
|
||||||
u'skip_download': True, # Requires rtmpdump
|
'skip_download': True, # Requires rtmpdump
|
||||||
},
|
},
|
||||||
u'skip': 'Only available in Canada'
|
'skip': 'Only available in Canada'
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@ -36,25 +38,25 @@ class TouTvIE(InfoExtractor):
|
|||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
mediaId = self._search_regex(
|
mediaId = self._search_regex(
|
||||||
r'"idMedia":\s*"([^"]+)"', webpage, u'media ID')
|
r'"idMedia":\s*"([^"]+)"', webpage, 'media ID')
|
||||||
|
|
||||||
streams_url = u'http://release.theplatform.com/content.select?pid=' + mediaId
|
streams_url = 'http://release.theplatform.com/content.select?pid=' + mediaId
|
||||||
streams_doc = self._download_xml(
|
streams_doc = self._download_xml(
|
||||||
streams_url, video_id, note=u'Downloading stream list')
|
streams_url, video_id, note='Downloading stream list')
|
||||||
|
|
||||||
video_url = next(n.text
|
video_url = next(n.text
|
||||||
for n in streams_doc.findall('.//choice/url')
|
for n in streams_doc.findall('.//choice/url')
|
||||||
if u'//ad.doubleclick' not in n.text)
|
if '//ad.doubleclick' not in n.text)
|
||||||
if video_url.endswith('/Unavailable.flv'):
|
if video_url.endswith('/Unavailable.flv'):
|
||||||
raise ExtractorError(
|
raise ExtractorError(
|
||||||
u'Access to this video is blocked from outside of Canada',
|
'Access to this video is blocked from outside of Canada',
|
||||||
expected=True)
|
expected=True)
|
||||||
|
|
||||||
duration_str = self._html_search_meta(
|
duration_str = self._html_search_meta(
|
||||||
'video:duration', webpage, u'duration')
|
'video:duration', webpage, 'duration')
|
||||||
duration = int(duration_str) if duration_str else None
|
duration = int(duration_str) if duration_str else None
|
||||||
upload_date_str = self._html_search_meta(
|
upload_date_str = self._html_search_meta(
|
||||||
'video:release_date', webpage, u'upload date')
|
'video:release_date', webpage, 'upload date')
|
||||||
upload_date = unified_strdate(upload_date_str) if upload_date_str else None
|
upload_date = unified_strdate(upload_date_str) if upload_date_str else None
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -1,17 +1,21 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
class TrailerAddictIE(InfoExtractor):
|
class TrailerAddictIE(InfoExtractor):
|
||||||
|
_WORKING = False
|
||||||
_VALID_URL = r'(?:http://)?(?:www\.)?traileraddict\.com/(?:trailer|clip)/(?P<movie>.+?)/(?P<trailer_name>.+)'
|
_VALID_URL = r'(?:http://)?(?:www\.)?traileraddict\.com/(?:trailer|clip)/(?P<movie>.+?)/(?P<trailer_name>.+)'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.traileraddict.com/trailer/prince-avalanche/trailer',
|
'url': 'http://www.traileraddict.com/trailer/prince-avalanche/trailer',
|
||||||
u'file': u'76184.mp4',
|
'md5': '41365557f3c8c397d091da510e73ceb4',
|
||||||
u'md5': u'57e39dbcf4142ceb8e1f242ff423fd71',
|
'info_dict': {
|
||||||
u'info_dict': {
|
'id': '76184',
|
||||||
u"title": u"Prince Avalanche Trailer",
|
'ext': 'mp4',
|
||||||
u"description": u"Trailer for Prince Avalanche.Two highway road workers spend the summer of 1988 away from their city lives. The isolated landscape becomes a place of misadventure as the men find themselves at odds with each other and the women they left behind."
|
'title': 'Prince Avalanche Trailer',
|
||||||
|
'description': 'Trailer for Prince Avalanche.\n\nTwo highway road workers spend the summer of 1988 away from their city lives. The isolated landscape becomes a place of misadventure as the men find themselves at odds with each other and the women they left behind.',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,9 +26,15 @@ class TrailerAddictIE(InfoExtractor):
|
|||||||
|
|
||||||
title = self._search_regex(r'<title>(.+?)</title>',
|
title = self._search_regex(r'<title>(.+?)</title>',
|
||||||
webpage, 'video title').replace(' - Trailer Addict','')
|
webpage, 'video title').replace(' - Trailer Addict','')
|
||||||
view_count = self._search_regex(r'Views: (.+?)<br />',
|
view_count_str = self._search_regex(
|
||||||
webpage, 'Views Count')
|
r'<span class="views_n">([0-9,.]+)</span>',
|
||||||
video_id = self._og_search_property('video', webpage, 'Video id').split('=')[1]
|
webpage, 'view count', fatal=False)
|
||||||
|
view_count = (
|
||||||
|
None if view_count_str is None
|
||||||
|
else int(view_count_str.replace(',', '')))
|
||||||
|
video_id = self._search_regex(
|
||||||
|
r'<param\s+name="movie"\s+value="/emb/([0-9]+)"\s*/>',
|
||||||
|
webpage, 'video id')
|
||||||
|
|
||||||
# Presence of (no)watchplus function indicates HD quality is available
|
# Presence of (no)watchplus function indicates HD quality is available
|
||||||
if re.search(r'function (no)?watchplus()', webpage):
|
if re.search(r'function (no)?watchplus()', webpage):
|
||||||
@ -39,14 +49,16 @@ class TrailerAddictIE(InfoExtractor):
|
|||||||
info_webpage, 'Download url').replace('%3F','?')
|
info_webpage, 'Download url').replace('%3F','?')
|
||||||
thumbnail_url = self._search_regex(r'&image=(.+?)&',
|
thumbnail_url = self._search_regex(r'&image=(.+?)&',
|
||||||
info_webpage, 'thumbnail url')
|
info_webpage, 'thumbnail url')
|
||||||
ext = final_url.split('.')[-1].split('?')[0]
|
|
||||||
|
|
||||||
return [{
|
description = self._html_search_regex(
|
||||||
'id' : video_id,
|
r'(?s)<div class="synopsis">.*?<div class="movie_label_info"[^>]*>(.*?)</div>',
|
||||||
'url' : final_url,
|
webpage, 'description', fatal=False)
|
||||||
'ext' : ext,
|
|
||||||
'title' : title,
|
return {
|
||||||
'thumbnail' : thumbnail_url,
|
'id': video_id,
|
||||||
'description' : self._og_search_description(webpage),
|
'url': final_url,
|
||||||
'view_count' : view_count,
|
'title': title,
|
||||||
}]
|
'thumbnail': thumbnail_url,
|
||||||
|
'description': description,
|
||||||
|
'view_count': view_count,
|
||||||
|
}
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
@ -7,13 +9,13 @@ from ..utils import (
|
|||||||
|
|
||||||
|
|
||||||
class TumblrIE(InfoExtractor):
|
class TumblrIE(InfoExtractor):
|
||||||
_VALID_URL = r'http://(?P<blog_name>.*?)\.tumblr\.com/((post)|(video))/(?P<id>\d*)/(.*?)'
|
_VALID_URL = r'http://(?P<blog_name>.*?)\.tumblr\.com/((post)|(video))/(?P<id>\d*)($|/)'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://tatianamaslanydaily.tumblr.com/post/54196191430/orphan-black-dvd-extra-behind-the-scenes',
|
'url': 'http://tatianamaslanydaily.tumblr.com/post/54196191430/orphan-black-dvd-extra-behind-the-scenes',
|
||||||
u'file': u'54196191430.mp4',
|
'file': '54196191430.mp4',
|
||||||
u'md5': u'479bb068e5b16462f5176a6828829767',
|
'md5': '479bb068e5b16462f5176a6828829767',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"title": u"tatiana maslany news"
|
"title": "tatiana maslany news"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,18 +30,20 @@ class TumblrIE(InfoExtractor):
|
|||||||
re_video = r'src=\\x22(?P<video_url>http://%s\.tumblr\.com/video_file/%s/(.*?))\\x22 type=\\x22video/(?P<ext>.*?)\\x22' % (blog, video_id)
|
re_video = r'src=\\x22(?P<video_url>http://%s\.tumblr\.com/video_file/%s/(.*?))\\x22 type=\\x22video/(?P<ext>.*?)\\x22' % (blog, video_id)
|
||||||
video = re.search(re_video, webpage)
|
video = re.search(re_video, webpage)
|
||||||
if video is None:
|
if video is None:
|
||||||
raise ExtractorError(u'Unable to extract video')
|
raise ExtractorError('Unable to extract video')
|
||||||
video_url = video.group('video_url')
|
video_url = video.group('video_url')
|
||||||
ext = video.group('ext')
|
ext = video.group('ext')
|
||||||
|
|
||||||
video_thumbnail = self._search_regex(r'posters(.*?)\[\\x22(?P<thumb>.*?)\\x22',
|
video_thumbnail = self._search_regex(
|
||||||
webpage, u'thumbnail', fatal=False) # We pick the first poster
|
r'posters.*?\[\\x22(.*?)\\x22',
|
||||||
if video_thumbnail: video_thumbnail = video_thumbnail.replace('\\', '')
|
webpage, 'thumbnail', fatal=False) # We pick the first poster
|
||||||
|
if video_thumbnail:
|
||||||
|
video_thumbnail = video_thumbnail.replace('\\\\/', '/')
|
||||||
|
|
||||||
# The only place where you can get a title, it's not complete,
|
# The only place where you can get a title, it's not complete,
|
||||||
# but searching in other places doesn't work for all videos
|
# but searching in other places doesn't work for all videos
|
||||||
video_title = self._html_search_regex(r'<title>(?P<title>.*?)(?: \| Tumblr)?</title>',
|
video_title = self._html_search_regex(r'<title>(?P<title>.*?)(?: \| Tumblr)?</title>',
|
||||||
webpage, u'title', flags=re.DOTALL)
|
webpage, 'title', flags=re.DOTALL)
|
||||||
|
|
||||||
return [{'id': video_id,
|
return [{'id': video_id,
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
import base64
|
import base64
|
||||||
import re
|
import re
|
||||||
|
|
||||||
@ -6,15 +7,16 @@ from ..utils import (
|
|||||||
compat_parse_qs,
|
compat_parse_qs,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class TutvIE(InfoExtractor):
|
class TutvIE(InfoExtractor):
|
||||||
_VALID_URL=r'https?://(?:www\.)?tu\.tv/videos/(?P<id>[^/?]+)'
|
_VALID_URL = r'https?://(?:www\.)?tu\.tv/videos/(?P<id>[^/?]+)'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://tu.tv/videos/noah-en-pabellon-cuahutemoc',
|
'url': 'http://tu.tv/videos/noah-en-pabellon-cuahutemoc',
|
||||||
u'file': u'2742556.flv',
|
'file': '2742556.flv',
|
||||||
u'md5': u'5eb766671f69b82e528dc1e7769c5cb2',
|
'md5': '5eb766671f69b82e528dc1e7769c5cb2',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"title": u"Noah en pabellon cuahutemoc"
|
'title': 'Noah en pabellon cuahutemoc',
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@ -22,18 +24,15 @@ class TutvIE(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)
|
||||||
internal_id = self._search_regex(r'codVideo=([0-9]+)', webpage, u'internal video ID')
|
internal_id = self._search_regex(r'codVideo=([0-9]+)', webpage, 'internal video ID')
|
||||||
|
|
||||||
data_url = u'http://tu.tv/flvurl.php?codVideo=' + str(internal_id)
|
data_url = 'http://tu.tv/flvurl.php?codVideo=' + str(internal_id)
|
||||||
data_content = self._download_webpage(data_url, video_id, note=u'Downloading video info')
|
data_content = self._download_webpage(data_url, video_id, note='Downloading video info')
|
||||||
data = compat_parse_qs(data_content)
|
data = compat_parse_qs(data_content)
|
||||||
video_url = base64.b64decode(data['kpt'][0]).decode('utf-8')
|
video_url = base64.b64decode(data['kpt'][0]).decode('utf-8')
|
||||||
ext = video_url.partition(u'?')[0].rpartition(u'.')[2]
|
|
||||||
|
|
||||||
info = {
|
return {
|
||||||
'id': internal_id,
|
'id': internal_id,
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
'ext': ext,
|
|
||||||
'title': self._og_search_title(webpage),
|
'title': self._og_search_title(webpage),
|
||||||
}
|
}
|
||||||
return [info]
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
|
|
||||||
@ -10,48 +12,48 @@ from ..utils import (
|
|||||||
|
|
||||||
class UstreamIE(InfoExtractor):
|
class UstreamIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://www\.ustream\.tv/recorded/(?P<videoID>\d+)'
|
_VALID_URL = r'https?://www\.ustream\.tv/recorded/(?P<videoID>\d+)'
|
||||||
IE_NAME = u'ustream'
|
IE_NAME = 'ustream'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.ustream.tv/recorded/20274954',
|
'url': 'http://www.ustream.tv/recorded/20274954',
|
||||||
u'file': u'20274954.flv',
|
'file': '20274954.flv',
|
||||||
u'md5': u'088f151799e8f572f84eb62f17d73e5c',
|
'md5': '088f151799e8f572f84eb62f17d73e5c',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"uploader": u"Young Americans for Liberty",
|
"uploader": "Young Americans for Liberty",
|
||||||
u"title": u"Young Americans for Liberty February 7, 2012 2:28 AM"
|
"title": "Young Americans for Liberty February 7, 2012 2:28 AM",
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
m = re.match(self._VALID_URL, url)
|
m = re.match(self._VALID_URL, url)
|
||||||
video_id = m.group('videoID')
|
video_id = m.group('videoID')
|
||||||
|
|
||||||
video_url = u'http://tcdn.ustream.tv/video/%s' % video_id
|
video_url = 'http://tcdn.ustream.tv/video/%s' % video_id
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
self.report_extraction(video_id)
|
self.report_extraction(video_id)
|
||||||
|
|
||||||
video_title = self._html_search_regex(r'data-title="(?P<title>.+)"',
|
video_title = self._html_search_regex(r'data-title="(?P<title>.+)"',
|
||||||
webpage, u'title')
|
webpage, 'title')
|
||||||
|
|
||||||
uploader = self._html_search_regex(r'data-content-type="channel".*?>(?P<uploader>.*?)</a>',
|
uploader = self._html_search_regex(r'data-content-type="channel".*?>(?P<uploader>.*?)</a>',
|
||||||
webpage, u'uploader', fatal=False, flags=re.DOTALL)
|
webpage, 'uploader', fatal=False, flags=re.DOTALL)
|
||||||
|
|
||||||
thumbnail = self._html_search_regex(r'<link rel="image_src" href="(?P<thumb>.*?)"',
|
thumbnail = self._html_search_regex(r'<link rel="image_src" href="(?P<thumb>.*?)"',
|
||||||
webpage, u'thumbnail', fatal=False)
|
webpage, 'thumbnail', fatal=False)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'url': video_url,
|
||||||
|
'ext': 'flv',
|
||||||
|
'title': video_title,
|
||||||
|
'uploader': uploader,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
}
|
||||||
|
|
||||||
info = {
|
|
||||||
'id': video_id,
|
|
||||||
'url': video_url,
|
|
||||||
'ext': 'flv',
|
|
||||||
'title': video_title,
|
|
||||||
'uploader': uploader,
|
|
||||||
'thumbnail': thumbnail,
|
|
||||||
}
|
|
||||||
return info
|
|
||||||
|
|
||||||
class UstreamChannelIE(InfoExtractor):
|
class UstreamChannelIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://www\.ustream\.tv/channel/(?P<slug>.+)'
|
_VALID_URL = r'https?://www\.ustream\.tv/channel/(?P<slug>.+)'
|
||||||
IE_NAME = u'ustream:channel'
|
IE_NAME = 'ustream:channel'
|
||||||
|
|
||||||
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,6 @@
|
|||||||
|
# encoding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
@ -10,45 +13,44 @@ from ..utils import (
|
|||||||
|
|
||||||
|
|
||||||
class Vbox7IE(InfoExtractor):
|
class Vbox7IE(InfoExtractor):
|
||||||
"""Information Extractor for Vbox7"""
|
_VALID_URL = r'http://(www\.)?vbox7\.com/play:(?P<id>[^/]+)'
|
||||||
_VALID_URL = r'(?:http://)?(?:www\.)?vbox7\.com/play:([^/]+)'
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://vbox7.com/play:249bb972c2',
|
'url': 'http://vbox7.com/play:249bb972c2',
|
||||||
u'file': u'249bb972c2.flv',
|
'md5': '99f65c0c9ef9b682b97313e052734c3f',
|
||||||
u'md5': u'99f65c0c9ef9b682b97313e052734c3f',
|
'info_dict': {
|
||||||
u'info_dict': {
|
'id': '249bb972c2',
|
||||||
u"title": u"\u0421\u043c\u044f\u0445! \u0427\u0443\u0434\u043e - \u0447\u0438\u0441\u0442 \u0437\u0430 \u0441\u0435\u043a\u0443\u043d\u0434\u0438 - \u0421\u043a\u0440\u0438\u0442\u0430 \u043a\u0430\u043c\u0435\u0440\u0430"
|
'ext': 'flv',
|
||||||
}
|
'title': 'Смях! Чудо - чист за секунди - Скрита камера',
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
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:
|
video_id = mobj.group('id')
|
||||||
raise ExtractorError(u'Invalid URL: %s' % url)
|
|
||||||
video_id = mobj.group(1)
|
|
||||||
|
|
||||||
redirect_page, urlh = self._download_webpage_handle(url, video_id)
|
redirect_page, urlh = self._download_webpage_handle(url, video_id)
|
||||||
new_location = self._search_regex(r'window\.location = \'(.*)\';', redirect_page, u'redirect location')
|
new_location = self._search_regex(r'window\.location = \'(.*)\';',
|
||||||
|
redirect_page, 'redirect location')
|
||||||
redirect_url = urlh.geturl() + new_location
|
redirect_url = urlh.geturl() + new_location
|
||||||
webpage = self._download_webpage(redirect_url, video_id, u'Downloading redirect page')
|
webpage = self._download_webpage(redirect_url, video_id,
|
||||||
|
'Downloading redirect page')
|
||||||
|
|
||||||
title = self._html_search_regex(r'<title>(.*)</title>',
|
title = self._html_search_regex(r'<title>(.*)</title>',
|
||||||
webpage, u'title').split('/')[0].strip()
|
webpage, 'title').split('/')[0].strip()
|
||||||
|
|
||||||
ext = "flv"
|
|
||||||
info_url = "http://vbox7.com/play/magare.do"
|
info_url = "http://vbox7.com/play/magare.do"
|
||||||
data = compat_urllib_parse.urlencode({'as3':'1','vid':video_id})
|
data = compat_urllib_parse.urlencode({'as3': '1', 'vid': video_id})
|
||||||
info_request = compat_urllib_request.Request(info_url, data)
|
info_request = compat_urllib_request.Request(info_url, data)
|
||||||
info_request.add_header('Content-Type', 'application/x-www-form-urlencoded')
|
info_request.add_header('Content-Type', 'application/x-www-form-urlencoded')
|
||||||
info_response = self._download_webpage(info_request, video_id, u'Downloading info webpage')
|
info_response = self._download_webpage(info_request, video_id, 'Downloading info webpage')
|
||||||
if info_response is None:
|
if info_response is None:
|
||||||
raise ExtractorError(u'Unable to extract the media url')
|
raise ExtractorError('Unable to extract the media url')
|
||||||
(final_url, thumbnail_url) = map(lambda x: x.split('=')[1], info_response.split('&'))
|
(final_url, thumbnail_url) = map(lambda x: x.split('=')[1], info_response.split('&'))
|
||||||
|
|
||||||
return [{
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'url': final_url,
|
'url': final_url,
|
||||||
'ext': ext,
|
'ext': 'flv',
|
||||||
'title': title,
|
'title': title,
|
||||||
'thumbnail': thumbnail_url,
|
'thumbnail': thumbnail_url,
|
||||||
}]
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import json
|
|
||||||
import xml.etree.ElementTree
|
import xml.etree.ElementTree
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
@ -22,16 +23,16 @@ class VevoIE(InfoExtractor):
|
|||||||
vevo:)
|
vevo:)
|
||||||
(?P<id>[^&?#]+)'''
|
(?P<id>[^&?#]+)'''
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
u'url': u'http://www.vevo.com/watch/hurts/somebody-to-die-for/GB1101300280',
|
'url': 'http://www.vevo.com/watch/hurts/somebody-to-die-for/GB1101300280',
|
||||||
u'file': u'GB1101300280.mp4',
|
'file': 'GB1101300280.mp4',
|
||||||
u"md5": u"06bea460acb744eab74a9d7dcb4bfd61",
|
"md5": "06bea460acb744eab74a9d7dcb4bfd61",
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"upload_date": u"20130624",
|
"upload_date": "20130624",
|
||||||
u"uploader": u"Hurts",
|
"uploader": "Hurts",
|
||||||
u"title": u"Somebody to Die For",
|
"title": "Somebody to Die For",
|
||||||
u"duration": 230.12,
|
"duration": 230.12,
|
||||||
u"width": 1920,
|
"width": 1920,
|
||||||
u"height": 1080,
|
"height": 1080,
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
_SMIL_BASE_URL = 'http://smil.lvl3.vevo.com/'
|
_SMIL_BASE_URL = 'http://smil.lvl3.vevo.com/'
|
||||||
@ -44,7 +45,7 @@ class VevoIE(InfoExtractor):
|
|||||||
if version['version'] > last_version['version']:
|
if version['version'] > last_version['version']:
|
||||||
last_version = version
|
last_version = version
|
||||||
if last_version['version'] == -1:
|
if last_version['version'] == -1:
|
||||||
raise ExtractorError(u'Unable to extract last version of the video')
|
raise ExtractorError('Unable to extract last version of the video')
|
||||||
|
|
||||||
renditions = xml.etree.ElementTree.fromstring(last_version['data'])
|
renditions = xml.etree.ElementTree.fromstring(last_version['data'])
|
||||||
formats = []
|
formats = []
|
||||||
@ -85,7 +86,7 @@ class VevoIE(InfoExtractor):
|
|||||||
format_url = self._SMIL_BASE_URL + m.group('path')
|
format_url = self._SMIL_BASE_URL + m.group('path')
|
||||||
formats.append({
|
formats.append({
|
||||||
'url': format_url,
|
'url': format_url,
|
||||||
'format_id': u'SMIL_' + m.group('cbr'),
|
'format_id': 'SMIL_' + m.group('cbr'),
|
||||||
'vcodec': m.group('vcodec'),
|
'vcodec': m.group('vcodec'),
|
||||||
'acodec': m.group('acodec'),
|
'acodec': m.group('acodec'),
|
||||||
'vbr': int(m.group('vbr')),
|
'vbr': int(m.group('vbr')),
|
||||||
@ -101,26 +102,25 @@ class VevoIE(InfoExtractor):
|
|||||||
video_id = mobj.group('id')
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
json_url = 'http://videoplayer.vevo.com/VideoService/AuthenticateVideo?isrc=%s' % video_id
|
json_url = 'http://videoplayer.vevo.com/VideoService/AuthenticateVideo?isrc=%s' % video_id
|
||||||
info_json = self._download_webpage(json_url, video_id, u'Downloading json info')
|
video_info = self._download_json(json_url, video_id)['video']
|
||||||
video_info = json.loads(info_json)['video']
|
|
||||||
|
|
||||||
formats = self._formats_from_json(video_info)
|
formats = self._formats_from_json(video_info)
|
||||||
try:
|
try:
|
||||||
smil_url = '%s/Video/V2/VFILE/%s/%sr.smil' % (
|
smil_url = '%s/Video/V2/VFILE/%s/%sr.smil' % (
|
||||||
self._SMIL_BASE_URL, video_id, video_id.lower())
|
self._SMIL_BASE_URL, video_id, video_id.lower())
|
||||||
smil_xml = self._download_webpage(smil_url, video_id,
|
smil_xml = self._download_webpage(smil_url, video_id,
|
||||||
u'Downloading SMIL info')
|
'Downloading SMIL info')
|
||||||
formats.extend(self._formats_from_smil(smil_xml))
|
formats.extend(self._formats_from_smil(smil_xml))
|
||||||
except ExtractorError as ee:
|
except ExtractorError as ee:
|
||||||
if not isinstance(ee.cause, compat_HTTPError):
|
if not isinstance(ee.cause, compat_HTTPError):
|
||||||
raise
|
raise
|
||||||
self._downloader.report_warning(
|
self._downloader.report_warning(
|
||||||
u'Cannot download SMIL information, falling back to JSON ..')
|
'Cannot download SMIL information, falling back to JSON ..')
|
||||||
|
|
||||||
timestamp_ms = int(self._search_regex(
|
timestamp_ms = int(self._search_regex(
|
||||||
r'/Date\((\d+)\)/', video_info['launchDate'], u'launch date'))
|
r'/Date\((\d+)\)/', video_info['launchDate'], 'launch date'))
|
||||||
upload_date = datetime.datetime.fromtimestamp(timestamp_ms // 1000)
|
upload_date = datetime.datetime.fromtimestamp(timestamp_ms // 1000)
|
||||||
info = {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': video_info['title'],
|
'title': video_info['title'],
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
@ -129,5 +129,3 @@ class VevoIE(InfoExtractor):
|
|||||||
'uploader': video_info['mainArtists'][0]['artistName'],
|
'uploader': video_info['mainArtists'][0]['artistName'],
|
||||||
'duration': video_info['duration'],
|
'duration': video_info['duration'],
|
||||||
}
|
}
|
||||||
|
|
||||||
return info
|
|
||||||
|
@ -6,10 +6,10 @@ import re
|
|||||||
import itertools
|
import itertools
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from .subtitles import SubtitlesInfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
compat_urllib_parse,
|
compat_urllib_parse,
|
||||||
compat_urllib_request,
|
compat_urllib_request,
|
||||||
|
|
||||||
clean_html,
|
clean_html,
|
||||||
get_element_by_attribute,
|
get_element_by_attribute,
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
@ -19,7 +19,7 @@ from ..utils import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class VimeoIE(InfoExtractor):
|
class VimeoIE(SubtitlesInfoExtractor):
|
||||||
"""Information extractor for vimeo.com."""
|
"""Information extractor for vimeo.com."""
|
||||||
|
|
||||||
# _VALID_URL matches Vimeo URLs
|
# _VALID_URL matches Vimeo URLs
|
||||||
@ -84,6 +84,20 @@ class VimeoIE(InfoExtractor):
|
|||||||
'videopassword': 'youtube-dl',
|
'videopassword': 'youtube-dl',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'url': 'http://vimeo.com/76979871',
|
||||||
|
'md5': '3363dd6ffebe3784d56f4132317fd446',
|
||||||
|
'note': 'Video with subtitles',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '76979871',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'The New Vimeo Player (You Know, For Videos)',
|
||||||
|
'description': 'md5:2ec900bf97c3f389378a96aee11260ea',
|
||||||
|
'upload_date': '20131015',
|
||||||
|
'uploader_id': 'staff',
|
||||||
|
'uploader': 'Vimeo Staff',
|
||||||
|
}
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
def _login(self):
|
def _login(self):
|
||||||
@ -273,25 +287,37 @@ class VimeoIE(InfoExtractor):
|
|||||||
if len(formats) == 0:
|
if len(formats) == 0:
|
||||||
raise ExtractorError('No known codec found')
|
raise ExtractorError('No known codec found')
|
||||||
|
|
||||||
|
subtitles = {}
|
||||||
|
text_tracks = config['request'].get('text_tracks')
|
||||||
|
if text_tracks:
|
||||||
|
for tt in text_tracks:
|
||||||
|
subtitles[tt['lang']] = 'http://vimeo.com' + tt['url']
|
||||||
|
|
||||||
|
video_subtitles = self.extract_subtitles(video_id, subtitles)
|
||||||
|
if self._downloader.params.get('listsubtitles', False):
|
||||||
|
self._list_available_subtitles(video_id, subtitles)
|
||||||
|
return
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'uploader': video_uploader,
|
'uploader': video_uploader,
|
||||||
'uploader_id': video_uploader_id,
|
'uploader_id': video_uploader_id,
|
||||||
'upload_date': video_upload_date,
|
'upload_date': video_upload_date,
|
||||||
'title': video_title,
|
'title': video_title,
|
||||||
'thumbnail': video_thumbnail,
|
'thumbnail': video_thumbnail,
|
||||||
'description': video_description,
|
'description': video_description,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'webpage_url': url,
|
'webpage_url': url,
|
||||||
'view_count': view_count,
|
'view_count': view_count,
|
||||||
'like_count': like_count,
|
'like_count': like_count,
|
||||||
'comment_count': comment_count,
|
'comment_count': comment_count,
|
||||||
|
'subtitles': video_subtitles,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class VimeoChannelIE(InfoExtractor):
|
class VimeoChannelIE(InfoExtractor):
|
||||||
IE_NAME = 'vimeo:channel'
|
IE_NAME = 'vimeo:channel'
|
||||||
_VALID_URL = r'(?:https?://)?vimeo.\com/channels/(?P<id>[^/]+)'
|
_VALID_URL = r'(?:https?://)?vimeo\.com/channels/(?P<id>[^/]+)'
|
||||||
_MORE_PAGES_INDICATOR = r'<a.+?rel="next"'
|
_MORE_PAGES_INDICATOR = r'<a.+?rel="next"'
|
||||||
_TITLE_RE = r'<link rel="alternate"[^>]+?title="(.*?)"'
|
_TITLE_RE = r'<link rel="alternate"[^>]+?title="(.*?)"'
|
||||||
|
|
||||||
@ -327,7 +353,7 @@ class VimeoChannelIE(InfoExtractor):
|
|||||||
|
|
||||||
class VimeoUserIE(VimeoChannelIE):
|
class VimeoUserIE(VimeoChannelIE):
|
||||||
IE_NAME = 'vimeo:user'
|
IE_NAME = 'vimeo:user'
|
||||||
_VALID_URL = r'(?:https?://)?vimeo.\com/(?P<name>[^/]+)(?:/videos|[#?]|$)'
|
_VALID_URL = r'(?:https?://)?vimeo\.com/(?P<name>[^/]+)(?:/videos|[#?]|$)'
|
||||||
_TITLE_RE = r'<a[^>]+?class="user">([^<>]+?)</a>'
|
_TITLE_RE = r'<a[^>]+?class="user">([^<>]+?)</a>'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -344,7 +370,7 @@ class VimeoUserIE(VimeoChannelIE):
|
|||||||
|
|
||||||
class VimeoAlbumIE(VimeoChannelIE):
|
class VimeoAlbumIE(VimeoChannelIE):
|
||||||
IE_NAME = 'vimeo:album'
|
IE_NAME = 'vimeo:album'
|
||||||
_VALID_URL = r'(?:https?://)?vimeo.\com/album/(?P<id>\d+)'
|
_VALID_URL = r'(?:https?://)?vimeo\.com/album/(?P<id>\d+)'
|
||||||
_TITLE_RE = r'<header id="page_header">\n\s*<h1>(.*?)</h1>'
|
_TITLE_RE = r'<header id="page_header">\n\s*<h1>(.*?)</h1>'
|
||||||
|
|
||||||
def _page_url(self, base_url, pagenum):
|
def _page_url(self, base_url, pagenum):
|
||||||
@ -358,7 +384,7 @@ class VimeoAlbumIE(VimeoChannelIE):
|
|||||||
|
|
||||||
class VimeoGroupsIE(VimeoAlbumIE):
|
class VimeoGroupsIE(VimeoAlbumIE):
|
||||||
IE_NAME = 'vimeo:group'
|
IE_NAME = 'vimeo:group'
|
||||||
_VALID_URL = r'(?:https?://)?vimeo.\com/groups/(?P<name>[^/]+)'
|
_VALID_URL = r'(?:https?://)?vimeo\.com/groups/(?P<name>[^/]+)'
|
||||||
|
|
||||||
def _extract_list_title(self, webpage):
|
def _extract_list_title(self, webpage):
|
||||||
return self._og_search_title(webpage)
|
return self._og_search_title(webpage)
|
||||||
@ -372,7 +398,7 @@ class VimeoGroupsIE(VimeoAlbumIE):
|
|||||||
class VimeoReviewIE(InfoExtractor):
|
class VimeoReviewIE(InfoExtractor):
|
||||||
IE_NAME = 'vimeo:review'
|
IE_NAME = 'vimeo:review'
|
||||||
IE_DESC = 'Review pages on vimeo'
|
IE_DESC = 'Review pages on vimeo'
|
||||||
_VALID_URL = r'(?:https?://)?vimeo.\com/[^/]+/review/(?P<id>[^/]+)'
|
_VALID_URL = r'(?:https?://)?vimeo\.com/[^/]+/review/(?P<id>[^/]+)'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'https://vimeo.com/user21297594/review/75524534/3c257a1b5d',
|
'url': 'https://vimeo.com/user21297594/review/75524534/3c257a1b5d',
|
||||||
'file': '75524534.mp4',
|
'file': '75524534.mp4',
|
||||||
|
@ -1,18 +1,21 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
class VineIE(InfoExtractor):
|
class VineIE(InfoExtractor):
|
||||||
_VALID_URL = r'(?:https?://)?(?:www\.)?vine\.co/v/(?P<id>\w+)'
|
_VALID_URL = r'https?://(?:www\.)?vine\.co/v/(?P<id>\w+)'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'https://vine.co/v/b9KOOWX7HUx',
|
'url': 'https://vine.co/v/b9KOOWX7HUx',
|
||||||
u'file': u'b9KOOWX7HUx.mp4',
|
'md5': '2f36fed6235b16da96ce9b4dc890940d',
|
||||||
u'md5': u'2f36fed6235b16da96ce9b4dc890940d',
|
'info_dict': {
|
||||||
u'info_dict': {
|
'id': 'b9KOOWX7HUx',
|
||||||
u"uploader": u"Jack Dorsey",
|
'ext': 'mp4',
|
||||||
u"title": u"Chicken."
|
'uploader': 'Jack Dorsey',
|
||||||
}
|
'title': 'Chicken.',
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@ -24,17 +27,17 @@ class VineIE(InfoExtractor):
|
|||||||
|
|
||||||
self.report_extraction(video_id)
|
self.report_extraction(video_id)
|
||||||
|
|
||||||
video_url = self._html_search_regex(r'<meta property="twitter:player:stream" content="(.+?)"',
|
video_url = self._html_search_meta('twitter:player:stream', webpage,
|
||||||
webpage, u'video URL')
|
'video URL')
|
||||||
|
|
||||||
uploader = self._html_search_regex(r'<p class="username">(.*?)</p>',
|
uploader = self._html_search_regex(r'<p class="username">(.*?)</p>',
|
||||||
webpage, u'uploader', fatal=False, flags=re.DOTALL)
|
webpage, 'uploader', fatal=False, flags=re.DOTALL)
|
||||||
|
|
||||||
return [{
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': self._og_search_title(webpage),
|
'title': self._og_search_title(webpage),
|
||||||
'thumbnail': self._og_search_thumbnail(webpage),
|
'thumbnail': self._og_search_thumbnail(webpage),
|
||||||
'uploader': uploader,
|
'uploader': uploader,
|
||||||
}]
|
}
|
||||||
|
80
youtube_dl/extractor/vube.py
Normal file
80
youtube_dl/extractor/vube.py
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
|
class VubeIE(InfoExtractor):
|
||||||
|
IE_NAME = 'vube'
|
||||||
|
IE_DESC = 'Vube.com'
|
||||||
|
_VALID_URL = r'http://vube\.com/[^/]+/(?P<id>[\da-zA-Z]{10})'
|
||||||
|
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://vube.com/Chiara+Grispo+Video+Channel/YL2qNPkqon',
|
||||||
|
'md5': 'f81dcf6d0448e3291f54380181695821',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'YL2qNPkqon',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Chiara Grispo - Price Tag by Jessie J',
|
||||||
|
'description': 'md5:8ea652a1f36818352428cb5134933313',
|
||||||
|
'thumbnail': 'http://frame.thestaticvube.com/snap/228x128/102e7e63057-5ebc-4f5c-4065-6ce4ebde131f.jpg',
|
||||||
|
'uploader': 'Chiara.Grispo',
|
||||||
|
'uploader_id': '1u3hX0znhP',
|
||||||
|
'upload_date': '20140103',
|
||||||
|
'duration': 170.56
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
video = self._download_json('http://vube.com/api/v2/video/%s' % video_id,
|
||||||
|
video_id, 'Downloading video JSON')
|
||||||
|
|
||||||
|
public_id = video['public_id']
|
||||||
|
|
||||||
|
formats = [{'url': 'http://video.thestaticvube.com/video/%s/%s.mp4' % (fmt['media_resolution_id'], public_id),
|
||||||
|
'height': int(fmt['height']),
|
||||||
|
'abr': int(fmt['audio_bitrate']),
|
||||||
|
'vbr': int(fmt['video_bitrate']),
|
||||||
|
'format_id': fmt['media_resolution_id']
|
||||||
|
} for fmt in video['mtm'] if fmt['transcoding_status'] == 'processed']
|
||||||
|
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
title = video['title']
|
||||||
|
description = video.get('description')
|
||||||
|
thumbnail = video['thumbnail_src']
|
||||||
|
if thumbnail.startswith('//'):
|
||||||
|
thumbnail = 'http:' + thumbnail
|
||||||
|
uploader = video['user_alias']
|
||||||
|
uploader_id = video['user_url_id']
|
||||||
|
upload_date = datetime.datetime.fromtimestamp(int(video['upload_time'])).strftime('%Y%m%d')
|
||||||
|
duration = video['duration']
|
||||||
|
view_count = video['raw_view_count']
|
||||||
|
like_count = video['total_likes']
|
||||||
|
dislike_count= video['total_hates']
|
||||||
|
|
||||||
|
comment = self._download_json('http://vube.com/api/video/%s/comment' % video_id,
|
||||||
|
video_id, 'Downloading video comment JSON')
|
||||||
|
|
||||||
|
comment_count = comment['total']
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'formats': formats,
|
||||||
|
'title': title,
|
||||||
|
'description': description,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
'uploader': uploader,
|
||||||
|
'uploader_id': uploader_id,
|
||||||
|
'upload_date': upload_date,
|
||||||
|
'duration': duration,
|
||||||
|
'view_count': view_count,
|
||||||
|
'like_count': like_count,
|
||||||
|
'dislike_count': dislike_count,
|
||||||
|
'comment_count': comment_count,
|
||||||
|
}
|
@ -1,59 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
import re
|
|
||||||
|
|
||||||
from ..utils import (
|
|
||||||
compat_urllib_request,
|
|
||||||
compat_urllib_parse
|
|
||||||
)
|
|
||||||
|
|
||||||
from .common import InfoExtractor
|
|
||||||
|
|
||||||
class WeBSurgIE(InfoExtractor):
|
|
||||||
IE_NAME = u'websurg.com'
|
|
||||||
_VALID_URL = r'http://.*?\.websurg\.com/MEDIA/\?noheader=1&doi=(.*)'
|
|
||||||
|
|
||||||
_TEST = {
|
|
||||||
u'url': u'http://www.websurg.com/MEDIA/?noheader=1&doi=vd01en4012',
|
|
||||||
u'file': u'vd01en4012.mp4',
|
|
||||||
u'params': {
|
|
||||||
u'skip_download': True,
|
|
||||||
},
|
|
||||||
u'skip': u'Requires login information',
|
|
||||||
}
|
|
||||||
|
|
||||||
_LOGIN_URL = 'http://www.websurg.com/inc/login/login_div.ajax.php?login=1'
|
|
||||||
|
|
||||||
def _real_initialize(self):
|
|
||||||
|
|
||||||
login_form = {
|
|
||||||
'username': self._downloader.params['username'],
|
|
||||||
'password': self._downloader.params['password'],
|
|
||||||
'Submit': 1
|
|
||||||
}
|
|
||||||
|
|
||||||
request = compat_urllib_request.Request(
|
|
||||||
self._LOGIN_URL, compat_urllib_parse.urlencode(login_form))
|
|
||||||
request.add_header(
|
|
||||||
'Content-Type', 'application/x-www-form-urlencoded;charset=utf-8')
|
|
||||||
compat_urllib_request.urlopen(request).info()
|
|
||||||
webpage = self._download_webpage(self._LOGIN_URL, '', 'Logging in')
|
|
||||||
|
|
||||||
if webpage != 'OK':
|
|
||||||
self._downloader.report_error(
|
|
||||||
u'Unable to log in: bad username/password')
|
|
||||||
|
|
||||||
def _real_extract(self, url):
|
|
||||||
video_id = re.match(self._VALID_URL, url).group(1)
|
|
||||||
|
|
||||||
webpage = self._download_webpage(url, video_id)
|
|
||||||
|
|
||||||
url_info = re.search(r'streamer="(.*?)" src="(.*?)"', webpage)
|
|
||||||
|
|
||||||
return {'id': video_id,
|
|
||||||
'title': self._og_search_title(webpage),
|
|
||||||
'description': self._og_search_description(webpage),
|
|
||||||
'ext' : 'mp4',
|
|
||||||
'url' : url_info.group(1) + '/' + url_info.group(2),
|
|
||||||
'thumbnail': self._og_search_thumbnail(webpage)
|
|
||||||
}
|
|
@ -1,10 +1,10 @@
|
|||||||
|
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,
|
|
||||||
determine_ext,
|
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -13,25 +13,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 +39,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 +62,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]
|
|
||||||
|
@ -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 YouJizzIE(InfoExtractor):
|
class YouJizzIE(InfoExtractor):
|
||||||
_VALID_URL = r'^(?:https?://)?(?:\w+\.)?youjizz\.com/videos/(?P<videoid>[^.]+)\.html$'
|
_VALID_URL = r'^(?:https?://)?(?:\w+\.)?youjizz\.com/videos/(?P<videoid>[^.]+)\.html$'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.youjizz.com/videos/zeichentrick-1-2189178.html',
|
'url': 'http://www.youjizz.com/videos/zeichentrick-1-2189178.html',
|
||||||
u'file': u'2189178.flv',
|
'file': '2189178.flv',
|
||||||
u'md5': u'07e15fa469ba384c7693fd246905547c',
|
'md5': '07e15fa469ba384c7693fd246905547c',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"title": u"Zeichentrick 1",
|
"title": "Zeichentrick 1",
|
||||||
u"age_limit": 18,
|
"age_limit": 18,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,12 +32,12 @@ class YouJizzIE(InfoExtractor):
|
|||||||
|
|
||||||
# Get the video title
|
# Get the video title
|
||||||
video_title = self._html_search_regex(r'<title>(?P<title>.*)</title>',
|
video_title = self._html_search_regex(r'<title>(?P<title>.*)</title>',
|
||||||
webpage, u'title').strip()
|
webpage, 'title').strip()
|
||||||
|
|
||||||
# Get the embed page
|
# Get the embed page
|
||||||
result = re.search(r'https?://www.youjizz.com/videos/embed/(?P<videoid>[0-9]+)', webpage)
|
result = re.search(r'https?://www.youjizz.com/videos/embed/(?P<videoid>[0-9]+)', webpage)
|
||||||
if result is None:
|
if result is None:
|
||||||
raise ExtractorError(u'ERROR: unable to extract embed page')
|
raise ExtractorError('ERROR: unable to extract embed page')
|
||||||
|
|
||||||
embed_page_url = result.group(0).strip()
|
embed_page_url = result.group(0).strip()
|
||||||
video_id = result.group('videoid')
|
video_id = result.group('videoid')
|
||||||
@ -47,23 +49,23 @@ class YouJizzIE(InfoExtractor):
|
|||||||
if m_playlist is not None:
|
if m_playlist is not None:
|
||||||
playlist_url = m_playlist.group('playlist')
|
playlist_url = m_playlist.group('playlist')
|
||||||
playlist_page = self._download_webpage(playlist_url, video_id,
|
playlist_page = self._download_webpage(playlist_url, video_id,
|
||||||
u'Downloading playlist page')
|
'Downloading playlist page')
|
||||||
m_levels = list(re.finditer(r'<level bitrate="(\d+?)" file="(.*?)"', playlist_page))
|
m_levels = list(re.finditer(r'<level bitrate="(\d+?)" file="(.*?)"', playlist_page))
|
||||||
if len(m_levels) == 0:
|
if len(m_levels) == 0:
|
||||||
raise ExtractorError(u'Unable to extract video url')
|
raise ExtractorError('Unable to extract video url')
|
||||||
videos = [(int(m.group(1)), m.group(2)) for m in m_levels]
|
videos = [(int(m.group(1)), m.group(2)) for m in m_levels]
|
||||||
(_, video_url) = sorted(videos)[0]
|
(_, video_url) = sorted(videos)[0]
|
||||||
video_url = video_url.replace('%252F', '%2F')
|
video_url = video_url.replace('%252F', '%2F')
|
||||||
else:
|
else:
|
||||||
video_url = self._search_regex(r'so.addVariable\("file",encodeURIComponent\("(?P<source>[^"]+)"\)\);',
|
video_url = self._search_regex(r'so.addVariable\("file",encodeURIComponent\("(?P<source>[^"]+)"\)\);',
|
||||||
webpage, u'video URL')
|
webpage, 'video URL')
|
||||||
|
|
||||||
info = {'id': video_id,
|
return {
|
||||||
'url': video_url,
|
'id': video_id,
|
||||||
'title': video_title,
|
'url': video_url,
|
||||||
'ext': 'flv',
|
'title': video_title,
|
||||||
'format': 'flv',
|
'ext': 'flv',
|
||||||
'player_url': embed_page_url,
|
'format': 'flv',
|
||||||
'age_limit': age_limit}
|
'player_url': embed_page_url,
|
||||||
|
'age_limit': age_limit,
|
||||||
return [info]
|
}
|
||||||
|
@ -27,6 +27,8 @@ 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,
|
RegexNotFoundError,
|
||||||
unescapeHTML,
|
unescapeHTML,
|
||||||
unified_strdate,
|
unified_strdate,
|
||||||
@ -38,7 +40,7 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
|
|||||||
"""Provide base functions for Youtube extractors"""
|
"""Provide base functions for Youtube extractors"""
|
||||||
_LOGIN_URL = 'https://accounts.google.com/ServiceLogin'
|
_LOGIN_URL = 'https://accounts.google.com/ServiceLogin'
|
||||||
_LANG_URL = r'https://www.youtube.com/?hl=en&persist_hl=1&gl=US&persist_gl=1&opt_out_ackd=1'
|
_LANG_URL = r'https://www.youtube.com/?hl=en&persist_hl=1&gl=US&persist_gl=1&opt_out_ackd=1'
|
||||||
_AGE_URL = 'http://www.youtube.com/verify_age?next_url=/&gl=US&hl=en'
|
_AGE_URL = 'https://www.youtube.com/verify_age?next_url=/&gl=US&hl=en'
|
||||||
_NETRC_MACHINE = 'youtube'
|
_NETRC_MACHINE = 'youtube'
|
||||||
# If True it will raise an error if no login info is provided
|
# If True it will raise an error if no login info is provided
|
||||||
_LOGIN_REQUIRED = False
|
_LOGIN_REQUIRED = False
|
||||||
@ -109,7 +111,8 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
|
|||||||
'next_url': '/',
|
'next_url': '/',
|
||||||
'action_confirm': 'Confirm',
|
'action_confirm': 'Confirm',
|
||||||
}
|
}
|
||||||
req = compat_urllib_request.Request(self._AGE_URL, compat_urllib_parse.urlencode(age_form))
|
req = compat_urllib_request.Request(self._AGE_URL,
|
||||||
|
compat_urllib_parse.urlencode(age_form).encode('ascii'))
|
||||||
|
|
||||||
self._download_webpage(
|
self._download_webpage(
|
||||||
req, None,
|
req, None,
|
||||||
@ -205,6 +208,12 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
|
|||||||
'141': {'ext': 'm4a', 'format_note': 'DASH audio', 'vcodec': 'none', 'abr': 256, 'preference': -50},
|
'141': {'ext': 'm4a', 'format_note': 'DASH audio', 'vcodec': 'none', 'abr': 256, 'preference': -50},
|
||||||
|
|
||||||
# Dash webm
|
# Dash webm
|
||||||
|
'167': {'ext': 'webm', 'height': 360, 'width': 640, 'format_note': 'DASH video', 'container': 'webm', 'vcodec': 'VP8', 'acodec': 'none', 'preference': -40},
|
||||||
|
'168': {'ext': 'webm', 'height': 480, 'width': 854, 'format_note': 'DASH video', 'container': 'webm', 'vcodec': 'VP8', 'acodec': 'none', 'preference': -40},
|
||||||
|
'169': {'ext': 'webm', 'height': 720, 'width': 1280, 'format_note': 'DASH video', 'container': 'webm', 'vcodec': 'VP8', 'acodec': 'none', 'preference': -40},
|
||||||
|
'170': {'ext': 'webm', 'height': 1080, 'width': 1920, 'format_note': 'DASH video', 'container': 'webm', 'vcodec': 'VP8', 'acodec': 'none', 'preference': -40},
|
||||||
|
'218': {'ext': 'webm', 'height': 480, 'width': 854, 'format_note': 'DASH video', 'container': 'webm', 'vcodec': 'VP8', 'acodec': 'none', 'preference': -40},
|
||||||
|
'219': {'ext': 'webm', 'height': 480, 'width': 854, 'format_note': 'DASH video', 'container': 'webm', 'vcodec': 'VP8', 'acodec': 'none', 'preference': -40},
|
||||||
'242': {'ext': 'webm', 'height': 240, 'resolution': '240p', 'format_note': 'DASH webm', 'preference': -40},
|
'242': {'ext': 'webm', 'height': 240, 'resolution': '240p', 'format_note': 'DASH webm', 'preference': -40},
|
||||||
'243': {'ext': 'webm', 'height': 360, 'resolution': '360p', 'format_note': 'DASH webm', 'preference': -40},
|
'243': {'ext': 'webm', 'height': 360, 'resolution': '360p', 'format_note': 'DASH webm', 'preference': -40},
|
||||||
'244': {'ext': 'webm', 'height': 480, 'resolution': '480p', 'format_note': 'DASH webm', 'preference': -40},
|
'244': {'ext': 'webm', 'height': 480, 'resolution': '480p', 'format_note': 'DASH webm', 'preference': -40},
|
||||||
@ -270,6 +279,22 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
|
|||||||
u"uploader_id": u"setindia"
|
u"uploader_id": u"setindia"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
u"url": u"http://www.youtube.com/watch?v=a9LDPn-MO4I",
|
||||||
|
u"file": u"a9LDPn-MO4I.m4a",
|
||||||
|
u"note": u"256k DASH audio (format 141) via DASH manifest",
|
||||||
|
u"info_dict": {
|
||||||
|
u"upload_date": "20121002",
|
||||||
|
u"uploader_id": "8KVIDEO",
|
||||||
|
u"description": "No description available.",
|
||||||
|
u"uploader": "8KVIDEO",
|
||||||
|
u"title": "UHDTV TEST 8K VIDEO.mp4"
|
||||||
|
},
|
||||||
|
u"params": {
|
||||||
|
u"youtube_include_dash_manifest": True,
|
||||||
|
u"format": "141",
|
||||||
|
},
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@ -477,7 +502,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
|
|||||||
return a % b
|
return a % b
|
||||||
|
|
||||||
m = re.match(
|
m = re.match(
|
||||||
r'^(?P<func>[a-zA-Z]+)\((?P<args>[a-z0-9,]+)\)$', expr)
|
r'^(?P<func>[a-zA-Z$]+)\((?P<args>[a-z0-9,]+)\)$', expr)
|
||||||
if m:
|
if m:
|
||||||
fname = m.group('func')
|
fname = m.group('func')
|
||||||
if fname not in functions:
|
if fname not in functions:
|
||||||
@ -990,7 +1015,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
|
|||||||
def _get_available_subtitles(self, video_id, webpage):
|
def _get_available_subtitles(self, video_id, webpage):
|
||||||
try:
|
try:
|
||||||
sub_list = self._download_webpage(
|
sub_list = self._download_webpage(
|
||||||
'http://video.google.com/timedtext?hl=en&type=list&v=%s' % video_id,
|
'https://video.google.com/timedtext?hl=en&type=list&v=%s' % video_id,
|
||||||
video_id, note=False)
|
video_id, note=False)
|
||||||
except ExtractorError as err:
|
except ExtractorError as err:
|
||||||
self._downloader.report_warning(u'unable to download video subtitles: %s' % compat_str(err))
|
self._downloader.report_warning(u'unable to download video subtitles: %s' % compat_str(err))
|
||||||
@ -1006,7 +1031,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
|
|||||||
'fmt': self._downloader.params.get('subtitlesformat', 'srt'),
|
'fmt': self._downloader.params.get('subtitlesformat', 'srt'),
|
||||||
'name': unescapeHTML(l[0]).encode('utf-8'),
|
'name': unescapeHTML(l[0]).encode('utf-8'),
|
||||||
})
|
})
|
||||||
url = u'http://www.youtube.com/api/timedtext?' + params
|
url = u'https://www.youtube.com/api/timedtext?' + params
|
||||||
sub_lang_list[lang] = url
|
sub_lang_list[lang] = url
|
||||||
if not sub_lang_list:
|
if not sub_lang_list:
|
||||||
self._downloader.report_warning(u'video doesn\'t have subtitles')
|
self._downloader.report_warning(u'video doesn\'t have subtitles')
|
||||||
@ -1067,18 +1092,6 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
|
|||||||
video_id = mobj.group(2)
|
video_id = mobj.group(2)
|
||||||
return video_id
|
return video_id
|
||||||
|
|
||||||
def _get_video_url_list(self, url_map):
|
|
||||||
"""
|
|
||||||
Transform a dictionary in the format {itag:url} to a list of (itag, url)
|
|
||||||
with the requested formats.
|
|
||||||
"""
|
|
||||||
existing_formats = [x for x in self._formats if x in url_map]
|
|
||||||
if len(existing_formats) == 0:
|
|
||||||
raise ExtractorError(u'no known formats available for video')
|
|
||||||
video_url_list = [(f, url_map[f]) for f in existing_formats] # All formats
|
|
||||||
video_url_list.reverse() # order worst to best
|
|
||||||
return video_url_list
|
|
||||||
|
|
||||||
def _extract_from_m3u8(self, manifest_url, video_id):
|
def _extract_from_m3u8(self, manifest_url, video_id):
|
||||||
url_map = {}
|
url_map = {}
|
||||||
def _get_urls(_manifest):
|
def _get_urls(_manifest):
|
||||||
@ -1252,7 +1265,6 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
|
|||||||
video_annotations = self._extract_annotations(video_id)
|
video_annotations = self._extract_annotations(video_id)
|
||||||
|
|
||||||
# Decide which formats to download
|
# Decide which formats to download
|
||||||
|
|
||||||
try:
|
try:
|
||||||
mobj = re.search(r';ytplayer.config = ({.*?});', video_webpage)
|
mobj = re.search(r';ytplayer.config = ({.*?});', video_webpage)
|
||||||
if not mobj:
|
if not mobj:
|
||||||
@ -1277,9 +1289,27 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def _map_to_format_list(urlmap):
|
||||||
|
formats = []
|
||||||
|
for itag, video_real_url in urlmap.items():
|
||||||
|
dct = {
|
||||||
|
'format_id': itag,
|
||||||
|
'url': video_real_url,
|
||||||
|
'player_url': player_url,
|
||||||
|
}
|
||||||
|
if itag in self._formats:
|
||||||
|
dct.update(self._formats[itag])
|
||||||
|
formats.append(dct)
|
||||||
|
return formats
|
||||||
|
|
||||||
if 'conn' in video_info and video_info['conn'][0].startswith('rtmp'):
|
if 'conn' in video_info and video_info['conn'][0].startswith('rtmp'):
|
||||||
self.report_rtmp_download()
|
self.report_rtmp_download()
|
||||||
video_url_list = [('_rtmp', video_info['conn'][0])]
|
formats = [{
|
||||||
|
'format_id': '_rtmp',
|
||||||
|
'protocol': 'rtmp',
|
||||||
|
'url': video_info['conn'][0],
|
||||||
|
'player_url': player_url,
|
||||||
|
}]
|
||||||
elif len(video_info.get('url_encoded_fmt_stream_map', [])) >= 1 or len(video_info.get('adaptive_fmts', [])) >= 1:
|
elif len(video_info.get('url_encoded_fmt_stream_map', [])) >= 1 or len(video_info.get('adaptive_fmts', [])) >= 1:
|
||||||
encoded_url_map = video_info.get('url_encoded_fmt_stream_map', [''])[0] + ',' + video_info.get('adaptive_fmts',[''])[0]
|
encoded_url_map = video_info.get('url_encoded_fmt_stream_map', [''])[0] + ',' + video_info.get('adaptive_fmts',[''])[0]
|
||||||
if 'rtmpe%3Dyes' in encoded_url_map:
|
if 'rtmpe%3Dyes' in encoded_url_map:
|
||||||
@ -1324,23 +1354,50 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
|
|||||||
if 'ratebypass' not in url:
|
if 'ratebypass' not in url:
|
||||||
url += '&ratebypass=yes'
|
url += '&ratebypass=yes'
|
||||||
url_map[url_data['itag'][0]] = url
|
url_map[url_data['itag'][0]] = url
|
||||||
video_url_list = self._get_video_url_list(url_map)
|
formats = _map_to_format_list(url_map)
|
||||||
elif video_info.get('hlsvp'):
|
elif video_info.get('hlsvp'):
|
||||||
manifest_url = video_info['hlsvp'][0]
|
manifest_url = video_info['hlsvp'][0]
|
||||||
url_map = self._extract_from_m3u8(manifest_url, video_id)
|
url_map = self._extract_from_m3u8(manifest_url, video_id)
|
||||||
video_url_list = self._get_video_url_list(url_map)
|
formats = _map_to_format_list(url_map)
|
||||||
else:
|
else:
|
||||||
raise ExtractorError(u'no conn, hlsvp or url_encoded_fmt_stream_map information found in video info')
|
raise ExtractorError(u'no conn, hlsvp or url_encoded_fmt_stream_map information found in video info')
|
||||||
|
|
||||||
formats = []
|
# Look for the DASH manifest
|
||||||
for itag, video_real_url in video_url_list:
|
dash_manifest_url_lst = video_info.get('dashmpd')
|
||||||
dct = {
|
if (dash_manifest_url_lst and dash_manifest_url_lst[0] and
|
||||||
'format_id': itag,
|
self._downloader.params.get('youtube_include_dash_manifest', False)):
|
||||||
'url': video_real_url,
|
try:
|
||||||
'player_url': player_url,
|
dash_doc = self._download_xml(
|
||||||
}
|
dash_manifest_url_lst[0], video_id,
|
||||||
dct.update(self._formats[itag])
|
note=u'Downloading DASH manifest',
|
||||||
formats.append(dct)
|
errnote=u'Could not download DASH manifest')
|
||||||
|
for r in dash_doc.findall(u'.//{urn:mpeg:DASH:schema:MPD:2011}Representation'):
|
||||||
|
url_el = r.find('{urn:mpeg:DASH:schema:MPD:2011}BaseURL')
|
||||||
|
if url_el is None:
|
||||||
|
continue
|
||||||
|
format_id = r.attrib['id']
|
||||||
|
video_url = url_el.text
|
||||||
|
filesize = int_or_none(url_el.attrib.get('{http://youtube.com/yt/2012/10/10}contentLength'))
|
||||||
|
f = {
|
||||||
|
'format_id': format_id,
|
||||||
|
'url': video_url,
|
||||||
|
'width': int_or_none(r.attrib.get('width')),
|
||||||
|
'tbr': int_or_none(r.attrib.get('bandwidth'), 1000),
|
||||||
|
'asr': int_or_none(r.attrib.get('audioSamplingRate')),
|
||||||
|
'filesize': filesize,
|
||||||
|
}
|
||||||
|
try:
|
||||||
|
existing_format = next(
|
||||||
|
fo for fo in formats
|
||||||
|
if fo['format_id'] == format_id)
|
||||||
|
except StopIteration:
|
||||||
|
f.update(self._formats.get(format_id, {}))
|
||||||
|
formats.append(f)
|
||||||
|
else:
|
||||||
|
existing_format.update(f)
|
||||||
|
|
||||||
|
except (ExtractorError, KeyError) as e:
|
||||||
|
self.report_warning(u'Skipping DASH manifest: %s' % e, video_id)
|
||||||
|
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
@ -1473,7 +1530,7 @@ class YoutubeTopListIE(YoutubePlaylistIE):
|
|||||||
channel = mobj.group('chann')
|
channel = mobj.group('chann')
|
||||||
title = mobj.group('title')
|
title = mobj.group('title')
|
||||||
query = compat_urllib_parse.urlencode({'title': title})
|
query = compat_urllib_parse.urlencode({'title': title})
|
||||||
playlist_re = 'href="([^"]+?%s[^"]+?)"' % re.escape(query)
|
playlist_re = 'href="([^"]+?%s.*?)"' % re.escape(query)
|
||||||
channel_page = self._download_webpage('https://www.youtube.com/%s' % channel, title)
|
channel_page = self._download_webpage('https://www.youtube.com/%s' % channel, title)
|
||||||
link = self._html_search_regex(playlist_re, channel_page, u'list')
|
link = self._html_search_regex(playlist_re, channel_page, u'list')
|
||||||
url = compat_urlparse.urljoin('https://www.youtube.com/', link)
|
url = compat_urlparse.urljoin('https://www.youtube.com/', link)
|
||||||
@ -1498,7 +1555,7 @@ class YoutubeChannelIE(InfoExtractor):
|
|||||||
IE_DESC = u'YouTube.com channels'
|
IE_DESC = u'YouTube.com channels'
|
||||||
_VALID_URL = r"^(?:https?://)?(?:youtu\.be|(?:\w+\.)?youtube(?:-nocookie)?\.com)/channel/([0-9A-Za-z_-]+)"
|
_VALID_URL = r"^(?:https?://)?(?:youtu\.be|(?:\w+\.)?youtube(?:-nocookie)?\.com)/channel/([0-9A-Za-z_-]+)"
|
||||||
_MORE_PAGES_INDICATOR = 'yt-uix-load-more'
|
_MORE_PAGES_INDICATOR = 'yt-uix-load-more'
|
||||||
_MORE_PAGES_URL = 'http://www.youtube.com/c4_browse_ajax?action_load_more_videos=1&flow=list&paging=%s&view=0&sort=da&channel_id=%s'
|
_MORE_PAGES_URL = 'https://www.youtube.com/c4_browse_ajax?action_load_more_videos=1&flow=list&paging=%s&view=0&sort=da&channel_id=%s'
|
||||||
IE_NAME = u'youtube:channel'
|
IE_NAME = u'youtube:channel'
|
||||||
|
|
||||||
def extract_videos_from_page(self, page):
|
def extract_videos_from_page(self, page):
|
||||||
@ -1554,9 +1611,9 @@ class YoutubeChannelIE(InfoExtractor):
|
|||||||
class YoutubeUserIE(InfoExtractor):
|
class YoutubeUserIE(InfoExtractor):
|
||||||
IE_DESC = u'YouTube.com user videos (URL or "ytuser" keyword)'
|
IE_DESC = u'YouTube.com user videos (URL or "ytuser" keyword)'
|
||||||
_VALID_URL = r'(?:(?:(?:https?://)?(?:\w+\.)?youtube\.com/(?:user/)?(?!(?:attribution_link|watch)(?:$|[^a-z_A-Z0-9-])))|ytuser:)(?!feed/)([A-Za-z0-9_-]+)'
|
_VALID_URL = r'(?:(?:(?:https?://)?(?:\w+\.)?youtube\.com/(?:user/)?(?!(?:attribution_link|watch)(?:$|[^a-z_A-Z0-9-])))|ytuser:)(?!feed/)([A-Za-z0-9_-]+)'
|
||||||
_TEMPLATE_URL = 'http://gdata.youtube.com/feeds/api/users/%s'
|
_TEMPLATE_URL = 'https://gdata.youtube.com/feeds/api/users/%s'
|
||||||
_GDATA_PAGE_SIZE = 50
|
_GDATA_PAGE_SIZE = 50
|
||||||
_GDATA_URL = 'http://gdata.youtube.com/feeds/api/users/%s/uploads?max-results=%d&start-index=%d&alt=json'
|
_GDATA_URL = 'https://gdata.youtube.com/feeds/api/users/%s/uploads?max-results=%d&start-index=%d&alt=json'
|
||||||
IE_NAME = u'youtube:user'
|
IE_NAME = u'youtube:user'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -1580,44 +1637,35 @@ class YoutubeUserIE(InfoExtractor):
|
|||||||
# page by page until there are no video ids - it means we got
|
# page by page until there are no video ids - it means we got
|
||||||
# all of them.
|
# all of them.
|
||||||
|
|
||||||
url_results = []
|
def download_page(pagenum):
|
||||||
|
|
||||||
for pagenum in itertools.count(0):
|
|
||||||
start_index = pagenum * self._GDATA_PAGE_SIZE + 1
|
start_index = pagenum * self._GDATA_PAGE_SIZE + 1
|
||||||
|
|
||||||
gdata_url = self._GDATA_URL % (username, self._GDATA_PAGE_SIZE, start_index)
|
gdata_url = self._GDATA_URL % (username, self._GDATA_PAGE_SIZE, start_index)
|
||||||
page = self._download_webpage(gdata_url, username,
|
page = self._download_webpage(
|
||||||
u'Downloading video ids from %d to %d' % (start_index, start_index + self._GDATA_PAGE_SIZE))
|
gdata_url, username,
|
||||||
|
u'Downloading video ids from %d to %d' % (
|
||||||
|
start_index, start_index + self._GDATA_PAGE_SIZE))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = json.loads(page)
|
response = json.loads(page)
|
||||||
except ValueError as err:
|
except ValueError as err:
|
||||||
raise ExtractorError(u'Invalid JSON in API response: ' + compat_str(err))
|
raise ExtractorError(u'Invalid JSON in API response: ' + compat_str(err))
|
||||||
if 'entry' not in response['feed']:
|
if 'entry' not in response['feed']:
|
||||||
# Number of videos is a multiple of self._MAX_RESULTS
|
return
|
||||||
break
|
|
||||||
|
|
||||||
# Extract video identifiers
|
# Extract video identifiers
|
||||||
entries = response['feed']['entry']
|
entries = response['feed']['entry']
|
||||||
for entry in entries:
|
for entry in entries:
|
||||||
title = entry['title']['$t']
|
title = entry['title']['$t']
|
||||||
video_id = entry['id']['$t'].split('/')[-1]
|
video_id = entry['id']['$t'].split('/')[-1]
|
||||||
url_results.append({
|
yield {
|
||||||
'_type': 'url',
|
'_type': 'url',
|
||||||
'url': video_id,
|
'url': video_id,
|
||||||
'ie_key': 'Youtube',
|
'ie_key': 'Youtube',
|
||||||
'id': 'video_id',
|
'id': video_id,
|
||||||
'title': title,
|
'title': title,
|
||||||
})
|
}
|
||||||
|
url_results = PagedList(download_page, self._GDATA_PAGE_SIZE)
|
||||||
# A little optimization - if current page is not
|
|
||||||
# "full", ie. does not contain PAGE_SIZE video ids then
|
|
||||||
# we can assume that this page is the last one - there
|
|
||||||
# are no more ids on further pages - no need to query
|
|
||||||
# again.
|
|
||||||
|
|
||||||
if len(entries) < self._GDATA_PAGE_SIZE:
|
|
||||||
break
|
|
||||||
|
|
||||||
return self.playlist_result(url_results, playlist_title=username)
|
return self.playlist_result(url_results, playlist_title=username)
|
||||||
|
|
||||||
@ -1696,7 +1744,7 @@ class YoutubeFeedsInfoExtractor(YoutubeBaseInfoExtractor):
|
|||||||
action = 'action_load_system_feed'
|
action = 'action_load_system_feed'
|
||||||
if self._PERSONAL_FEED:
|
if self._PERSONAL_FEED:
|
||||||
action = 'action_load_personal_feed'
|
action = 'action_load_personal_feed'
|
||||||
return 'http://www.youtube.com/feed_ajax?%s=1&feed_name=%s&paging=%%s' % (action, self._FEED_NAME)
|
return 'https://www.youtube.com/feed_ajax?%s=1&feed_name=%s&paging=%%s' % (action, self._FEED_NAME)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def IE_NAME(self):
|
def IE_NAME(self):
|
||||||
@ -1765,7 +1813,10 @@ class YoutubeFavouritesIE(YoutubeBaseInfoExtractor):
|
|||||||
class YoutubeTruncatedURLIE(InfoExtractor):
|
class YoutubeTruncatedURLIE(InfoExtractor):
|
||||||
IE_NAME = 'youtube:truncated_url'
|
IE_NAME = 'youtube:truncated_url'
|
||||||
IE_DESC = False # Do not list
|
IE_DESC = False # Do not list
|
||||||
_VALID_URL = r'(?:https?://)?[^/]+/watch\?feature=[a-z_]+$'
|
_VALID_URL = r'''(?x)
|
||||||
|
(?:https?://)?[^/]+/watch\?feature=[a-z_]+$|
|
||||||
|
(?:https?://)?(?:www\.)?youtube\.com/attribution_link\?a=[^&]+$
|
||||||
|
'''
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
raise ExtractorError(
|
raise ExtractorError(
|
||||||
|
@ -90,7 +90,7 @@ def update_self(to_screen, verbose):
|
|||||||
to_screen(u'youtube-dl is up to date (%s)' % __version__)
|
to_screen(u'youtube-dl is up to date (%s)' % __version__)
|
||||||
return
|
return
|
||||||
|
|
||||||
to_screen(u'Updating to version ' + version_id + '...')
|
to_screen(u'Updating to version ' + version_id + ' ...')
|
||||||
version = versions_info['versions'][version_id]
|
version = versions_info['versions'][version_id]
|
||||||
|
|
||||||
print_notes(to_screen, versions_info['versions'])
|
print_notes(to_screen, versions_info['versions'])
|
||||||
|
@ -6,6 +6,7 @@ import datetime
|
|||||||
import email.utils
|
import email.utils
|
||||||
import errno
|
import errno
|
||||||
import gzip
|
import gzip
|
||||||
|
import itertools
|
||||||
import io
|
import io
|
||||||
import json
|
import json
|
||||||
import locale
|
import locale
|
||||||
@ -750,13 +751,14 @@ class YoutubeDLHandler(compat_urllib_request.HTTPHandler):
|
|||||||
https_request = http_request
|
https_request = http_request
|
||||||
https_response = http_response
|
https_response = http_response
|
||||||
|
|
||||||
|
|
||||||
def unified_strdate(date_str):
|
def unified_strdate(date_str):
|
||||||
"""Return a string with the date in the format YYYYMMDD"""
|
"""Return a string with the date in the format YYYYMMDD"""
|
||||||
upload_date = None
|
upload_date = None
|
||||||
#Replace commas
|
#Replace commas
|
||||||
date_str = date_str.replace(',',' ')
|
date_str = date_str.replace(',',' ')
|
||||||
# %z (UTC offset) is only supported in python>=3.2
|
# %z (UTC offset) is only supported in python>=3.2
|
||||||
date_str = re.sub(r' (\+|-)[\d]*$', '', date_str)
|
date_str = re.sub(r' ?(\+|-)[0-9:]*$', '', date_str)
|
||||||
format_expressions = [
|
format_expressions = [
|
||||||
'%d %B %Y',
|
'%d %B %Y',
|
||||||
'%B %d %Y',
|
'%B %d %Y',
|
||||||
@ -770,11 +772,12 @@ def unified_strdate(date_str):
|
|||||||
'%Y-%m-%dT%H:%M:%S.%fZ',
|
'%Y-%m-%dT%H:%M:%S.%fZ',
|
||||||
'%Y-%m-%dT%H:%M:%S.%f0Z',
|
'%Y-%m-%dT%H:%M:%S.%f0Z',
|
||||||
'%Y-%m-%dT%H:%M:%S',
|
'%Y-%m-%dT%H:%M:%S',
|
||||||
|
'%Y-%m-%dT%H:%M',
|
||||||
]
|
]
|
||||||
for expression in format_expressions:
|
for expression in format_expressions:
|
||||||
try:
|
try:
|
||||||
upload_date = datetime.datetime.strptime(date_str, expression).strftime('%Y%m%d')
|
upload_date = datetime.datetime.strptime(date_str, expression).strftime('%Y%m%d')
|
||||||
except:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
if upload_date is None:
|
if upload_date is None:
|
||||||
timetuple = email.utils.parsedate_tz(date_str)
|
timetuple = email.utils.parsedate_tz(date_str)
|
||||||
@ -1131,8 +1134,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):
|
||||||
@ -1164,3 +1167,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.22.1'
|
__version__ = '2014.02.06.2'
|
||||||
|
Reference in New Issue
Block a user