Compare commits

..

90 Commits

Author SHA1 Message Date
Philipp Hagemeister
ca3e054750 release 2014.01.27.1 2014-01-27 07:09:55 +01:00
Philipp Hagemeister
1da1558f46 [la7] Support more URLs 2014-01-27 07:08:01 +01:00
Philipp Hagemeister
25c67d257c release 2014.01.27 2014-01-27 07:05:39 +01:00
Philipp Hagemeister
a17d16d59c [la7] Add support 2014-01-27 07:05:28 +01:00
Philipp Hagemeister
d16076ff3e [huffpost] Fix extractor 2014-01-27 06:55:35 +01:00
Philipp Hagemeister
6c57e8a063 [setup.py] Only print a warning if documentation files are missing (Fixes #780) 2014-01-27 06:22:15 +01:00
Philipp Hagemeister
db1f388878 [huffpost] Add support 2014-01-27 05:47:38 +01:00
Philipp Hagemeister
0f2999fe2b Merge pull request #2221 from Rudloff/master
Removed websurg extractor
2014-01-26 18:03:26 -08:00
Jaime Marquínez Ferrándiz
5700e7792a [youtube] Encode the data when submitting the form for confirming the age
Needed on python 3
2014-01-25 17:22:41 +01:00
Jaime Marquínez Ferrándiz
38c2e5b8d5 [youtube] Use https: in more urls 2014-01-25 17:11:55 +01:00
Jaime Marquínez Ferrándiz
48f9678a32 [test/youtube_lists] Change the list used for testing the Top Lists extractor
The ‘Top tracks’ list is not always present in the channel page
2014-01-25 17:02:32 +01:00
Jaime Marquínez Ferrándiz
beddbc2ad1 [youtube:toplist] Make the regex for finding the playlist link more flexible
`title={foo}` may not be at the end of the `href` string.
2014-01-25 15:47:03 +01:00
Jaime Marquínez Ferrándiz
f89197d73e Some pep8 style fixes 2014-01-25 15:33:23 +01:00
Jaime Marquínez Ferrándiz
944d65c762 [extractor/common] Encode the url when calculating the md5 with —write-pages option
This doesn’t cause any problem in python 2.*, but on python 3 the `md5` function only accepts bytes.
2014-01-25 15:32:56 +01:00
Philipp Hagemeister
f945612bd0 [rtlnow] Simplify 2014-01-25 14:18:54 +01:00
Jaime Marquínez Ferrándiz
59188de113 Properly escape ‘.’ in some _VALID_URL properties 2014-01-25 11:48:08 +01:00
Jaime Marquínez Ferrándiz
352d08e3e5 Add an extractor for freespeech.org (closes #2234) 2014-01-25 11:31:30 +01:00
Philipp Hagemeister
886fa72324 release 2014.01.23.4 2014-01-24 00:06:55 +01:00
Philipp Hagemeister
2c5bae429a [youtube] Fix new formats 2014-01-24 00:06:26 +01:00
Philipp Hagemeister
f265fc1238 release 2014.01.23.3 2014-01-23 23:55:53 +01:00
Philipp Hagemeister
1394ce65b4 [youtube] Add new formats (Fixes #2221) 2014-01-23 23:54:06 +01:00
Pierre Rudloff
67ccb77197 Removed websurg extractor 2014-01-23 23:42:34 +01:00
Philipp Hagemeister
63ef36e8d8 Add build instructions (Fixes #2218) 2014-01-23 23:28:29 +01:00
Philipp Hagemeister
0b65e5d40f [youtube] Do not break upon unknown formats 2014-01-23 23:21:42 +01:00
Philipp Hagemeister
629be17af4 release 2014.01.23.2 2014-01-23 19:05:05 +01:00
Philipp Hagemeister
fd28827864 Do not count unmatched videos for --max-downloads (Fixes #2211) 2014-01-23 19:04:22 +01:00
Philipp Hagemeister
8c61d9a9b1 Mention default for -f (Fixes #2215) 2014-01-23 18:50:04 +01:00
Philipp Hagemeister
975d35dbab [youtube:truncated_url] Also match mail subscription links (#2214) 2014-01-23 16:14:54 +01:00
Jaime Marquínez Ferrándiz
8b769664c4 [sina] Recognize http://video.sina.com.cn/v/b/{id}-*.html urls (fixes #2212) 2014-01-23 14:03:14 +01:00
Jaime Marquínez Ferrándiz
76f270a46a [sina] use unicode_literals 2014-01-23 14:00:29 +01:00
Philipp Hagemeister
9dab1b7f28 release 2014.01.23.1 2014-01-23 10:37:34 +01:00
Philipp Hagemeister
d3e5bbf437 Correct --max-downloads with --ignore-errors 2014-01-23 10:36:47 +01:00
Philipp Hagemeister
18a25c5d78 Clarify update output (Fixes #2205)
No, we are not intentionally hiding the version number. Why would we?
2014-01-23 10:24:44 +01:00
Philipp Hagemeister
924f47f7b6 [rottentomatoes] Use unicode_literals 2014-01-23 04:05:58 +01:00
Philipp Hagemeister
22ff1c4a93 [xhamster] Futher simplification 2014-01-23 04:04:39 +01:00
Philipp Hagemeister
35409e1101 [xhamster] Use unicode_literals 2014-01-23 03:52:59 +01:00
Mike Col
65d781128a [xhamster] Add support for hd video
Signed-off-by: Philipp Hagemeister <phihag@phihag.de>
2014-01-23 03:51:09 +01:00
Philipp Hagemeister
c35b1b07e2 release 2014.01.23 2014-01-23 00:13:00 +01:00
Philipp Hagemeister
066f6a0630 [nowness] Add support 2014-01-23 00:12:47 +01:00
Philipp Hagemeister
12ed57418c [gamespot] Fix regexp 2014-01-22 22:31:19 +01:00
Philipp Hagemeister
8b1be5cd73 Move --youtube-include-dash-manifest into correct option group 2014-01-22 22:17:53 +01:00
Philipp Hagemeister
780083dbc6 release 2014.01.22.5 2014-01-22 21:57:17 +01:00
Philipp Hagemeister
4919603f66 [youtube] Make DASH manifest download conditional for now
DASH download fails on many videos (all with encrypted signatures? not sure yet), for example 07FYdnEawAQ, with a 403.
2014-01-22 21:56:38 +01:00
Philipp Hagemeister
dd26ced164 Add __len__ to PagedLists 2014-01-22 21:43:33 +01:00
Philipp Hagemeister
bd2d82a5d3 [newgrounds] Simplify 2014-01-22 21:41:28 +01:00
Philipp Hagemeister
c4cd138b92 release 2014.01.22.4 2014-01-22 21:01:52 +01:00
Philipp Hagemeister
65697b3bf3 Merge branch 'paged-lists'
Conflicts:
	test/test_utils.py
	youtube_dl/extractor/youtube.py
2014-01-22 20:00:16 +01:00
Philipp Hagemeister
50317b111d Merge branch 'youtube-dash-manifest'
Conflicts:
	youtube_dl/extractor/youtube.py
2014-01-22 19:58:31 +01:00
Philipp Hagemeister
d7975ea287 [xvideos] Simplify 2014-01-22 19:02:48 +01:00
Mike Col
714d709a31 [xvideos] Fix thumbnail extraction
Signed-off-by: Philipp Hagemeister <phihag@phihag.de>
2014-01-22 19:01:41 +01:00
Philipp Hagemeister
11577ec054 [cspan] Disable test
It works fine from all my machines, no matter where, but from travis, we get lots of 403s.
Maybe another project is scraping CSPAN from travis and they're blocking the travis machines?
2014-01-22 15:10:02 +01:00
Philipp Hagemeister
79bf58f9b5 Document -f worstaudio as well 2014-01-22 14:55:45 +01:00
Philipp Hagemeister
cd8a562267 release 2014.01.22.3 2014-01-22 14:53:36 +01:00
Philipp Hagemeister
de3ef3ed58 Default to -f best-audio when only audio is requested 2014-01-22 14:53:23 +01:00
Philipp Hagemeister
8908741806 Use unicode_literals in test_YoutubeDL 2014-01-22 14:48:02 +01:00
Philipp Hagemeister
ba7678f9cc Add -f bestaudio (Fixes #2163) 2014-01-22 14:47:29 +01:00
Philipp Hagemeister
a70c83768e release 2014.01.22.2 2014-01-22 14:33:16 +01:00
Philipp Hagemeister
04b4d394d9 Add new --default-search option (#2193) 2014-01-22 14:16:43 +01:00
Jaime Marquínez Ferrándiz
130f12985a [comedycentral] Use the generic _real_extract provided by the base class 2014-01-22 11:44:26 +01:00
Jaime Marquínez Ferrándiz
4ca5d43cd8 Merge pull request #2195 from dstftw/master
[space] Add support for mobile URLs
2014-01-22 02:39:17 -08:00
Jaime Marquínez Ferrándiz
4bbf139aa7 [southparkstudios] Use the generic _real_extract provided by the base class 2014-01-22 11:35:17 +01:00
dst
47739636a9 [space] Add support for mobile URLs 2014-01-22 17:25:32 +07:00
Jaime Marquínez Ferrándiz
407ae733ab [cspan] Make ‘www’ optional and improve the regex for extracting the id (fixes #2194) 2014-01-22 11:06:03 +01:00
Jaime Marquínez Ferrándiz
c39f7013e1 [gametrailers] Use the generic _real_extract provided by the base class 2014-01-22 10:51:17 +01:00
Philipp Hagemeister
a4a028323e [comedycentral] Use unicode_literals 2014-01-22 03:50:49 +01:00
Philipp Hagemeister
780ee4e501 [comedycentral] Adapt testcase
In contrast to other sites, ComedyCentral seems to understand how to sensibly use MTV IE, but the additional text shouldn't hurt.
2014-01-22 03:49:17 +01:00
Philipp Hagemeister
d7b51547c0 [imdb:list] Switch to loading the webpage
The RSS method seems to be defunct.
2014-01-22 03:41:25 +01:00
Philipp Hagemeister
43030f36db [d8] typo 2014-01-22 03:10:31 +01:00
Philipp Hagemeister
48c63f1653 [d8] disable test; video got deleted 2014-01-22 03:09:21 +01:00
Philipp Hagemeister
90f479b6d5 [novamov] Skip tests 2014-01-22 03:04:10 +01:00
Philipp Hagemeister
6fd2957163 release 2014.01.22.1 2014-01-22 02:17:00 +01:00
Philipp Hagemeister
d3a1c71917 [ringtv] Fix and add news extraction 2014-01-22 02:16:40 +01:00
Philipp Hagemeister
af1588c05f [mtv] Update tests and xpath function for new title extraction 2014-01-22 02:04:51 +01:00
Philipp Hagemeister
2250865fb0 [Wimp] Use new URL relay method 2014-01-22 02:01:39 +01:00
Philipp Hagemeister
99f770caa8 [hotnewhiphop] Retrieve media key 2014-01-22 01:55:50 +01:00
Philipp Hagemeister
00122de6a9 [gametrailers/mtv] Fix pre-3.x compatibility function for find_xpath_attr
Fixes #2189
2014-01-22 01:04:12 +01:00
Philipp Hagemeister
a70515c0fd [servingsys] Do not run test on travis
Apparantly, even the advertisers do geoblocking now!?
From the US, this isn't outright blocked, but there are no videos returned.
2014-01-22 00:27:18 +01:00
Philipp Hagemeister
398edd0689 release 2014.01.22 2014-01-22 00:21:41 +01:00
Philipp Hagemeister
6562df768d Merge branch 'master' of github.com:rg3/youtube-dl
Conflicts:
	youtube_dl/extractor/mtv.py
2014-01-22 00:21:27 +01:00
Philipp Hagemeister
06769acd71 [gametrailers] Use unicode_literals
Conflicts:
	youtube_dl/extractor/gametrailers.py
2014-01-22 00:18:52 +01:00
Philipp Hagemeister
32dac6943d [mtv] Use unicode_literals 2014-01-22 00:18:09 +01:00
Philipp Hagemeister
90834c78fe [mtv] Fix title for gametrailers (Fixes #2188)
We now prefer the title including the category, because that title is what is presented at the actual sites.
2014-01-22 00:17:33 +01:00
Jaime Marquínez Ferrándiz
47917f24c4 [brightcove] Fix extraction of embedded videos
There was a leading ‘:’ in the regex.
The ‘flashvars’ parameter is not always available.
2014-01-21 22:04:46 +01:00
Jaime Marquínez Ferrándiz
d614aa40e3 [brightcove] Fix check for url in the result
It may have the ‘formats’ field instead of ‘url’.
2014-01-21 21:53:10 +01:00
Jaime Marquínez Ferrándiz
bc4ba05fcb [mtv] Add an extractor for mtviggy.com (#2072) 2014-01-21 20:59:31 +01:00
Jaime Marquínez Ferrándiz
8d9453b9e8 Add an extractor for spike.com (#2072)
Added a generic _real_extract to MTVServicesInfoExtractor
2014-01-21 20:54:47 +01:00
Jaime Marquínez Ferrándiz
e4f320a4d0 [mtv] Check for geo-blocked videos in the xml document, not in the xml’s string
Allows to use the `_download_xml` method
2014-01-21 19:59:02 +01:00
Jaime Marquínez Ferrándiz
ef9f2ba7af [mtv] Use unicode_literals 2014-01-21 19:58:21 +01:00
Philipp Hagemeister
b7ab059084 Add infrastructure for paged lists
This commit allows to download pages in playlists as needed instead of all at once.
Before this commit,
    youtube-dl http://www.youtube.com/user/ANNnewsCH/videos --playlist-end 2 --skip-download
took quite some time - now it's almost instantaneous.
As an example, the youtube:user extractor has been converted.
Fixes #2175
2014-01-20 11:36:47 +01:00
Philipp Hagemeister
dd27fd1739 [youtube] Download DASH manifest
If given, download and parse the DASH manifest file, in order to get ultra-HQ formats.
Fixes #2166
2014-01-19 05:47:20 +01:00
47 changed files with 1323 additions and 737 deletions

279
README.md
View File

@@ -16,116 +16,139 @@ which means you can modify it, redistribute it or use it however you like.
# OPTIONS # OPTIONS
-h, --help print this help text and exit -h, --help print this help text and exit
--version print program version and exit --version print program version and exit
-U, --update update this program to latest version. Make sure -U, --update update this program to latest version. Make
that you have sufficient permissions (run with sure that you have sufficient permissions
sudo if needed) (run with sudo if needed)
-i, --ignore-errors continue on download errors, for example to to -i, --ignore-errors continue on download errors, for example to
skip unavailable videos in a playlist to skip unavailable videos in a playlist
--abort-on-error Abort downloading of further videos (in the --abort-on-error Abort downloading of further videos (in the
playlist or the command line) if an error occurs playlist or the command line) if an error
occurs
--dump-user-agent display the current browser identification --dump-user-agent display the current browser identification
--user-agent UA specify a custom user agent --user-agent UA specify a custom user agent
--referer REF specify a custom referer, use if the video access --referer REF specify a custom referer, use if the video
is restricted to one domain access is restricted to one domain
--list-extractors List all supported extractors and the URLs they --list-extractors List all supported extractors and the URLs
would handle they would handle
--extractor-descriptions Output descriptions of all supported extractors --extractor-descriptions Output descriptions of all supported
--proxy URL Use the specified HTTP/HTTPS proxy. Pass in an extractors
empty string (--proxy "") for direct connection --proxy URL Use the specified HTTP/HTTPS proxy. Pass in
an empty string (--proxy "") for direct
connection
--no-check-certificate Suppress HTTPS certificate validation. --no-check-certificate Suppress HTTPS certificate validation.
--cache-dir DIR Location in the filesystem where youtube-dl can --cache-dir DIR Location in the filesystem where youtube-dl
store some downloaded information permanently. By can store some downloaded information
default $XDG_CACHE_HOME/youtube-dl or ~/.cache permanently. By default $XDG_CACHE_HOME
/youtube-dl . At the moment, only YouTube player /youtube-dl or ~/.cache/youtube-dl . At the
files (for videos with obfuscated signatures) are moment, only YouTube player files (for
videos with obfuscated signatures) are
cached, but that may change. cached, but that may change.
--no-cache-dir Disable filesystem caching --no-cache-dir Disable filesystem caching
--socket-timeout None Time to wait before giving up, in seconds --socket-timeout None Time to wait before giving up, in seconds
--bidi-workaround Work around terminals that lack bidirectional --bidi-workaround Work around terminals that lack
text support. Requires bidiv or fribidi bidirectional text support. Requires bidiv
executable in PATH or fribidi executable in PATH
--default-search PREFIX Use this prefix for unqualified URLs. For
example "gvsearch2:" downloads two videos
from google videos for youtube-dl "large
apple". By default (with value "auto")
youtube-dl guesses.
## Video Selection: ## Video Selection:
--playlist-start NUMBER playlist video to start at (default is 1) --playlist-start NUMBER playlist video to start at (default is 1)
--playlist-end NUMBER playlist video to end at (default is last) --playlist-end NUMBER playlist video to end at (default is last)
--match-title REGEX download only matching titles (regex or caseless --match-title REGEX download only matching titles (regex or
sub-string) caseless sub-string)
--reject-title REGEX skip download for matching titles (regex or --reject-title REGEX skip download for matching titles (regex or
caseless sub-string) caseless sub-string)
--max-downloads NUMBER Abort after downloading NUMBER files --max-downloads NUMBER Abort after downloading NUMBER files
--min-filesize SIZE Do not download any videos smaller than SIZE --min-filesize SIZE Do not download any videos smaller than
SIZE (e.g. 50k or 44.6m)
--max-filesize SIZE Do not download any videos larger than SIZE
(e.g. 50k or 44.6m) (e.g. 50k or 44.6m)
--max-filesize SIZE Do not download any videos larger than SIZE (e.g.
50k or 44.6m)
--date DATE download only videos uploaded in this date --date DATE download only videos uploaded in this date
--datebefore DATE download only videos uploaded 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
is given
--restrict-filenames Restrict filenames to only ASCII
characters, and avoid "&" and spaces in
filenames
-a, --batch-file FILE file containing URLs to download ('-' for
stdin)
--load-info FILE json file containing the video information --load-info FILE json file containing the video information
(created with the "--write-json" option) (created with the "--write-json" option)
-w, --no-overwrites do not overwrite files -w, --no-overwrites do not overwrite files
-c, --continue force resume of partially downloaded files. By -c, --continue force resume of partially downloaded files.
default, youtube-dl will resume downloads if By default, youtube-dl will resume
possible. downloads if possible.
--no-continue do not resume partially downloaded files (restart --no-continue do not resume partially downloaded files
from beginning) (restart from beginning)
--cookies FILE file to read cookies from and dump cookie jar in --cookies FILE file to read cookies from and dump cookie
jar in
--no-part do not use .part files --no-part do not use .part files
--no-mtime do not use the Last-modified header to set the --no-mtime do not use the Last-modified header to set
file modification time the file modification time
--write-description write video description to a .description file --write-description write video description to a .description
file
--write-info-json write video metadata to a .info.json file --write-info-json write video metadata to a .info.json file
--write-annotations write video annotations to a .annotation file --write-annotations write video annotations to a .annotation
file
--write-thumbnail write thumbnail image to disk --write-thumbnail write thumbnail image to disk
## Verbosity / Simulation Options: ## Verbosity / Simulation Options:
@@ -146,32 +169,39 @@ which means you can modify it, redistribute it or use it however you like.
--no-progress do not print progress bar --no-progress do not print progress bar
--console-title display progress in console titlebar --console-title display progress in console titlebar
-v, --verbose print various debugging information -v, --verbose print various debugging information
--dump-intermediate-pages print downloaded pages to debug problems (very --dump-intermediate-pages print downloaded pages to debug problems
verbose) (very verbose)
--write-pages Write downloaded intermediary pages to files in --write-pages Write downloaded intermediary pages to
the current directory to debug problems files in the current directory to debug
problems
--print-traffic Display sent and read HTTP traffic
## Video Format Options: ## Video Format Options:
-f, --format FORMAT video format code, specify the order of -f, --format FORMAT video format code, specify the order of
preference using slashes: "-f 22/17/18". "-f mp4" preference using slashes: "-f 22/17/18".
and "-f flv" are also supported "-f mp4" and "-f flv" are also supported.
You can also use the special names "best",
"bestaudio", "worst", and "worstaudio". By
default, youtube-dl will pick the best
quality.
--all-formats download all available video formats --all-formats download all available video formats
--prefer-free-formats prefer free video formats unless a specific one --prefer-free-formats prefer free video formats unless a specific
is requested one is requested
--max-quality FORMAT highest quality format to download --max-quality FORMAT highest quality format to download
-F, --list-formats list all available formats -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
video
--list-subs lists all available subtitles for the video
--sub-format FORMAT subtitle format (default=srt) ([sbv/vtt] youtube
only) only)
--sub-lang LANGS languages of the subtitles to download (optional) --all-subs downloads all the available subtitles of
separated by commas, use IETF language tags like the video
'en,pt' --list-subs lists all available subtitles for the video
--sub-format FORMAT subtitle format (default=srt) ([sbv/vtt]
youtube only)
--sub-lang LANGS languages of the subtitles to download
(optional) separated by commas, use IETF
language tags like 'en,pt'
## Authentication Options: ## Authentication Options:
-u, --username USERNAME account username -u, --username USERNAME account username
@@ -180,24 +210,29 @@ which means you can modify it, redistribute it or use it however you like.
--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
post-processing; the video is erased by
default
--no-post-overwrites do not overwrite post-processed files; the
post-processed files are overwritten by
default
--embed-subs embed subtitles in the video (only for mp4 --embed-subs embed subtitles in the video (only for mp4
videos) videos)
--add-metadata write metadata to the video file --add-metadata write metadata to the video file
--xattrs write metadata to the video file's xattrs (using --xattrs write metadata to the video file's xattrs
dublin core and xdg standards) (using dublin core and xdg standards)
--prefer-avconv Prefer avconv over ffmpeg for running the --prefer-avconv Prefer avconv over ffmpeg for running the
postprocessors (default) postprocessors (default)
--prefer-ffmpeg Prefer ffmpeg over avconv for running the --prefer-ffmpeg Prefer ffmpeg over avconv for running the
@@ -290,11 +325,27 @@ Since June 2012 (#342) youtube-dl is packed as an executable zipfile, simply unz
To run the exe you need to install first the [Microsoft Visual C++ 2008 Redistributable Package](http://www.microsoft.com/en-us/download/details.aspx?id=29). To run the exe you need to install first the [Microsoft Visual C++ 2008 Redistributable Package](http://www.microsoft.com/en-us/download/details.aspx?id=29).
# COPYRIGHT # BUILD INSTRUCTIONS
youtube-dl is released into the public domain by the copyright holders. Most users do not need to build youtube-dl and can [download the builds](http://rg3.github.io/youtube-dl/download.html) or get them from their distribution.
This README file was originally written by Daniel Bolton (<https://github.com/dbbolton>) and is likewise released into the public domain. To run youtube-dl as a developer, you don't need to build anything either. Simply execute
python -m youtube_dl
To run the test, simply invoke your favorite test runner, or execute a test file directly; any of the following work:
python -m unittest discover
python test/test_download.py
nosetests
If you want to create a build of youtube-dl yourself, you'll need
* python
* make
* pandoc
* zip
* nosetests
# BUGS # BUGS
@@ -353,3 +404,9 @@ Only post features that you (or an incapicated friend you can personally talk to
### Is your question about youtube-dl? ### Is your question about youtube-dl?
It may sound strange, but some bug reports we receive are completely unrelated to youtube-dl and relate to a different or even the reporter's own application. Please make sure that you are actually using youtube-dl. If you are using a UI for youtube-dl, report the bug to the maintainer of the actual application providing the UI. On the other hand, if your UI for youtube-dl fails in some way you believe is related to youtube-dl, by all means, go ahead and report the bug. It may sound strange, but some bug reports we receive are completely unrelated to youtube-dl and relate to a different or even the reporter's own application. Please make sure that you are actually using youtube-dl. If you are using a UI for youtube-dl, report the bug to the maintainer of the actual application providing the UI. On the other hand, if your UI for youtube-dl fails in some way you believe is related to youtube-dl, by all means, go ahead and report the bug.
# COPYRIGHT
youtube-dl is released into the public domain by the copyright holders.
This README file was originally written by Daniel Bolton (<https://github.com/dbbolton>) and is likewise released into the public domain.

View File

@@ -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:
params = { files_spec = [
'data_files': [ # Installing system-wide would require sudo...
('etc/bash_completion.d', ['youtube-dl.bash-completion']), ('etc/bash_completion.d', ['youtube-dl.bash-completion']),
('share/doc/youtube_dl', ['README.txt']), ('share/doc/youtube_dl', ['README.txt']),
('share/man/man1', ['youtube-dl.1']) ('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 = {
'data_files': data_files,
} }
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']}

View File

@@ -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__':

View File

@@ -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('&#1234;&#x1abC;'), '&#1234;&#x1abC;') fix_xml_ampersands('&#1234;&#x1abC;'), '&#1234;&#x1abC;')
self.assertEqual(fix_xml_ampersands('&#&#'), '&amp;#&amp;#') self.assertEqual(fix_xml_ampersands('&#&#'), '&amp;#&amp;#')
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()

View File

@@ -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)

View File

@@ -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:
@@ -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
if isinstance(ie_result['entries'], list):
n_all_entries = len(ie_result['entries'])
entries = ie_result['entries'][playliststart:playlistend] entries = ie_result['entries'][playliststart:playlistend]
n_entries = len(entries) n_entries = len(entries)
self.to_screen( self.to_screen(
"[%s] playlist '%s': Collected %d video ids (downloading %d of them)" % "[%s] playlist %s: Collected %d video ids (downloading %d of them)" %
(ie_result['extractor'], playlist, n_all_entries, n_entries)) (ie_result['extractor'], playlist, n_all_entries, n_entries))
else:
assert isinstance(ie_result['entries'], PagedList)
entries = ie_result['entries'].getslice(
playliststart, playlistend)
n_entries = len(entries)
self.to_screen(
"[%s] playlist %s: Downloading %d videos" %
(ie_result['extractor'], playlist, n_entries))
for i, entry in enumerate(entries, 1): for i, entry in enumerate(entries, 1):
self.to_screen('[download] Downloading video #%s of %s' % (i, n_entries)) self.to_screen('[download] Downloading video #%s of %s' % (i, n_entries))
@@ -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:
@@ -699,7 +720,7 @@ class YoutubeDL(object):
self.list_formats(info_dict) self.list_formats(info_dict)
return return
req_format = self.params.get('format', 'best') req_format = self.params.get('format')
if req_format is None: if req_format is None:
req_format = 'best' req_format = 'best'
formats_to_download = [] formats_to_download = []
@@ -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,6 +1112,9 @@ class YoutubeDL(object):
if fdict.get('acodec') is not None: if fdict.get('acodec') is not None:
if res: if res:
res += ', ' res += ', '
if fdict['acodec'] == 'none':
res += 'video only'
else:
res += '%-5s' % fdict['acodec'] res += '%-5s' % fdict['acodec']
elif fdict.get('abr') is not None: elif fdict.get('abr') is not None:
if res: if res:
@@ -1092,6 +1122,8 @@ class YoutubeDL(object):
res += 'audio' res += 'audio'
if fdict.get('abr') is not None: if fdict.get('abr') is not None:
res += '@%3dk' % fdict['abr'] res += '@%3dk' % fdict['abr']
if fdict.get('asr') is not None:
res += ' (%5dHz)' % fdict['asr']
if fdict.get('filesize') is not None: if fdict.get('filesize') is not None:
if res: if res:
res += ', ' res += ', '

View File

@@ -199,7 +199,9 @@ def parseOpts(overrideArguments=None):
general.add_option( general.add_option(
'--bidi-workaround', dest='bidi_workaround', action='store_true', '--bidi-workaround', dest='bidi_workaround', action='store_true',
help=u'Work around terminals that lack bidirectional text support. Requires bidiv or fribidi executable in PATH') help=u'Work around terminals that lack bidirectional text support. Requires bidiv or fribidi executable in PATH')
general.add_option('--default-search',
dest='default_search', metavar='PREFIX',
help='Use this prefix for unqualified URLs. For example "gvsearch2:" downloads two videos from google videos for youtube-dl "large apple". By default (with value "auto") youtube-dl guesses.')
selection.add_option( selection.add_option(
'--playlist-start', '--playlist-start',
@@ -242,6 +244,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 +260,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 +352,8 @@ def parseOpts(overrideArguments=None):
help=optparse.SUPPRESS_HELP) help=optparse.SUPPRESS_HELP)
verbosity.add_option('--print-traffic', verbosity.add_option('--print-traffic',
dest='debug_printtraffic', action='store_true', default=False, dest='debug_printtraffic', action='store_true', default=False,
help=optparse.SUPPRESS_HELP) help='Display sent and read HTTP traffic')
filesystem.add_option('-t', '--title', filesystem.add_option('-t', '--title',
action='store_true', dest='usetitle', help='use title in file name (default)', default=False) action='store_true', dest='usetitle', help='use title in file name (default)', default=False)
@@ -619,6 +626,12 @@ def _real_main(argv=None):
date = DateRange.day(opts.date) date = DateRange.day(opts.date)
else: else:
date = DateRange(opts.dateafter, opts.datebefore) date = DateRange(opts.dateafter, opts.datebefore)
if opts.default_search not in ('auto', None) and ':' not in opts.default_search:
parser.error(u'--default-search invalid; did you forget a colon (:) at the end?')
# Do not download videos when there are audio-only formats
if opts.extractaudio and not opts.keepvideo and opts.format is None:
opts.format = 'bestaudio/best'
# --all-sub automatically sets --write-sub if --write-auto-sub is not given # --all-sub automatically sets --write-sub if --write-auto-sub is not given
# this was the old behaviour if only --all-sub was given. # this was the old behaviour if only --all-sub was given.
@@ -720,6 +733,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:

View File

@@ -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

View File

@@ -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)

View File

@@ -72,6 +72,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 +83,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 (
@@ -105,6 +107,7 @@ from .keezmovies import KeezMoviesIE
from .khanacademy import KhanAcademyIE from .khanacademy import KhanAcademyIE
from .kickstarter import KickStarterIE from .kickstarter import KickStarterIE
from .keek import KeekIE from .keek import KeekIE
from .la7 import LA7IE
from .liveleak import LiveLeakIE from .liveleak import LiveLeakIE
from .livestream import LivestreamIE, LivestreamOriginalIE from .livestream import LivestreamIE, LivestreamOriginalIE
from .lynda import ( from .lynda import (
@@ -119,7 +122,10 @@ from .mit import TechTVMITIE, MITIE
from .mixcloud import MixcloudIE from .mixcloud import MixcloudIE
from .mpora import MporaIE from .mpora import MporaIE
from .mofosex import MofosexIE from .mofosex import MofosexIE
from .mtv import MTVIE from .mtv import (
MTVIE,
MTVIggyIE,
)
from .muzu import MuzuTVIE from .muzu import MuzuTVIE
from .myspace import MySpaceIE from .myspace import MySpaceIE
from .myspass import MySpassIE from .myspass import MySpassIE
@@ -133,6 +139,7 @@ from .nhl import NHLIE, NHLVideocenterIE
from .niconico import NiconicoIE from .niconico import NiconicoIE
from .ninegag import NineGagIE from .ninegag import NineGagIE
from .novamov import NovamovIE from .novamov import NovamovIE
from .nowness import NownessIE
from .nowvideo import NowVideoIE from .nowvideo import NowVideoIE
from .ooyala import OoyalaIE from .ooyala import OoyalaIE
from .orf import ORFIE from .orf import ORFIE
@@ -171,6 +178,7 @@ from .southparkstudios import (
from .space import SpaceIE from .space import SpaceIE
from .spankwire import SpankwireIE from .spankwire import SpankwireIE
from .spiegel import SpiegelIE from .spiegel import SpiegelIE
from .spike import SpikeIE
from .stanfordoc import StanfordOpenClassroomIE from .stanfordoc import StanfordOpenClassroomIE
from .statigram import StatigramIE from .statigram import StatigramIE
from .steam import SteamIE from .steam import SteamIE
@@ -213,7 +221,6 @@ from .vine import VineIE
from .viki import VikiIE from .viki import VikiIE
from .vk import VKIE from .vk import VKIE
from .wat import WatIE from .wat import WatIE
from .websurg import WeBSurgIE
from .weibo import WeiboIE from .weibo import WeiboIE
from .wimp import WimpIE from .wimp import WimpIE
from .wistia import WistiaIE from .wistia import WistiaIE

View File

@@ -90,9 +90,12 @@ class BrightcoveIE(InfoExtractor):
object_doc = xml.etree.ElementTree.fromstring(object_str) object_doc = xml.etree.ElementTree.fromstring(object_str)
fv_el = find_xpath_attr(object_doc, './param', 'name', 'flashVars') fv_el = find_xpath_attr(object_doc, './param', 'name', 'flashVars')
if fv_el is not None:
flashvars = dict( flashvars = dict(
(k, v[0]) (k, v[0])
for k, v in compat_parse_qs(fv_el.attrib['value']).items()) for k, v in compat_parse_qs(fv_el.attrib['value']).items())
else:
flashvars = {}
def find_param(name): def find_param(name):
if name in flashvars: if name in flashvars:
@@ -131,7 +134,7 @@ class BrightcoveIE(InfoExtractor):
m_brightcove = re.search( m_brightcove = re.search(
r'''(?sx)<object r'''(?sx)<object
(?: (?:
:[^>]+?class=([\'"])[^>]*?BrightcoveExperience.*?\1 | [^>]+?class=([\'"])[^>]*?BrightcoveExperience.*?\1 |
[^>]*?>\s*<param\s+name="movie"\s+value="https?://[^/]*brightcove\.com/ [^>]*?>\s*<param\s+name="movie"\s+value="https?://[^/]*brightcove\.com/
).+?</object>''', ).+?</object>''',
webpage) webpage)
@@ -195,7 +198,7 @@ class BrightcoveIE(InfoExtractor):
def _extract_video_info(self, video_info): def _extract_video_info(self, video_info):
info = { info = {
'id': compat_str(video_info['id']), 'id': compat_str(video_info['id']),
'title': video_info['displayName'], 'title': video_info['displayName'].strip(),
'description': video_info.get('shortDescription'), 'description': video_info.get('shortDescription'),
'thumbnail': video_info.get('videoStillURL') or video_info.get('thumbnailURL'), 'thumbnail': video_info.get('videoStillURL') or video_info.get('thumbnailURL'),
'uploader': video_info.get('publisherName'), 'uploader': video_info.get('publisherName'),
@@ -230,6 +233,6 @@ class BrightcoveIE(InfoExtractor):
else: else:
return ad_info return ad_info
if 'url' not in info: if 'url' not in info and not info.get('formats'):
raise ExtractorError('Unable to extract video url for %s' % info['id']) raise ExtractorError('Unable to extract video url for %s' % info['id'])
return info return info

View File

@@ -1,3 +1,5 @@
from __future__ import unicode_literals
import re import re
from .common import InfoExtractor from .common import InfoExtractor
@@ -15,30 +17,22 @@ class ComedyCentralIE(MTVServicesInfoExtractor):
_VALID_URL = r'''(?x)https?://(?:www.)?comedycentral.com/ _VALID_URL = r'''(?x)https?://(?:www.)?comedycentral.com/
(video-clips|episodes|cc-studios|video-collections) (video-clips|episodes|cc-studios|video-collections)
/(?P<title>.*)''' /(?P<title>.*)'''
_FEED_URL = u'http://comedycentral.com/feeds/mrss/' _FEED_URL = 'http://comedycentral.com/feeds/mrss/'
_TEST = { _TEST = {
u'url': u'http://www.comedycentral.com/video-clips/kllhuv/stand-up-greg-fitzsimmons--uncensored---too-good-of-a-mother', 'url': 'http://www.comedycentral.com/video-clips/kllhuv/stand-up-greg-fitzsimmons--uncensored---too-good-of-a-mother',
u'md5': u'4167875aae411f903b751a21f357f1ee', 'md5': '4167875aae411f903b751a21f357f1ee',
u'info_dict': { 'info_dict': {
u'id': u'cef0cbb3-e776-4bc9-b62e-8016deccb354', 'id': 'cef0cbb3-e776-4bc9-b62e-8016deccb354',
u'ext': u'mp4', 'ext': 'mp4',
u'title': u'Uncensored - Greg Fitzsimmons - Too Good of a Mother', 'title': 'CC:Stand-Up|Greg Fitzsimmons: Life on Stage|Uncensored - Too Good of a Mother',
u'description': u'After a certain point, breastfeeding becomes c**kblocking.', 'description': 'After a certain point, breastfeeding becomes c**kblocking.',
}, },
} }
def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
title = mobj.group('title')
webpage = self._download_webpage(url, title)
mgid = self._search_regex(r'data-mgid="(?P<mgid>mgid:.*?)"',
webpage, u'mgid')
return self._get_videos_info(mgid)
class ComedyCentralShowsIE(InfoExtractor): class ComedyCentralShowsIE(InfoExtractor):
IE_DESC = u'The Daily Show / Colbert Report' IE_DESC = 'The Daily Show / Colbert Report'
# urls can be abbreviations like :thedailyshow or :colbert # urls can be abbreviations like :thedailyshow or :colbert
# urls for episodes like: # urls for episodes like:
# or urls for clips like: http://www.thedailyshow.com/watch/mon-december-10-2012/any-given-gun-day # or urls for clips like: http://www.thedailyshow.com/watch/mon-december-10-2012/any-given-gun-day
@@ -55,14 +49,14 @@ class ComedyCentralShowsIE(InfoExtractor):
extended-interviews/(?P<interID>[0-9]+)/playlist_tds_extended_(?P<interview_title>.*?)/.*?))) extended-interviews/(?P<interID>[0-9]+)/playlist_tds_extended_(?P<interview_title>.*?)/.*?)))
$""" $"""
_TEST = { _TEST = {
u'url': u'http://www.thedailyshow.com/watch/thu-december-13-2012/kristen-stewart', 'url': 'http://www.thedailyshow.com/watch/thu-december-13-2012/kristen-stewart',
u'file': u'422212.mp4', 'file': '422212.mp4',
u'md5': u'4e2f5cb088a83cd8cdb7756132f9739d', 'md5': '4e2f5cb088a83cd8cdb7756132f9739d',
u'info_dict': { 'info_dict': {
u"upload_date": u"20121214", "upload_date": "20121214",
u"description": u"Kristen Stewart", "description": "Kristen Stewart",
u"uploader": u"thedailyshow", "uploader": "thedailyshow",
u"title": u"thedailyshow-kristen-stewart part 1" "title": "thedailyshow-kristen-stewart part 1"
} }
} }
@@ -94,20 +88,20 @@ class ComedyCentralShowsIE(InfoExtractor):
def _transform_rtmp_url(rtmp_video_url): def _transform_rtmp_url(rtmp_video_url):
m = re.match(r'^rtmpe?://.*?/(?P<finalid>gsp.comedystor/.*)$', rtmp_video_url) m = re.match(r'^rtmpe?://.*?/(?P<finalid>gsp.comedystor/.*)$', rtmp_video_url)
if not m: if not m:
raise ExtractorError(u'Cannot transform RTMP url') raise ExtractorError('Cannot transform RTMP url')
base = 'http://mtvnmobile.vo.llnwd.net/kip0/_pxn=1+_pxI0=Ripod-h264+_pxL0=undefined+_pxM0=+_pxK=18639+_pxE=mp4/44620/mtvnorigin/' base = 'http://mtvnmobile.vo.llnwd.net/kip0/_pxn=1+_pxI0=Ripod-h264+_pxL0=undefined+_pxM0=+_pxK=18639+_pxE=mp4/44620/mtvnorigin/'
return base + m.group('finalid') return base + m.group('finalid')
def _real_extract(self, url): def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url, re.VERBOSE) mobj = re.match(self._VALID_URL, url, re.VERBOSE)
if mobj is None: if mobj is None:
raise ExtractorError(u'Invalid URL: %s' % url) raise ExtractorError('Invalid URL: %s' % url)
if mobj.group('shortname'): if mobj.group('shortname'):
if mobj.group('shortname') in ('tds', 'thedailyshow'): if mobj.group('shortname') in ('tds', 'thedailyshow'):
url = u'http://www.thedailyshow.com/full-episodes/' url = 'http://www.thedailyshow.com/full-episodes/'
else: else:
url = u'http://www.colbertnation.com/full-episodes/' url = 'http://www.colbertnation.com/full-episodes/'
mobj = re.match(self._VALID_URL, url, re.VERBOSE) mobj = re.match(self._VALID_URL, url, re.VERBOSE)
assert mobj is not None assert mobj is not None
@@ -133,9 +127,9 @@ class ComedyCentralShowsIE(InfoExtractor):
url = htmlHandle.geturl() url = htmlHandle.geturl()
mobj = re.match(self._VALID_URL, url, re.VERBOSE) mobj = re.match(self._VALID_URL, url, re.VERBOSE)
if mobj is None: if mobj is None:
raise ExtractorError(u'Invalid redirected URL: ' + url) raise ExtractorError('Invalid redirected URL: ' + url)
if mobj.group('episode') == '': if mobj.group('episode') == '':
raise ExtractorError(u'Redirected URL is still not specific: ' + url) raise ExtractorError('Redirected URL is still not specific: ' + url)
epTitle = mobj.group('episode') epTitle = mobj.group('episode')
mMovieParams = re.findall('(?:<param name="movie" value="|var url = ")(http://media.mtvnservices.com/([^"]*(?:episode|video).*?:.*?))"', webpage) mMovieParams = re.findall('(?:<param name="movie" value="|var url = ")(http://media.mtvnservices.com/([^"]*(?:episode|video).*?:.*?))"', webpage)
@@ -147,15 +141,15 @@ class ComedyCentralShowsIE(InfoExtractor):
altMovieParams = re.findall('data-mgid="([^"]*(?:episode|video).*?:.*?)"', webpage) altMovieParams = re.findall('data-mgid="([^"]*(?:episode|video).*?:.*?)"', webpage)
if len(altMovieParams) == 0: if len(altMovieParams) == 0:
raise ExtractorError(u'unable to find Flash URL in webpage ' + url) raise ExtractorError('unable to find Flash URL in webpage ' + url)
else: else:
mMovieParams = [("http://media.mtvnservices.com/" + altMovieParams[0], altMovieParams[0])] mMovieParams = [("http://media.mtvnservices.com/" + altMovieParams[0], altMovieParams[0])]
uri = mMovieParams[0][1] uri = mMovieParams[0][1]
indexUrl = 'http://shadow.comedycentral.com/feeds/video_player/mrss/?' + compat_urllib_parse.urlencode({'uri': uri}) indexUrl = 'http://shadow.comedycentral.com/feeds/video_player/mrss/?' + compat_urllib_parse.urlencode({'uri': uri})
idoc = self._download_xml(indexUrl, epTitle, idoc = self._download_xml(indexUrl, epTitle,
u'Downloading show index', 'Downloading show index',
u'unable to download episode index') 'unable to download episode index')
results = [] results = []
@@ -170,7 +164,7 @@ class ComedyCentralShowsIE(InfoExtractor):
configUrl = ('http://www.comedycentral.com/global/feeds/entertainment/media/mediaGenEntertainment.jhtml?' + configUrl = ('http://www.comedycentral.com/global/feeds/entertainment/media/mediaGenEntertainment.jhtml?' +
compat_urllib_parse.urlencode({'uri': mediaId})) compat_urllib_parse.urlencode({'uri': mediaId}))
cdoc = self._download_xml(configUrl, epTitle, cdoc = self._download_xml(configUrl, epTitle,
u'Downloading configuration for %s' % shortMediaId) 'Downloading configuration for %s' % shortMediaId)
turls = [] turls = []
for rendition in cdoc.findall('.//rendition'): for rendition in cdoc.findall('.//rendition'):
@@ -178,7 +172,7 @@ class ComedyCentralShowsIE(InfoExtractor):
turls.append(finfo) turls.append(finfo)
if len(turls) == 0: if len(turls) == 0:
self._downloader.report_error(u'unable to download ' + mediaId + ': No videos found') self._downloader.report_error('unable to download ' + mediaId + ': No videos found')
continue continue
formats = [] formats = []
@@ -192,7 +186,7 @@ class ComedyCentralShowsIE(InfoExtractor):
'width': w, 'width': w,
}) })
effTitle = showId + u'-' + epTitle + u' part ' + compat_str(partNum+1) effTitle = showId + '-' + epTitle + ' part ' + compat_str(partNum+1)
results.append({ results.append({
'id': shortMediaId, 'id': shortMediaId,
'formats': formats, 'formats': formats,

View File

@@ -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)

View File

@@ -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 = {

View File

@@ -10,7 +10,7 @@ from ..utils import (
class CSpanIE(InfoExtractor): class CSpanIE(InfoExtractor):
_VALID_URL = r'http://www\.c-spanvideo\.org/program/(.*)' _VALID_URL = r'http://(?:www\.)?c-spanvideo\.org/program/(?P<name>.*)'
IE_DESC = 'C-SPAN' IE_DESC = 'C-SPAN'
_TEST = { _TEST = {
'url': 'http://www.c-spanvideo.org/program/HolderonV', 'url': 'http://www.c-spanvideo.org/program/HolderonV',
@@ -20,13 +20,14 @@ class CSpanIE(InfoExtractor):
'title': 'Attorney General Eric Holder on Voting Rights Act Decision', 'title': 'Attorney General Eric Holder on Voting Rights Act Decision',
'description': 'Attorney General Eric Holder spoke to reporters following the Supreme Court decision in [Shelby County v. Holder] in which the court ruled that the preclearance provisions of the Voting Rights Act could not be enforced until Congress established new guidelines for review.', 'description': 'Attorney General Eric Holder spoke to reporters following the Supreme Court decision in [Shelby County v. Holder] in which the court ruled that the preclearance provisions of the Voting Rights Act could not be enforced until Congress established new guidelines for review.',
}, },
'skip': 'Regularly fails on travis, for unknown reasons',
} }
def _real_extract(self, url): def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url) mobj = re.match(self._VALID_URL, url)
prog_name = mobj.group(1) prog_name = mobj.group('name')
webpage = self._download_webpage(url, prog_name) webpage = self._download_webpage(url, prog_name)
video_id = self._search_regex(r'programid=(.*?)&', webpage, 'video id') video_id = self._search_regex(r'prog(?:ram)?id=(.*?)&', webpage, 'video id')
title = self._html_search_regex( title = self._html_search_regex(
r'<!-- title -->\n\s*<h1[^>]*>(.*?)</h1>', webpage, 'title') r'<!-- title -->\n\s*<h1[^>]*>(.*?)</h1>', webpage, 'title')

View File

@@ -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',
} }

View 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',
}

View File

@@ -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', '')

View File

@@ -1,4 +1,4 @@
import re from __future__ import unicode_literals
from .mtv import MTVServicesInfoExtractor from .mtv import MTVServicesInfoExtractor
@@ -6,22 +6,13 @@ from .mtv import MTVServicesInfoExtractor
class GametrailersIE(MTVServicesInfoExtractor): class GametrailersIE(MTVServicesInfoExtractor):
_VALID_URL = r'http://www\.gametrailers\.com/(?P<type>videos|reviews|full-episodes)/(?P<id>.*?)/(?P<title>.*)' _VALID_URL = r'http://www\.gametrailers\.com/(?P<type>videos|reviews|full-episodes)/(?P<id>.*?)/(?P<title>.*)'
_TEST = { _TEST = {
u'url': u'http://www.gametrailers.com/videos/zbvr8i/mirror-s-edge-2-e3-2013--debut-trailer', 'url': 'http://www.gametrailers.com/videos/zbvr8i/mirror-s-edge-2-e3-2013--debut-trailer',
u'file': u'70e9a5d7-cf25-4a10-9104-6f3e7342ae0d.mp4', 'file': '70e9a5d7-cf25-4a10-9104-6f3e7342ae0d.mp4',
u'md5': u'4c8e67681a0ea7ec241e8c09b3ea8cf7', 'md5': '4c8e67681a0ea7ec241e8c09b3ea8cf7',
u'info_dict': { 'info_dict': {
u'title': u'E3 2013: Debut Trailer', 'title': 'Mirror\'s Edge 2|E3 2013: Debut Trailer',
u'description': u'Faith is back! Check out the World Premiere trailer for Mirror\'s Edge 2 straight from the EA Press Conference at E3 2013!', 'description': 'Faith is back! Check out the World Premiere trailer for Mirror\'s Edge 2 straight from the EA Press Conference at E3 2013!',
}, },
} }
_FEED_URL = 'http://www.gametrailers.com/feeds/mrss' _FEED_URL = 'http://www.gametrailers.com/feeds/mrss'
def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
video_id = mobj.group('id')
webpage = self._download_webpage(url, video_id)
mgid = self._search_regex([r'data-video="(?P<mgid>mgid:.*?)"',
r'data-contentId=\'(?P<mgid>mgid:.*?)\''],
webpage, u'mgid')
return self._get_videos_info(mgid)

View File

@@ -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:
default_search = self._downloader.params.get('default_search')
if default_search is None:
default_search = 'auto'
if default_search == 'auto':
if '/' in url:
self._downloader.report_warning('The url doesn\'t specify the protocol, trying with http') self._downloader.report_warning('The url doesn\'t specify the protocol, trying with http')
return self.url_result('http://' + url) return self.url_result('http://' + url)
else:
return self.url_result('ytsearch:' + url)
else:
assert ':' in default_search
return self.url_result(default_search + url)
video_id = os.path.splitext(url.split('/')[-1])[0] video_id = os.path.splitext(url.split('/')[-1])[0]
self.to_screen('%s: Requesting header' % video_id) self.to_screen('%s: Requesting header' % video_id)
@@ -321,10 +332,16 @@ 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:

View File

@@ -1,17 +1,25 @@
from __future__ import unicode_literals
import re import re
import base64 import base64
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import (
compat_urllib_parse,
compat_urllib_request,
ExtractorError,
HEADRequest,
)
class HotNewHipHopIE(InfoExtractor): class HotNewHipHopIE(InfoExtractor):
_VALID_URL = r'http://www\.hotnewhiphop.com/.*\.(?P<id>.*)\.html' _VALID_URL = r'http://www\.hotnewhiphop\.com/.*\.(?P<id>.*)\.html'
_TEST = { _TEST = {
u'url': u"http://www.hotnewhiphop.com/freddie-gibbs-lay-it-down-song.1435540.html", 'url': 'http://www.hotnewhiphop.com/freddie-gibbs-lay-it-down-song.1435540.html',
u'file': u'1435540.mp3', 'file': '1435540.mp3',
u'md5': u'2c2cd2f76ef11a9b3b581e8b232f3d96', 'md5': '2c2cd2f76ef11a9b3b581e8b232f3d96',
u'info_dict': { 'info_dict': {
u"title": u'Freddie Gibbs "Lay It Down"' 'title': 'Freddie Gibbs - Lay It Down'
} }
} }
@@ -21,24 +29,41 @@ class HotNewHipHopIE(InfoExtractor):
webpage_src = self._download_webpage(url, video_id) webpage_src = self._download_webpage(url, video_id)
video_url_base64 = self._search_regex(r'data-path="(.*?)"', video_url_base64 = self._search_regex(
webpage_src, u'video URL', fatal=False) r'data-path="(.*?)"', webpage_src, u'video URL', fatal=False)
if video_url_base64 == None: if video_url_base64 is None:
video_url = self._search_regex(r'"contentUrl" content="(.*?)"', webpage_src, video_url = self._search_regex(
u'video URL') r'"contentUrl" content="(.*?)"', webpage_src, u'video URL')
return self.url_result(video_url, ie='Youtube') return self.url_result(video_url, ie='Youtube')
video_url = base64.b64decode(video_url_base64).decode('utf-8') reqdata = compat_urllib_parse.urlencode([
('mediaType', 's'),
('mediaId', video_id),
])
r = compat_urllib_request.Request(
'http://www.hotnewhiphop.com/ajax/media/getActions/', data=reqdata)
r.add_header('Content-Type', 'application/x-www-form-urlencoded')
mkd = self._download_json(
r, video_id, note='Requesting media key',
errnote='Could not download media key')
if 'mediaKey' not in mkd:
raise ExtractorError('Did not get a media key')
video_title = self._html_search_regex(r"<title>(.*)</title>", redirect_url = base64.b64decode(video_url_base64).decode('utf-8')
webpage_src, u'title') redirect_req = HEADRequest(redirect_url)
req = self._request_webpage(
redirect_req, video_id,
note='Resolving final URL', errnote='Could not resolve final URL')
video_url = req.geturl()
if video_url.endswith('.html'):
raise ExtractorError('Redirect failed')
results = [{ video_title = self._og_search_title(webpage_src).strip()
return {
'id': video_id, 'id': video_id,
'url': video_url, 'url': video_url,
'title': video_title, 'title': video_title,
'thumbnail': self._og_search_thumbnail(webpage_src), 'thumbnail': self._og_search_thumbnail(webpage_src),
'ext' : 'mp3', }
}]
return results

View 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,
}

View File

@@ -68,22 +68,15 @@ class ImdbListIE(InfoExtractor):
mobj = re.match(self._VALID_URL, url) mobj = re.match(self._VALID_URL, url)
list_id = mobj.group('id') list_id = mobj.group('id')
# RSS XML is sometimes malformed webpage = self._download_webpage(url, list_id)
rss = self._download_webpage('http://rss.imdb.com/list/%s' % list_id, list_id, 'Downloading list RSS') list_code = self._search_regex(
list_title = self._html_search_regex(r'<title>(.*?)</title>', rss, 'list title') r'(?s)<div\s+class="list\sdetail">(.*?)class="see-more"',
webpage, 'list code')
entries = [
self.url_result('http://www.imdb.com' + m, 'Imdb')
for m in re.findall(r'href="(/video/imdb/vi[^"]+)"', webpage)]
# Export is independent of actual author_id, but returns 404 if no author_id is provided. list_title = self._html_search_regex(
# However, passing dummy author_id seems to be enough. r'<h1 class="header">(.*?)</h1>', webpage, 'list title')
csv = self._download_webpage('http://www.imdb.com/list/export?list_id=%s&author_id=ur00000000' % list_id,
list_id, '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)

View File

@@ -0,0 +1,62 @@
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
parse_duration,
)
class LA7IE(InfoExtractor):
IE_NAME = 'la7.tv'
_VALID_URL = r'''(?x)
https?://(?:www\.)?la7\.tv/
(?:
richplayer/\?assetid=|
\?contentId=
)
(?P<id>[0-9]+)'''
_TEST = {
'url': 'http://www.la7.tv/richplayer/?assetid=50355319',
'file': '50355319.mp4',
'md5': 'ec7d1f0224d20ba293ab56cf2259651f',
'info_dict': {
'title': 'IL DIVO',
'description': 'Un film di Paolo Sorrentino con Toni Servillo, Anna Bonaiuto, Giulio Bosetti e Flavio Bucci',
'duration': 6254,
}
}
def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
video_id = mobj.group('id')
xml_url = 'http://www.la7.tv/repliche/content/index.php?contentId=%s' % video_id
doc = self._download_xml(xml_url, video_id)
video_title = doc.find('title').text
description = doc.find('description').text
duration = parse_duration(doc.find('duration').text)
thumbnail = doc.find('img').text
view_count = int(doc.find('views').text)
prefix = doc.find('.//fqdn').text.strip().replace('auto:', 'http:')
formats = [{
'format': vnode.find('quality').text,
'tbr': int(vnode.find('quality').text),
'url': vnode.find('fms').text.strip().replace('mp4:', prefix),
} for vnode in doc.findall('.//videos/video')]
self._sort_formats(formats)
return {
'id': video_id,
'title': video_title,
'description': description,
'thumbnail': thumbnail,
'duration': duration,
'formats': formats,
'view_count': view_count,
}

View File

@@ -1,13 +1,18 @@
from __future__ import unicode_literals
import re import re
import xml.etree.ElementTree
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import (
compat_urllib_parse, compat_urllib_parse,
ExtractorError, ExtractorError,
find_xpath_attr,
fix_xml_ampersands, fix_xml_ampersands,
url_basename,
RegexNotFoundError,
) )
def _media_xml_tag(tag): def _media_xml_tag(tag):
return '{http://search.yahoo.com/mrss/}%s' % tag return '{http://search.yahoo.com/mrss/}%s' % tag
@@ -34,10 +39,9 @@ class MTVServicesInfoExtractor(InfoExtractor):
else: else:
return thumb_node.attrib['url'] return thumb_node.attrib['url']
def _extract_video_formats(self, metadataXml): def _extract_video_formats(self, mdoc):
if '/error_country_block.swf' in metadataXml: if re.match(r'.*/error_country_block\.swf$', mdoc.find('.//src').text) is not None:
raise ExtractorError(u'This video is not available from your country.', expected=True) raise ExtractorError('This video is not available from your country.', expected=True)
mdoc = xml.etree.ElementTree.fromstring(metadataXml.encode('utf-8'))
formats = [] formats = []
for rendition in mdoc.findall('.//rendition'): for rendition in mdoc.findall('.//rendition'):
@@ -60,11 +64,12 @@ class MTVServicesInfoExtractor(InfoExtractor):
self.report_extraction(video_id) self.report_extraction(video_id)
mediagen_url = itemdoc.find('%s/%s' % (_media_xml_tag('group'), _media_xml_tag('content'))).attrib['url'] mediagen_url = itemdoc.find('%s/%s' % (_media_xml_tag('group'), _media_xml_tag('content'))).attrib['url']
# Remove the templates, like &device={device} # Remove the templates, like &device={device}
mediagen_url = re.sub(r'&[^=]*?={.*?}(?=(&|$))', u'', mediagen_url) mediagen_url = re.sub(r'&[^=]*?={.*?}(?=(&|$))', '', mediagen_url)
if 'acceptMethods' not in mediagen_url: if 'acceptMethods' not in mediagen_url:
mediagen_url += '&acceptMethods=fms' mediagen_url += '&acceptMethods=fms'
mediagen_page = self._download_webpage(mediagen_url, video_id,
u'Downloading video urls') mediagen_doc = self._download_xml(mediagen_url, video_id,
'Downloading video urls')
description_node = itemdoc.find('description') description_node = itemdoc.find('description')
if description_node is not None: if description_node is not None:
@@ -72,9 +77,23 @@ class MTVServicesInfoExtractor(InfoExtractor):
else: else:
description = None description = None
title_el = None
if title_el is None:
title_el = find_xpath_attr(
itemdoc, './/{http://search.yahoo.com/mrss/}category',
'scheme', 'urn:mtvn:video_title')
if title_el is None:
title_el = itemdoc.find('.//{http://search.yahoo.com/mrss/}title')
if title_el is None:
title_el = itemdoc.find('.//title')
title = title_el.text
if title is None:
raise ExtractorError('Could not find video title')
title = title.strip()
return { return {
'title': itemdoc.find('title').text, 'title': title,
'formats': self._extract_video_formats(mediagen_page), 'formats': self._extract_video_formats(mediagen_doc),
'id': video_id, 'id': video_id,
'thumbnail': self._get_thumbnail_url(uri, itemdoc), 'thumbnail': self._get_thumbnail_url(uri, itemdoc),
'description': description, 'description': description,
@@ -86,9 +105,23 @@ class MTVServicesInfoExtractor(InfoExtractor):
idoc = self._download_xml( idoc = self._download_xml(
self._FEED_URL + '?' + data, video_id, self._FEED_URL + '?' + data, video_id,
u'Downloading info', transform_source=fix_xml_ampersands) 'Downloading info', transform_source=fix_xml_ampersands)
return [self._get_video_info(item) for item in idoc.findall('.//item')] return [self._get_video_info(item) for item in idoc.findall('.//item')]
def _real_extract(self, url):
title = url_basename(url)
webpage = self._download_webpage(url, title)
try:
# the url can be http://media.mtvnservices.com/fb/{mgid}.swf
# or http://media.mtvnservices.com/{mgid}
og_url = self._og_search_video_url(webpage)
mgid = url_basename(og_url)
if mgid.endswith('.swf'):
mgid = mgid[:-4]
except RegexNotFoundError:
mgid = self._search_regex(r'data-mgid="(.*?)"', webpage, u'mgid')
return self._get_videos_info(mgid)
class MTVIE(MTVServicesInfoExtractor): class MTVIE(MTVServicesInfoExtractor):
_VALID_URL = r'''(?x)^https?:// _VALID_URL = r'''(?x)^https?://
@@ -99,25 +132,25 @@ class MTVIE(MTVServicesInfoExtractor):
_TESTS = [ _TESTS = [
{ {
u'url': u'http://www.mtv.com/videos/misc/853555/ours-vh1-storytellers.jhtml', 'url': 'http://www.mtv.com/videos/misc/853555/ours-vh1-storytellers.jhtml',
u'file': u'853555.mp4', 'file': '853555.mp4',
u'md5': u'850f3f143316b1e71fa56a4edfd6e0f8', 'md5': '850f3f143316b1e71fa56a4edfd6e0f8',
u'info_dict': { 'info_dict': {
u'title': u'Taylor Swift - "Ours (VH1 Storytellers)"', 'title': 'Taylor Swift - "Ours (VH1 Storytellers)"',
u'description': u'Album: Taylor Swift performs "Ours" for VH1 Storytellers at Harvey Mudd College.', 'description': 'Album: Taylor Swift performs "Ours" for VH1 Storytellers at Harvey Mudd College.',
}, },
}, },
{ {
u'add_ie': ['Vevo'], 'add_ie': ['Vevo'],
u'url': u'http://www.mtv.com/videos/taylor-swift/916187/everything-has-changed-ft-ed-sheeran.jhtml', 'url': 'http://www.mtv.com/videos/taylor-swift/916187/everything-has-changed-ft-ed-sheeran.jhtml',
u'file': u'USCJY1331283.mp4', 'file': 'USCJY1331283.mp4',
u'md5': u'73b4e7fcadd88929292fe52c3ced8caf', 'md5': '73b4e7fcadd88929292fe52c3ced8caf',
u'info_dict': { 'info_dict': {
u'title': u'Everything Has Changed', 'title': 'Everything Has Changed',
u'upload_date': u'20130606', 'upload_date': '20130606',
u'uploader': u'Taylor Swift', 'uploader': 'Taylor Swift',
}, },
u'skip': u'VEVO is only available in some countries', 'skip': 'VEVO is only available in some countries',
}, },
] ]
@@ -136,8 +169,22 @@ class MTVIE(MTVServicesInfoExtractor):
webpage, re.DOTALL) webpage, re.DOTALL)
if m_vevo: if m_vevo:
vevo_id = m_vevo.group(1); vevo_id = m_vevo.group(1);
self.to_screen(u'Vevo video detected: %s' % vevo_id) self.to_screen('Vevo video detected: %s' % vevo_id)
return self.url_result('vevo:%s' % vevo_id, ie='Vevo') return self.url_result('vevo:%s' % vevo_id, ie='Vevo')
uri = self._html_search_regex(r'/uri/(.*?)\?', webpage, u'uri') uri = self._html_search_regex(r'/uri/(.*?)\?', webpage, 'uri')
return self._get_videos_info(uri) return self._get_videos_info(uri)
class MTVIggyIE(MTVServicesInfoExtractor):
IE_NAME = 'mtviggy.com'
_VALID_URL = r'https?://www\.mtviggy\.com/videos/.+'
_TEST = {
'url': 'http://www.mtviggy.com/videos/arcade-fire-behind-the-scenes-at-the-biggest-music-experiment-yet/',
'info_dict': {
'id': '984696',
'ext': 'mp4',
'title': 'Arcade Fire: Behind the Scenes at the Biggest Music Experiment Yet',
}
}
_FEED_URL = 'http://all.mtvworldverticals.com/feed-xml/'

View File

@@ -1,3 +1,5 @@
from __future__ import unicode_literals
import json import json
import re import re
@@ -8,12 +10,12 @@ from ..utils import determine_ext
class NewgroundsIE(InfoExtractor): class NewgroundsIE(InfoExtractor):
_VALID_URL = r'(?:https?://)?(?:www\.)?newgrounds\.com/audio/listen/(?P<id>\d+)' _VALID_URL = r'(?:https?://)?(?:www\.)?newgrounds\.com/audio/listen/(?P<id>\d+)'
_TEST = { _TEST = {
u'url': u'http://www.newgrounds.com/audio/listen/549479', 'url': 'http://www.newgrounds.com/audio/listen/549479',
u'file': u'549479.mp3', 'file': '549479.mp3',
u'md5': u'fe6033d297591288fa1c1f780386f07a', 'md5': 'fe6033d297591288fa1c1f780386f07a',
u'info_dict': { 'info_dict': {
u"title": u"B7 - BusMode", "title": "B7 - BusMode",
u"uploader": u"Burn7", "uploader": "Burn7",
} }
} }
@@ -22,10 +24,13 @@ class NewgroundsIE(InfoExtractor):
music_id = mobj.group('id') music_id = mobj.group('id')
webpage = self._download_webpage(url, music_id) webpage = self._download_webpage(url, music_id)
title = self._html_search_regex(r',"name":"([^"]+)",', webpage, u'music title') title = self._html_search_regex(
uploader = self._html_search_regex(r',"artist":"([^"]+)",', webpage, u'music uploader') r',"name":"([^"]+)",', webpage, 'music title')
uploader = self._html_search_regex(
r',"artist":"([^"]+)",', webpage, 'music uploader')
music_url_json_string = self._html_search_regex(r'({"url":"[^"]+"),', webpage, u'music url') + '}' music_url_json_string = self._html_search_regex(
r'({"url":"[^"]+"),', webpage, 'music url') + '}'
music_url_json = json.loads(music_url_json_string) music_url_json = json.loads(music_url_json_string)
music_url = music_url_json['url'] music_url = music_url_json['url']
@@ -34,5 +39,4 @@ class NewgroundsIE(InfoExtractor):
'title': title, 'title': title,
'url': music_url, 'url': music_url,
'uploader': uploader, 'uploader': uploader,
'ext': determine_ext(music_url),
} }

View File

@@ -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):

View 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',
}

View File

@@ -1,37 +1,44 @@
from __future__ import unicode_literals
import re import re
from .common import InfoExtractor from .common import InfoExtractor
class RingTVIE(InfoExtractor): class RingTVIE(InfoExtractor):
_VALID_URL = r'(?:http://)?(?:www\.)?ringtv\.craveonline\.com/videos/video/([^/]+)' _VALID_URL = r'(?:http://)?(?:www\.)?ringtv\.craveonline\.com/(?P<type>news|videos/video)/(?P<id>[^/?#]+)'
_TEST = { _TEST = {
u"url": u"http://ringtv.craveonline.com/videos/video/746619-canelo-alvarez-talks-about-mayweather-showdown", "url": "http://ringtv.craveonline.com/news/310833-luis-collazo-says-victor-ortiz-better-not-quit-on-jan-30",
u"file": u"746619.mp4", "file": "857645.mp4",
u"md5": u"7c46b4057d22de32e0a539f017e64ad3", "md5": "d25945f5df41cdca2d2587165ac28720",
u"info_dict": { "info_dict": {
u"title": u"Canelo Alvarez talks about Mayweather showdown", "title": 'Video: Luis Collazo says Victor Ortiz "better not quit on Jan. 30" - Ring TV',
u"description": u"Saul \\\"Canelo\\\" Alvarez spoke to the media about his Sept. 14 showdown with Floyd Mayweather after their kick-off presser in NYC. Canelo is motivated and confident that he will have the speed and gameplan to beat the pound-for-pound king." "description": 'Luis Collazo is excited about his Jan. 30 showdown with fellow former welterweight titleholder Victor Ortiz at Barclays Center in his hometown of Brooklyn. The SuperBowl week fight headlines a Golden Boy Live! card on Fox Sports 1.',
} }
} }
def _real_extract(self, url): def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url) mobj = re.match(self._VALID_URL, url)
video_id = mobj.group(1).split('-')[0] video_id = mobj.group('id').split('-')[0]
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
title = self._search_regex(r'<title>(.+?)</title>',
webpage, 'video title').replace(' | RingTV','') if mobj.group('type') == 'news':
description = self._search_regex(r'<div class="blurb">(.+?)</div>', video_id = self._search_regex(
webpage, 'Description') r'''(?x)<iframe[^>]+src="http://cms\.springboardplatform\.com/
final_url = "http://ringtv.craveonline.springboardplatform.com/storage/ringtv.craveonline.com/conversion/%s.mp4" %(str(video_id)) embed_iframe/[0-9]+/video/([0-9]+)/''',
thumbnail_url = "http://ringtv.craveonline.springboardplatform.com/storage/ringtv.craveonline.com/snapshots/%s.jpg" %(str(video_id)) webpage, 'real video ID')
ext = final_url.split('.')[-1] title = self._og_search_title(webpage)
return [{ description = self._html_search_regex(
r'addthis:description="([^"]+)"',
webpage, 'description', fatal=False)
final_url = "http://ringtv.craveonline.springboardplatform.com/storage/ringtv.craveonline.com/conversion/%s.mp4" % video_id
thumbnail_url = "http://ringtv.craveonline.springboardplatform.com/storage/ringtv.craveonline.com/snapshots/%s.jpg" % video_id
return {
'id': video_id, 'id': video_id,
'url': final_url, 'url': final_url,
'ext' : ext,
'title': title, 'title': title,
'thumbnail': thumbnail_url, 'thumbnail': thumbnail_url,
'description': description, 'description': description,
}] }

View File

@@ -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.',
}, },
} }

View File

@@ -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,19 +96,21 @@ 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:
@@ -114,23 +118,23 @@ class RTLnowIE(InfoExtractor):
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,
@@ -141,4 +145,4 @@ class RTLnowIE(InfoExtractor):
'description': video_description, 'description': video_description,
'upload_date': video_upload_date, 'upload_date': video_upload_date,
'thumbnail': video_thumbnail, 'thumbnail': video_thumbnail,
}] }

View File

@@ -36,7 +36,8 @@ class ServingSysIE(InfoExtractor):
}], }],
'params': { 'params': {
'playlistend': 2, 'playlistend': 2,
} },
'skip': 'Blocked in the US [sic]',
} }
def _real_extract(self, url): def _real_extract(self, url):

View File

@@ -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)

View File

@@ -18,14 +18,6 @@ class SouthParkStudiosIE(MTVServicesInfoExtractor):
}, },
}] }]
def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
url = u'http://www.' + mobj.group(u'url')
video_id = mobj.group('id')
webpage = self._download_webpage(url, video_id)
mgid = self._search_regex(r'swfobject.embedSWF\(".*?(mgid:.*?)"',
webpage, u'mgid')
return self._get_videos_info(mgid)
class SouthparkDeIE(SouthParkStudiosIE): class SouthparkDeIE(SouthParkStudiosIE):
IE_NAME = u'southpark.de' IE_NAME = u'southpark.de'

View File

@@ -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',

View File

@@ -0,0 +1,19 @@
from __future__ import unicode_literals
from .mtv import MTVServicesInfoExtractor
class SpikeIE(MTVServicesInfoExtractor):
_VALID_URL = r'https?://www\.spike\.com/(video-clips|episodes)/.+'
_TEST = {
'url': 'http://www.spike.com/video-clips/lhtu8m/auction-hunters-can-allen-ride-a-hundred-year-old-motorcycle',
'md5': '1a9265f32b0c375793d6c4ce45255256',
'info_dict': {
'id': 'b9c8221a-4e50-479a-b86d-3333323e38ba',
'ext': 'mp4',
'title': 'Auction Hunters|Can Allen Ride A Hundred Year-Old Motorcycle?',
'description': 'md5:fbed7e82ed5fad493615b3094a9499cb',
},
}
_FEED_URL = 'http://www.spike.com/feeds/mrss/'

View File

@@ -291,7 +291,7 @@ class VimeoIE(InfoExtractor):
class VimeoChannelIE(InfoExtractor): class VimeoChannelIE(InfoExtractor):
IE_NAME = 'vimeo:channel' IE_NAME = 'vimeo:channel'
_VALID_URL = r'(?:https?://)?vimeo.\com/channels/(?P<id>[^/]+)' _VALID_URL = r'(?:https?://)?vimeo\.com/channels/(?P<id>[^/]+)'
_MORE_PAGES_INDICATOR = r'<a.+?rel="next"' _MORE_PAGES_INDICATOR = r'<a.+?rel="next"'
_TITLE_RE = r'<link rel="alternate"[^>]+?title="(.*?)"' _TITLE_RE = r'<link rel="alternate"[^>]+?title="(.*?)"'
@@ -327,7 +327,7 @@ class VimeoChannelIE(InfoExtractor):
class VimeoUserIE(VimeoChannelIE): class VimeoUserIE(VimeoChannelIE):
IE_NAME = 'vimeo:user' IE_NAME = 'vimeo:user'
_VALID_URL = r'(?:https?://)?vimeo.\com/(?P<name>[^/]+)(?:/videos|[#?]|$)' _VALID_URL = r'(?:https?://)?vimeo\.com/(?P<name>[^/]+)(?:/videos|[#?]|$)'
_TITLE_RE = r'<a[^>]+?class="user">([^<>]+?)</a>' _TITLE_RE = r'<a[^>]+?class="user">([^<>]+?)</a>'
@classmethod @classmethod
@@ -344,7 +344,7 @@ class VimeoUserIE(VimeoChannelIE):
class VimeoAlbumIE(VimeoChannelIE): class VimeoAlbumIE(VimeoChannelIE):
IE_NAME = 'vimeo:album' IE_NAME = 'vimeo:album'
_VALID_URL = r'(?:https?://)?vimeo.\com/album/(?P<id>\d+)' _VALID_URL = r'(?:https?://)?vimeo\.com/album/(?P<id>\d+)'
_TITLE_RE = r'<header id="page_header">\n\s*<h1>(.*?)</h1>' _TITLE_RE = r'<header id="page_header">\n\s*<h1>(.*?)</h1>'
def _page_url(self, base_url, pagenum): def _page_url(self, base_url, pagenum):
@@ -358,7 +358,7 @@ class VimeoAlbumIE(VimeoChannelIE):
class VimeoGroupsIE(VimeoAlbumIE): class VimeoGroupsIE(VimeoAlbumIE):
IE_NAME = 'vimeo:group' IE_NAME = 'vimeo:group'
_VALID_URL = r'(?:https?://)?vimeo.\com/groups/(?P<name>[^/]+)' _VALID_URL = r'(?:https?://)?vimeo\.com/groups/(?P<name>[^/]+)'
def _extract_list_title(self, webpage): def _extract_list_title(self, webpage):
return self._og_search_title(webpage) return self._og_search_title(webpage)
@@ -372,7 +372,7 @@ class VimeoGroupsIE(VimeoAlbumIE):
class VimeoReviewIE(InfoExtractor): class VimeoReviewIE(InfoExtractor):
IE_NAME = 'vimeo:review' IE_NAME = 'vimeo:review'
IE_DESC = 'Review pages on vimeo' IE_DESC = 'Review pages on vimeo'
_VALID_URL = r'(?:https?://)?vimeo.\com/[^/]+/review/(?P<id>[^/]+)' _VALID_URL = r'(?:https?://)?vimeo\.com/[^/]+/review/(?P<id>[^/]+)'
_TEST = { _TEST = {
'url': 'https://vimeo.com/user21297594/review/75524534/3c257a1b5d', 'url': 'https://vimeo.com/user21297594/review/75524534/3c257a1b5d',
'file': '75524534.mp4', 'file': '75524534.mp4',

View File

@@ -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)
}

View File

@@ -1,5 +1,6 @@
from __future__ import unicode_literals
import re import re
import base64
from .common import InfoExtractor from .common import InfoExtractor
@@ -7,12 +8,12 @@ from .common import InfoExtractor
class WimpIE(InfoExtractor): class WimpIE(InfoExtractor):
_VALID_URL = r'(?:http://)?(?:www\.)?wimp\.com/([^/]+)/' _VALID_URL = r'(?:http://)?(?:www\.)?wimp\.com/([^/]+)/'
_TEST = { _TEST = {
u'url': u'http://www.wimp.com/deerfence/', 'url': 'http://www.wimp.com/deerfence/',
u'file': u'deerfence.flv', 'file': 'deerfence.flv',
u'md5': u'8b215e2e0168c6081a1cf84b2846a2b5', 'md5': '8b215e2e0168c6081a1cf84b2846a2b5',
u'info_dict': { 'info_dict': {
u"title": u"Watch Till End: Herd of deer jump over a fence.", "title": "Watch Till End: Herd of deer jump over a fence.",
u"description": u"These deer look as fluid as running water when they jump over this fence as a herd. This video is one that needs to be watched until the very end for the true majesty to be witnessed, but once it comes, it's sure to take your breath away.", "description": "These deer look as fluid as running water when they jump over this fence as a herd. This video is one that needs to be watched until the very end for the true majesty to be witnessed, but once it comes, it's sure to take your breath away.",
} }
} }
@@ -20,13 +21,12 @@ class WimpIE(InfoExtractor):
mobj = re.match(self._VALID_URL, url) mobj = re.match(self._VALID_URL, url)
video_id = mobj.group(1) video_id = mobj.group(1)
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
googleString = self._search_regex("googleCode = '(.*?)'", webpage, 'file url') video_url = self._search_regex(
googleString = base64.b64decode(googleString).decode('ascii') r's1\.addVariable\("file",\s*"([^"]+)"\);', webpage, 'video URL')
final_url = self._search_regex('","(.*?)"', googleString, u'final video url')
return { return {
'id': video_id, 'id': video_id,
'url': final_url, 'url': video_url,
'title': self._og_search_title(webpage), 'title': self._og_search_title(webpage),
'thumbnail': self._og_search_thumbnail(webpage), 'thumbnail': self._og_search_thumbnail(webpage),
'description': self._og_search_description(webpage), 'description': self._og_search_description(webpage),

View File

@@ -1,10 +1,11 @@
from __future__ import unicode_literals
import re import re
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import (
compat_urllib_parse, compat_urllib_parse,
unescapeHTML, unescapeHTML,
determine_ext,
ExtractorError, ExtractorError,
) )
@@ -13,25 +14,25 @@ class XHamsterIE(InfoExtractor):
"""Information Extractor for xHamster""" """Information Extractor for xHamster"""
_VALID_URL = r'(?:http://)?(?:www\.)?xhamster\.com/movies/(?P<id>[0-9]+)/(?P<seo>.+?)\.html(?:\?.*)?' _VALID_URL = r'(?:http://)?(?:www\.)?xhamster\.com/movies/(?P<id>[0-9]+)/(?P<seo>.+?)\.html(?:\?.*)?'
_TESTS = [{ _TESTS = [{
u'url': u'http://xhamster.com/movies/1509445/femaleagent_shy_beauty_takes_the_bait.html', 'url': 'http://xhamster.com/movies/1509445/femaleagent_shy_beauty_takes_the_bait.html',
u'file': u'1509445.flv', 'file': '1509445.mp4',
u'md5': u'9f48e0e8d58e3076bb236ff412ab62fa', 'md5': '8281348b8d3c53d39fffb377d24eac4e',
u'info_dict': { 'info_dict': {
u"upload_date": u"20121014", "upload_date": "20121014",
u"uploader_id": u"Ruseful2011", "uploader_id": "Ruseful2011",
u"title": u"FemaleAgent Shy beauty takes the bait", "title": "FemaleAgent Shy beauty takes the bait",
u"age_limit": 18, "age_limit": 18,
} }
}, },
{ {
u'url': u'http://xhamster.com/movies/2221348/britney_spears_sexy_booty.html?hd', 'url': 'http://xhamster.com/movies/2221348/britney_spears_sexy_booty.html?hd',
u'file': u'2221348.flv', 'file': '2221348.flv',
u'md5': u'e767b9475de189320f691f49c679c4c7', 'md5': 'e767b9475de189320f691f49c679c4c7',
u'info_dict': { 'info_dict': {
u"upload_date": u"20130914", "upload_date": "20130914",
u"uploader_id": u"jojo747400", "uploader_id": "jojo747400",
u"title": u"Britney Spears Sexy Booty", "title": "Britney Spears Sexy Booty",
u"age_limit": 18, "age_limit": 18,
} }
}] }]
@@ -39,14 +40,21 @@ class XHamsterIE(InfoExtractor):
def extract_video_url(webpage): def extract_video_url(webpage):
mobj = re.search(r'\'srv\': \'(?P<server>[^\']*)\',\s*\'file\': \'(?P<file>[^\']+)\',', webpage) mobj = re.search(r'\'srv\': \'(?P<server>[^\']*)\',\s*\'file\': \'(?P<file>[^\']+)\',', webpage)
if mobj is None: if mobj is None:
raise ExtractorError(u'Unable to extract media URL') raise ExtractorError('Unable to extract media URL')
if len(mobj.group('server')) == 0: if len(mobj.group('server')) == 0:
return compat_urllib_parse.unquote(mobj.group('file')) return compat_urllib_parse.unquote(mobj.group('file'))
else: else:
return mobj.group('server')+'/key='+mobj.group('file') return mobj.group('server')+'/key='+mobj.group('file')
def extract_mp4_video_url(webpage):
mp4 = re.search(r'<a href=\"(.+?)\" class=\"mp4Play\"',webpage)
if mp4 is None:
return None
else:
return mp4.group(1)
def is_hd(webpage): def is_hd(webpage):
return webpage.find('<div class=\'icon iconHD\'') != -1 return '<div class=\'icon iconHD\'' in webpage
mobj = re.match(self._VALID_URL, url) mobj = re.match(self._VALID_URL, url)
@@ -55,50 +63,60 @@ class XHamsterIE(InfoExtractor):
mrss_url = 'http://xhamster.com/movies/%s/%s.html' % (video_id, seo) mrss_url = 'http://xhamster.com/movies/%s/%s.html' % (video_id, seo)
webpage = self._download_webpage(mrss_url, video_id) webpage = self._download_webpage(mrss_url, video_id)
video_title = self._html_search_regex(r'<title>(?P<title>.+?) - xHamster\.com</title>', video_title = self._html_search_regex(
webpage, u'title') r'<title>(?P<title>.+?) - xHamster\.com</title>', webpage, 'title')
# Only a few videos have an description # Only a few videos have an description
mobj = re.search('<span>Description: </span>(?P<description>[^<]+)', webpage) mobj = re.search(r'<span>Description: </span>([^<]+)', webpage)
if mobj: video_description = mobj.group(1) if mobj else None
video_description = unescapeHTML(mobj.group('description'))
else:
video_description = None
mobj = re.search(r'hint=\'(?P<upload_date_Y>[0-9]{4})-(?P<upload_date_m>[0-9]{2})-(?P<upload_date_d>[0-9]{2}) [0-9]{2}:[0-9]{2}:[0-9]{2} [A-Z]{3,4}\'', webpage) mobj = re.search(r'hint=\'(?P<upload_date_Y>[0-9]{4})-(?P<upload_date_m>[0-9]{2})-(?P<upload_date_d>[0-9]{2}) [0-9]{2}:[0-9]{2}:[0-9]{2} [A-Z]{3,4}\'', webpage)
if mobj: if mobj:
video_upload_date = mobj.group('upload_date_Y')+mobj.group('upload_date_m')+mobj.group('upload_date_d') video_upload_date = mobj.group('upload_date_Y')+mobj.group('upload_date_m')+mobj.group('upload_date_d')
else: else:
video_upload_date = None video_upload_date = None
self._downloader.report_warning(u'Unable to extract upload date') self._downloader.report_warning('Unable to extract upload date')
video_uploader_id = self._html_search_regex(r'<a href=\'/user/[^>]+>(?P<uploader_id>[^<]+)', video_uploader_id = self._html_search_regex(
webpage, u'uploader id', default=u'anonymous') r'<a href=\'/user/[^>]+>(?P<uploader_id>[^<]+)',
webpage, 'uploader id', default='anonymous')
video_thumbnail = self._search_regex(r'\'image\':\'(?P<thumbnail>[^\']+)\'', video_thumbnail = self._search_regex(
webpage, u'thumbnail', fatal=False) r'\'image\':\'(?P<thumbnail>[^\']+)\'',
webpage, 'thumbnail', fatal=False)
age_limit = self._rta_search(webpage) age_limit = self._rta_search(webpage)
video_url = extract_video_url(webpage)
hd = is_hd(webpage) hd = is_hd(webpage)
video_url = extract_video_url(webpage)
formats = [{ formats = [{
'url': video_url, 'url': video_url,
'ext': determine_ext(video_url),
'format': 'hd' if hd else 'sd',
'format_id': 'hd' if hd else 'sd', 'format_id': 'hd' if hd else 'sd',
'preference': 0,
}] }]
video_mp4_url = extract_mp4_video_url(webpage)
if video_mp4_url is not None:
formats.append({
'url': video_mp4_url,
'ext': 'mp4',
'format_id': 'mp4-hd' if hd else 'mp4-sd',
'preference': 1,
})
if not hd: if not hd:
webpage = self._download_webpage(mrss_url+'?hd', video_id) webpage = self._download_webpage(
mrss_url + '?hd', video_id, note='Downloading HD webpage')
if is_hd(webpage): if is_hd(webpage):
video_url = extract_video_url(webpage) video_url = extract_video_url(webpage)
formats.append({ formats.append({
'url': video_url, 'url': video_url,
'ext': determine_ext(video_url),
'format': 'hd',
'format_id': 'hd', 'format_id': 'hd',
'preference': 2,
}) })
self._sort_formats(formats)
return { return {
'id': video_id, 'id': video_id,
'title': video_title, 'title': video_title,

View File

@@ -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=(.+?)&amp', 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]

View File

@@ -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",
},
},
] ]
@@ -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,
note=u'Downloading DASH manifest',
errnote=u'Could not download DASH manifest')
for r in dash_doc.findall(u'.//{urn:mpeg:DASH:schema:MPD:2011}Representation'):
url_el = r.find('{urn:mpeg:DASH:schema:MPD:2011}BaseURL')
if url_el is None:
continue
format_id = r.attrib['id']
video_url = url_el.text
filesize = int_or_none(url_el.attrib.get('{http://youtube.com/yt/2012/10/10}contentLength'))
f = {
'format_id': format_id,
'url': video_url,
'width': int_or_none(r.attrib.get('width')),
'tbr': int_or_none(r.attrib.get('bandwidth'), 1000),
'asr': int_or_none(r.attrib.get('audioSamplingRate')),
'filesize': filesize,
} }
dct.update(self._formats[itag]) try:
formats.append(dct) existing_format = next(
fo for fo in formats
if fo['format_id'] == format_id)
except StopIteration:
f.update(self._formats.get(format_id, {}))
formats.append(f)
else:
existing_format.update(f)
except (ExtractorError, KeyError) as e:
self.report_warning(u'Skipping DASH manifest: %s' % e, video_id)
self._sort_formats(formats) self._sort_formats(formats)
@@ -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(

View File

@@ -6,6 +6,7 @@ import datetime
import email.utils import email.utils
import errno import errno
import gzip import gzip
import itertools
import io import io
import json import json
import locale import locale
@@ -224,7 +225,7 @@ if sys.version_info >= (2,7):
def find_xpath_attr(node, xpath, key, val): def find_xpath_attr(node, xpath, key, val):
""" Find the xpath xpath[@key=val] """ """ Find the xpath xpath[@key=val] """
assert re.match(r'^[a-zA-Z]+$', key) assert re.match(r'^[a-zA-Z]+$', key)
assert re.match(r'^[a-zA-Z0-9@\s]*$', val) assert re.match(r'^[a-zA-Z0-9@\s:._]*$', val)
expr = xpath + u"[@%s='%s']" % (key, val) expr = xpath + u"[@%s='%s']" % (key, val)
return node.find(expr) return node.find(expr)
else: else:
@@ -1131,8 +1132,8 @@ class HEADRequest(compat_urllib_request.Request):
return "HEAD" return "HEAD"
def int_or_none(v): def int_or_none(v, scale=1):
return v if v is None else int(v) return v if v is None else (int(v) // scale)
def parse_duration(s): def parse_duration(s):
@@ -1164,3 +1165,50 @@ def check_executable(exe, args=[]):
except OSError: except OSError:
return False return False
return exe return exe
class PagedList(object):
def __init__(self, pagefunc, pagesize):
self._pagefunc = pagefunc
self._pagesize = pagesize
def __len__(self):
# This is only useful for tests
return len(self.getslice())
def getslice(self, start=0, end=None):
res = []
for pagenum in itertools.count(start // self._pagesize):
firstid = pagenum * self._pagesize
nextfirstid = pagenum * self._pagesize + self._pagesize
if start >= nextfirstid:
continue
page_results = list(self._pagefunc(pagenum))
startv = (
start % self._pagesize
if firstid <= start < nextfirstid
else 0)
endv = (
((end - 1) % self._pagesize) + 1
if (end is not None and firstid <= end <= nextfirstid)
else None)
if startv != 0 or endv is not None:
page_results = page_results[startv:endv]
res.extend(page_results)
# A little optimization - if current page is not "full", ie. does
# not contain page_size videos then we can assume that this page
# is the last one - there are no more ids on further pages -
# i.e. no need to query again.
if len(page_results) + startv < self._pagesize:
break
# If we got the whole page, but the next page is not interesting,
# break out early as well
if end == nextfirstid:
break
return res

View File

@@ -1,2 +1,2 @@
__version__ = '2014.01.21.1' __version__ = '2014.01.27.1'