Compare commits
80 Commits
2014.09.14
...
2014.09.22
Author | SHA1 | Date | |
---|---|---|---|
|
f90d95edeb | ||
|
45c85d7ba1 | ||
|
d0df92928b | ||
|
df8f53f752 | ||
|
e35cb78c40 | ||
|
3ef7d11acd | ||
|
224ce0d872 | ||
|
dd41e8c82b | ||
|
b509a4b176 | ||
|
b28c8403b2 | ||
|
7bd4b4229a | ||
|
72e450c555 | ||
|
522c55b7f2 | ||
|
58e7071a2c | ||
|
516812df41 | ||
|
752297631f | ||
|
34e14a9beb | ||
|
ffb5b05db1 | ||
|
3e8fcd9fa1 | ||
|
532f5bff70 | ||
|
f566d9f1d5 | ||
|
7267bd536f | ||
|
589d3d7c7a | ||
|
46f74bcf5c | ||
|
37bfe8ace4 | ||
|
0529eef5a4 | ||
|
fd78a4d3e6 | ||
|
1de33fafd9 | ||
|
e2e5dae64d | ||
|
09b23c902b | ||
|
109a540e7a | ||
|
2914e5f00f | ||
|
2f834e9381 | ||
|
9296738f20 | ||
|
0e59b9fffb | ||
|
67abbe9527 | ||
|
944a3de278 | ||
|
5a13fe9ed2 | ||
|
6b6096d0b7 | ||
|
d0246d07f1 | ||
|
727a98c3ee | ||
|
997987d568 | ||
|
c001f939e4 | ||
|
e825c38082 | ||
|
a04aa7a9e6 | ||
|
7cdd5339b3 | ||
|
38349518f1 | ||
|
64892c0b79 | ||
|
dc9f356846 | ||
|
ed86ee3b4a | ||
|
7bb5df1cda | ||
|
37a81dff04 | ||
|
fc96eb4e21 | ||
|
ae369738b0 | ||
|
e2037b3f7d | ||
|
5419033935 | ||
|
2eebf060af | ||
|
acd9db5902 | ||
|
d0e8b3d59b | ||
|
c15dd15388 | ||
|
0003a5c416 | ||
|
21f2927f70 | ||
|
e5a79071a5 | ||
|
ca0e7a2b17 | ||
|
b523bb71ab | ||
|
a020a0dc20 | ||
|
6d1f2431bd | ||
|
fdea3abdf8 | ||
|
59d284c316 | ||
|
98703c7fbf | ||
|
b04c8f7358 | ||
|
56d1912f1d | ||
|
eb3bd7ba8d | ||
|
2bca84e345 | ||
|
984e8e14ea | ||
|
d05cfe0600 | ||
|
37419b4f99 | ||
|
a8aa99442f | ||
|
94b539d155 | ||
|
b8874d4d4e |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -11,6 +11,7 @@ MANIFEST
|
|||||||
README.txt
|
README.txt
|
||||||
youtube-dl.1
|
youtube-dl.1
|
||||||
youtube-dl.bash-completion
|
youtube-dl.bash-completion
|
||||||
|
youtube-dl.fish
|
||||||
youtube-dl
|
youtube-dl
|
||||||
youtube-dl.exe
|
youtube-dl.exe
|
||||||
youtube-dl.tar.gz
|
youtube-dl.tar.gz
|
||||||
|
@@ -2,5 +2,6 @@ include README.md
|
|||||||
include test/*.py
|
include test/*.py
|
||||||
include test/*.json
|
include test/*.json
|
||||||
include youtube-dl.bash-completion
|
include youtube-dl.bash-completion
|
||||||
|
include youtube-dl.fish
|
||||||
include youtube-dl.1
|
include youtube-dl.1
|
||||||
recursive-include docs Makefile conf.py *.rst
|
recursive-include docs Makefile conf.py *.rst
|
||||||
|
20
Makefile
20
Makefile
@@ -1,7 +1,7 @@
|
|||||||
all: youtube-dl README.md README.txt youtube-dl.1 youtube-dl.bash-completion
|
all: youtube-dl README.md README.txt youtube-dl.1 youtube-dl.bash-completion youtube-dl.fish
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf youtube-dl.1.temp.md youtube-dl.1 youtube-dl.bash-completion README.txt MANIFEST build/ dist/ .coverage cover/ youtube-dl.tar.gz
|
rm -rf youtube-dl.1.temp.md youtube-dl.1 youtube-dl.bash-completion README.txt MANIFEST build/ dist/ .coverage cover/ youtube-dl.tar.gz youtube-dl.fish
|
||||||
|
|
||||||
cleanall: clean
|
cleanall: clean
|
||||||
rm -f youtube-dl youtube-dl.exe
|
rm -f youtube-dl youtube-dl.exe
|
||||||
@@ -29,6 +29,8 @@ install: youtube-dl youtube-dl.1 youtube-dl.bash-completion
|
|||||||
install -m 644 youtube-dl.1 $(DESTDIR)$(MANDIR)/man1
|
install -m 644 youtube-dl.1 $(DESTDIR)$(MANDIR)/man1
|
||||||
install -d $(DESTDIR)$(SYSCONFDIR)/bash_completion.d
|
install -d $(DESTDIR)$(SYSCONFDIR)/bash_completion.d
|
||||||
install -m 644 youtube-dl.bash-completion $(DESTDIR)$(SYSCONFDIR)/bash_completion.d/youtube-dl
|
install -m 644 youtube-dl.bash-completion $(DESTDIR)$(SYSCONFDIR)/bash_completion.d/youtube-dl
|
||||||
|
install -d $(DESTDIR)$(SYSCONFDIR)/fish/completions
|
||||||
|
install -m 644 youtube-dl.fish $(DESTDIR)$(SYSCONFDIR)/fish/completions/youtube-dl.fish
|
||||||
|
|
||||||
test:
|
test:
|
||||||
#nosetests --with-coverage --cover-package=youtube_dl --cover-html --verbose --processes 4 test
|
#nosetests --with-coverage --cover-package=youtube_dl --cover-html --verbose --processes 4 test
|
||||||
@@ -36,9 +38,9 @@ test:
|
|||||||
|
|
||||||
tar: youtube-dl.tar.gz
|
tar: youtube-dl.tar.gz
|
||||||
|
|
||||||
.PHONY: all clean install test tar bash-completion pypi-files
|
.PHONY: all clean install test tar bash-completion pypi-files fish-completion
|
||||||
|
|
||||||
pypi-files: youtube-dl.bash-completion README.txt youtube-dl.1
|
pypi-files: youtube-dl.bash-completion README.txt youtube-dl.1 youtube-dl.fish
|
||||||
|
|
||||||
youtube-dl: youtube_dl/*.py youtube_dl/*/*.py
|
youtube-dl: youtube_dl/*.py youtube_dl/*/*.py
|
||||||
zip --quiet youtube-dl youtube_dl/*.py youtube_dl/*/*.py
|
zip --quiet youtube-dl youtube_dl/*.py youtube_dl/*/*.py
|
||||||
@@ -64,7 +66,12 @@ youtube-dl.bash-completion: youtube_dl/*.py youtube_dl/*/*.py devscripts/bash-co
|
|||||||
|
|
||||||
bash-completion: youtube-dl.bash-completion
|
bash-completion: youtube-dl.bash-completion
|
||||||
|
|
||||||
youtube-dl.tar.gz: youtube-dl README.md README.txt youtube-dl.1 youtube-dl.bash-completion
|
youtube-dl.fish: youtube_dl/*.py youtube_dl/*/*.py devscripts/fish-completion.in
|
||||||
|
python devscripts/fish-completion.py
|
||||||
|
|
||||||
|
fish-completion: youtube-dl.fish
|
||||||
|
|
||||||
|
youtube-dl.tar.gz: youtube-dl README.md README.txt youtube-dl.1 youtube-dl.bash-completion youtube-dl.fish
|
||||||
@tar -czf youtube-dl.tar.gz --transform "s|^|youtube-dl/|" --owner 0 --group 0 \
|
@tar -czf youtube-dl.tar.gz --transform "s|^|youtube-dl/|" --owner 0 --group 0 \
|
||||||
--exclude '*.DS_Store' \
|
--exclude '*.DS_Store' \
|
||||||
--exclude '*.kate-swp' \
|
--exclude '*.kate-swp' \
|
||||||
@@ -78,5 +85,6 @@ youtube-dl.tar.gz: youtube-dl README.md README.txt youtube-dl.1 youtube-dl.bash-
|
|||||||
-- \
|
-- \
|
||||||
bin devscripts test youtube_dl docs \
|
bin devscripts test youtube_dl docs \
|
||||||
LICENSE README.md README.txt \
|
LICENSE README.md README.txt \
|
||||||
Makefile MANIFEST.in youtube-dl.1 youtube-dl.bash-completion setup.py \
|
Makefile MANIFEST.in youtube-dl.1 youtube-dl.bash-completion \
|
||||||
|
youtube-dl.fish setup.py \
|
||||||
youtube-dl
|
youtube-dl
|
||||||
|
15
README.md
15
README.md
@@ -227,12 +227,15 @@ which means you can modify it, redistribute it or use it however you like.
|
|||||||
|
|
||||||
## 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".
|
preference using slashes: -f 22/17/18 . -f
|
||||||
"-f mp4" and "-f flv" are also supported.
|
mp4 , -f m4a and -f flv are also
|
||||||
You can also use the special names "best",
|
supported. You can also use the special
|
||||||
"bestvideo", "bestaudio", "worst",
|
names "best", "bestvideo", "bestaudio",
|
||||||
"worstvideo" and "worstaudio". By default,
|
"worst", "worstvideo" and "worstaudio". By
|
||||||
youtube-dl will pick the best quality.
|
default, youtube-dl will pick the best
|
||||||
|
quality. Use commas to download multiple
|
||||||
|
audio formats, such as -f
|
||||||
|
136/137/mp4/bestvideo,140/m4a/bestaudio
|
||||||
--all-formats download all available video formats
|
--all-formats download all available video formats
|
||||||
--prefer-free-formats prefer free video formats unless a specific
|
--prefer-free-formats prefer free video formats unless a specific
|
||||||
one is requested
|
one is requested
|
||||||
|
5
devscripts/fish-completion.in
Normal file
5
devscripts/fish-completion.in
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
|
||||||
|
{{commands}}
|
||||||
|
|
||||||
|
|
||||||
|
complete --command youtube-dl --arguments ":ytfavorites :ytrecommended :ytsubscriptions :ytwatchlater :ythistory"
|
48
devscripts/fish-completion.py
Executable file
48
devscripts/fish-completion.py
Executable file
@@ -0,0 +1,48 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import optparse
|
||||||
|
import os
|
||||||
|
from os.path import dirname as dirn
|
||||||
|
import sys
|
||||||
|
|
||||||
|
sys.path.append(dirn(dirn((os.path.abspath(__file__)))))
|
||||||
|
import youtube_dl
|
||||||
|
from youtube_dl.utils import shell_quote
|
||||||
|
|
||||||
|
FISH_COMPLETION_FILE = 'youtube-dl.fish'
|
||||||
|
FISH_COMPLETION_TEMPLATE = 'devscripts/fish-completion.in'
|
||||||
|
|
||||||
|
EXTRA_ARGS = {
|
||||||
|
'recode-video': ['--arguments', 'mp4 flv ogg webm mkv', '--exclusive'],
|
||||||
|
|
||||||
|
# Options that need a file parameter
|
||||||
|
'download-archive': ['--require-parameter'],
|
||||||
|
'cookies': ['--require-parameter'],
|
||||||
|
'load-info': ['--require-parameter'],
|
||||||
|
'batch-file': ['--require-parameter'],
|
||||||
|
}
|
||||||
|
|
||||||
|
def build_completion(opt_parser):
|
||||||
|
commands = []
|
||||||
|
|
||||||
|
for group in opt_parser.option_groups:
|
||||||
|
for option in group.option_list:
|
||||||
|
long_option = option.get_opt_string().strip('-')
|
||||||
|
help_msg = shell_quote([option.help])
|
||||||
|
complete_cmd = ['complete', '--command', 'youtube-dl', '--long-option', long_option]
|
||||||
|
if option._short_opts:
|
||||||
|
complete_cmd += ['--short-option', option._short_opts[0].strip('-')]
|
||||||
|
if option.help != optparse.SUPPRESS_HELP:
|
||||||
|
complete_cmd += ['--description', option.help]
|
||||||
|
complete_cmd.extend(EXTRA_ARGS.get(long_option, []))
|
||||||
|
commands.append(shell_quote(complete_cmd))
|
||||||
|
|
||||||
|
with open(FISH_COMPLETION_TEMPLATE) as f:
|
||||||
|
template = f.read()
|
||||||
|
filled_template = template.replace('{{commands}}', '\n'.join(commands))
|
||||||
|
with open(FISH_COMPLETION_FILE, 'w') as f:
|
||||||
|
f.write(filled_template)
|
||||||
|
|
||||||
|
parser = youtube_dl.parseOpts()[0]
|
||||||
|
build_completion(parser)
|
1
setup.py
1
setup.py
@@ -48,6 +48,7 @@ if len(sys.argv) >= 2 and sys.argv[1] == 'py2exe':
|
|||||||
else:
|
else:
|
||||||
files_spec = [
|
files_spec = [
|
||||||
('etc/bash_completion.d', ['youtube-dl.bash-completion']),
|
('etc/bash_completion.d', ['youtube-dl.bash-completion']),
|
||||||
|
('etc/fish/completions', ['youtube-dl.fish']),
|
||||||
('share/doc/youtube_dl', ['README.txt']),
|
('share/doc/youtube_dl', ['README.txt']),
|
||||||
('share/man/man1', ['youtube-dl.1'])
|
('share/man/man1', ['youtube-dl.1'])
|
||||||
]
|
]
|
||||||
|
@@ -40,6 +40,9 @@ from youtube_dl.utils import (
|
|||||||
parse_iso8601,
|
parse_iso8601,
|
||||||
strip_jsonp,
|
strip_jsonp,
|
||||||
uppercase_escape,
|
uppercase_escape,
|
||||||
|
limit_length,
|
||||||
|
escape_rfc3986,
|
||||||
|
escape_url,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -286,5 +289,41 @@ class TestUtil(unittest.TestCase):
|
|||||||
self.assertEqual(uppercase_escape('aä'), 'aä')
|
self.assertEqual(uppercase_escape('aä'), 'aä')
|
||||||
self.assertEqual(uppercase_escape('\\U0001d550'), '𝕐')
|
self.assertEqual(uppercase_escape('\\U0001d550'), '𝕐')
|
||||||
|
|
||||||
|
def test_limit_length(self):
|
||||||
|
self.assertEqual(limit_length(None, 12), None)
|
||||||
|
self.assertEqual(limit_length('foo', 12), 'foo')
|
||||||
|
self.assertTrue(
|
||||||
|
limit_length('foo bar baz asd', 12).startswith('foo bar'))
|
||||||
|
self.assertTrue('...' in limit_length('foo bar baz asd', 12))
|
||||||
|
|
||||||
|
def test_escape_rfc3986(self):
|
||||||
|
reserved = "!*'();:@&=+$,/?#[]"
|
||||||
|
unreserved = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.~'
|
||||||
|
self.assertEqual(escape_rfc3986(reserved), reserved)
|
||||||
|
self.assertEqual(escape_rfc3986(unreserved), unreserved)
|
||||||
|
self.assertEqual(escape_rfc3986('тест'), '%D1%82%D0%B5%D1%81%D1%82')
|
||||||
|
self.assertEqual(escape_rfc3986('%D1%82%D0%B5%D1%81%D1%82'), '%D1%82%D0%B5%D1%81%D1%82')
|
||||||
|
self.assertEqual(escape_rfc3986('foo bar'), 'foo%20bar')
|
||||||
|
self.assertEqual(escape_rfc3986('foo%20bar'), 'foo%20bar')
|
||||||
|
|
||||||
|
def test_escape_url(self):
|
||||||
|
self.assertEqual(
|
||||||
|
escape_url('http://wowza.imust.org/srv/vod/telemb/new/UPLOAD/UPLOAD/20224_IncendieHavré_FD.mp4'),
|
||||||
|
'http://wowza.imust.org/srv/vod/telemb/new/UPLOAD/UPLOAD/20224_IncendieHavre%CC%81_FD.mp4'
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
escape_url('http://www.ardmediathek.de/tv/Sturm-der-Liebe/Folge-2036-Zu-Mann-und-Frau-erklärt/Das-Erste/Video?documentId=22673108&bcastId=5290'),
|
||||||
|
'http://www.ardmediathek.de/tv/Sturm-der-Liebe/Folge-2036-Zu-Mann-und-Frau-erkl%C3%A4rt/Das-Erste/Video?documentId=22673108&bcastId=5290'
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
escape_url('http://тест.рф/фрагмент'),
|
||||||
|
'http://тест.рф/%D1%84%D1%80%D0%B0%D0%B3%D0%BC%D0%B5%D0%BD%D1%82'
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
escape_url('http://тест.рф/абв?абв=абв#абв'),
|
||||||
|
'http://тест.рф/%D0%B0%D0%B1%D0%B2?%D0%B0%D0%B1%D0%B2=%D0%B0%D0%B1%D0%B2#%D0%B0%D0%B1%D0%B2'
|
||||||
|
)
|
||||||
|
self.assertEqual(escape_url('http://vimeo.com/56015672#at=0'), 'http://vimeo.com/56015672#at=0')
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
@@ -28,6 +28,7 @@ from .utils import (
|
|||||||
compat_str,
|
compat_str,
|
||||||
compat_urllib_error,
|
compat_urllib_error,
|
||||||
compat_urllib_request,
|
compat_urllib_request,
|
||||||
|
escape_url,
|
||||||
ContentTooShortError,
|
ContentTooShortError,
|
||||||
date_from_str,
|
date_from_str,
|
||||||
DateRange,
|
DateRange,
|
||||||
@@ -707,7 +708,7 @@ class YoutubeDL(object):
|
|||||||
if video_formats:
|
if video_formats:
|
||||||
return video_formats[0]
|
return video_formats[0]
|
||||||
else:
|
else:
|
||||||
extensions = ['mp4', 'flv', 'webm', '3gp']
|
extensions = ['mp4', 'flv', 'webm', '3gp', 'm4a']
|
||||||
if format_spec in extensions:
|
if format_spec in extensions:
|
||||||
filter_f = lambda f: f['ext'] == format_spec
|
filter_f = lambda f: f['ext'] == format_spec
|
||||||
else:
|
else:
|
||||||
@@ -808,9 +809,10 @@ class YoutubeDL(object):
|
|||||||
if req_format in ('-1', 'all'):
|
if req_format in ('-1', 'all'):
|
||||||
formats_to_download = formats
|
formats_to_download = formats
|
||||||
else:
|
else:
|
||||||
|
for rfstr in req_format.split(','):
|
||||||
# We can accept formats requested in the format: 34/5/best, we pick
|
# We can accept formats requested in the format: 34/5/best, we pick
|
||||||
# the first that is available, starting from left
|
# the first that is available, starting from left
|
||||||
req_formats = req_format.split('/')
|
req_formats = rfstr.split('/')
|
||||||
for rf in req_formats:
|
for rf in req_formats:
|
||||||
if re.match(r'.+?\+.+?', rf) is not None:
|
if re.match(r'.+?\+.+?', rf) is not None:
|
||||||
# Two formats have been requested like '137+139'
|
# Two formats have been requested like '137+139'
|
||||||
@@ -828,7 +830,7 @@ class YoutubeDL(object):
|
|||||||
else:
|
else:
|
||||||
selected_format = self.select_format(rf, formats)
|
selected_format = self.select_format(rf, formats)
|
||||||
if selected_format is not None:
|
if selected_format is not None:
|
||||||
formats_to_download = [selected_format]
|
formats_to_download.append(selected_format)
|
||||||
break
|
break
|
||||||
if not formats_to_download:
|
if not formats_to_download:
|
||||||
raise ExtractorError('requested format not available',
|
raise ExtractorError('requested format not available',
|
||||||
@@ -1241,6 +1243,25 @@ class YoutubeDL(object):
|
|||||||
|
|
||||||
def urlopen(self, req):
|
def urlopen(self, req):
|
||||||
""" Start an HTTP download """
|
""" Start an HTTP download """
|
||||||
|
|
||||||
|
# According to RFC 3986, URLs can not contain non-ASCII characters, however this is not
|
||||||
|
# always respected by websites, some tend to give out URLs with non percent-encoded
|
||||||
|
# non-ASCII characters (see telemb.py, ard.py [#3412])
|
||||||
|
# urllib chokes on URLs with non-ASCII characters (see http://bugs.python.org/issue3991)
|
||||||
|
# To work around aforementioned issue we will replace request's original URL with
|
||||||
|
# percent-encoded one
|
||||||
|
url = req if isinstance(req, compat_str) else req.get_full_url()
|
||||||
|
url_escaped = escape_url(url)
|
||||||
|
|
||||||
|
# Substitute URL if any change after escaping
|
||||||
|
if url != url_escaped:
|
||||||
|
if isinstance(req, compat_str):
|
||||||
|
req = url_escaped
|
||||||
|
else:
|
||||||
|
req = compat_urllib_request.Request(
|
||||||
|
url_escaped, data=req.data, headers=req.headers,
|
||||||
|
origin_req_host=req.origin_req_host, unverifiable=req.unverifiable)
|
||||||
|
|
||||||
return self._opener.open(req, timeout=self._socket_timeout)
|
return self._opener.open(req, timeout=self._socket_timeout)
|
||||||
|
|
||||||
def print_debug_header(self):
|
def print_debug_header(self):
|
||||||
|
@@ -75,6 +75,9 @@ __authors__ = (
|
|||||||
'Ole Ernst',
|
'Ole Ernst',
|
||||||
'Aaron McDaniel (mcd1992)',
|
'Aaron McDaniel (mcd1992)',
|
||||||
'Magnus Kolstad',
|
'Magnus Kolstad',
|
||||||
|
'Hari Padmanaban',
|
||||||
|
'Carlos Ramos',
|
||||||
|
'5moufl',
|
||||||
)
|
)
|
||||||
|
|
||||||
__license__ = 'Public Domain'
|
__license__ = 'Public Domain'
|
||||||
|
@@ -16,6 +16,7 @@ from ..utils import (
|
|||||||
format_bytes,
|
format_bytes,
|
||||||
encodeFilename,
|
encodeFilename,
|
||||||
sanitize_open,
|
sanitize_open,
|
||||||
|
xpath_text,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -251,6 +252,8 @@ class F4mFD(FileDownloader):
|
|||||||
# We only download the first fragment
|
# We only download the first fragment
|
||||||
fragments_list = fragments_list[:1]
|
fragments_list = fragments_list[:1]
|
||||||
total_frags = len(fragments_list)
|
total_frags = len(fragments_list)
|
||||||
|
# For some akamai manifests we'll need to add a query to the fragment url
|
||||||
|
akamai_pv = xpath_text(doc, _add_ns('pv-2.0'))
|
||||||
|
|
||||||
tmpfilename = self.temp_name(filename)
|
tmpfilename = self.temp_name(filename)
|
||||||
(dest_stream, tmpfilename) = sanitize_open(tmpfilename, 'wb')
|
(dest_stream, tmpfilename) = sanitize_open(tmpfilename, 'wb')
|
||||||
@@ -290,6 +293,8 @@ class F4mFD(FileDownloader):
|
|||||||
for (seg_i, frag_i) in fragments_list:
|
for (seg_i, frag_i) in fragments_list:
|
||||||
name = 'Seg%d-Frag%d' % (seg_i, frag_i)
|
name = 'Seg%d-Frag%d' % (seg_i, frag_i)
|
||||||
url = base_url + name
|
url = base_url + name
|
||||||
|
if akamai_pv:
|
||||||
|
url += '?' + akamai_pv.strip(';')
|
||||||
frag_filename = '%s-%s' % (tmpfilename, name)
|
frag_filename = '%s-%s' % (tmpfilename, name)
|
||||||
success = http_dl.download(frag_filename, {'url': url})
|
success = http_dl.download(frag_filename, {'url': url})
|
||||||
if not success:
|
if not success:
|
||||||
|
@@ -25,6 +25,7 @@ from .bambuser import BambuserIE, BambuserChannelIE
|
|||||||
from .bandcamp import BandcampIE, BandcampAlbumIE
|
from .bandcamp import BandcampIE, BandcampAlbumIE
|
||||||
from .bbccouk import BBCCoUkIE
|
from .bbccouk import BBCCoUkIE
|
||||||
from .beeg import BeegIE
|
from .beeg import BeegIE
|
||||||
|
from .behindkink import BehindKinkIE
|
||||||
from .bilibili import BiliBiliIE
|
from .bilibili import BiliBiliIE
|
||||||
from .blinkx import BlinkxIE
|
from .blinkx import BlinkxIE
|
||||||
from .bliptv import BlipTVIE, BlipTVUserIE
|
from .bliptv import BlipTVIE, BlipTVUserIE
|
||||||
@@ -83,6 +84,7 @@ from .dropbox import DropboxIE
|
|||||||
from .ebaumsworld import EbaumsWorldIE
|
from .ebaumsworld import EbaumsWorldIE
|
||||||
from .ehow import EHowIE
|
from .ehow import EHowIE
|
||||||
from .eighttracks import EightTracksIE
|
from .eighttracks import EightTracksIE
|
||||||
|
from .einthusan import EinthusanIE
|
||||||
from .eitb import EitbIE
|
from .eitb import EitbIE
|
||||||
from .ellentv import (
|
from .ellentv import (
|
||||||
EllenTVIE,
|
EllenTVIE,
|
||||||
@@ -197,6 +199,7 @@ from .malemotion import MalemotionIE
|
|||||||
from .mdr import MDRIE
|
from .mdr import MDRIE
|
||||||
from .metacafe import MetacafeIE
|
from .metacafe import MetacafeIE
|
||||||
from .metacritic import MetacriticIE
|
from .metacritic import MetacriticIE
|
||||||
|
from .mgoon import MgoonIE
|
||||||
from .ministrygrid import MinistryGridIE
|
from .ministrygrid import MinistryGridIE
|
||||||
from .mit import TechTVMITIE, MITIE, OCWMITIE
|
from .mit import TechTVMITIE, MITIE, OCWMITIE
|
||||||
from .mitele import MiTeleIE
|
from .mitele import MiTeleIE
|
||||||
@@ -206,6 +209,7 @@ from .mpora import MporaIE
|
|||||||
from .moevideo import MoeVideoIE
|
from .moevideo import MoeVideoIE
|
||||||
from .mofosex import MofosexIE
|
from .mofosex import MofosexIE
|
||||||
from .mojvideo import MojvideoIE
|
from .mojvideo import MojvideoIE
|
||||||
|
from .moniker import MonikerIE
|
||||||
from .mooshare import MooshareIE
|
from .mooshare import MooshareIE
|
||||||
from .morningstar import MorningstarIE
|
from .morningstar import MorningstarIE
|
||||||
from .motherless import MotherlessIE
|
from .motherless import MotherlessIE
|
||||||
@@ -218,6 +222,7 @@ from .mtv import (
|
|||||||
MTVServicesEmbeddedIE,
|
MTVServicesEmbeddedIE,
|
||||||
MTVIggyIE,
|
MTVIggyIE,
|
||||||
)
|
)
|
||||||
|
from .muenchentv import MuenchenTVIE
|
||||||
from .musicplayon import MusicPlayOnIE
|
from .musicplayon import MusicPlayOnIE
|
||||||
from .musicvault import MusicVaultIE
|
from .musicvault import MusicVaultIE
|
||||||
from .muzu import MuzuTVIE
|
from .muzu import MuzuTVIE
|
||||||
@@ -244,7 +249,10 @@ from .nosvideo import NosVideoIE
|
|||||||
from .novamov import NovaMovIE
|
from .novamov import NovaMovIE
|
||||||
from .nowness import NownessIE
|
from .nowness import NownessIE
|
||||||
from .nowvideo import NowVideoIE
|
from .nowvideo import NowVideoIE
|
||||||
from .npo import NPOIE
|
from .npo import (
|
||||||
|
NPOIE,
|
||||||
|
TegenlichtVproIE,
|
||||||
|
)
|
||||||
from .nrk import (
|
from .nrk import (
|
||||||
NRKIE,
|
NRKIE,
|
||||||
NRKTVIE,
|
NRKTVIE,
|
||||||
@@ -357,6 +365,7 @@ from .thisav import ThisAVIE
|
|||||||
from .tinypic import TinyPicIE
|
from .tinypic import TinyPicIE
|
||||||
from .tlc import TlcIE, TlcDeIE
|
from .tlc import TlcIE, TlcDeIE
|
||||||
from .tnaflix import TNAFlixIE
|
from .tnaflix import TNAFlixIE
|
||||||
|
from .thvideo import THVideoIE
|
||||||
from .toutv import TouTvIE
|
from .toutv import TouTvIE
|
||||||
from .toypics import ToypicsUserIE, ToypicsIE
|
from .toypics import ToypicsUserIE, ToypicsIE
|
||||||
from .traileraddict import TrailerAddictIE
|
from .traileraddict import TrailerAddictIE
|
||||||
@@ -365,6 +374,7 @@ from .trutube import TruTubeIE
|
|||||||
from .tube8 import Tube8IE
|
from .tube8 import Tube8IE
|
||||||
from .tudou import TudouIE
|
from .tudou import TudouIE
|
||||||
from .tumblr import TumblrIE
|
from .tumblr import TumblrIE
|
||||||
|
from .turbo import TurboIE
|
||||||
from .tutv import TutvIE
|
from .tutv import TutvIE
|
||||||
from .tvigle import TvigleIE
|
from .tvigle import TvigleIE
|
||||||
from .tvp import TvpIE
|
from .tvp import TvpIE
|
||||||
@@ -389,6 +399,7 @@ from .videobam import VideoBamIE
|
|||||||
from .videodetective import VideoDetectiveIE
|
from .videodetective import VideoDetectiveIE
|
||||||
from .videolecturesnet import VideoLecturesNetIE
|
from .videolecturesnet import VideoLecturesNetIE
|
||||||
from .videofyme import VideofyMeIE
|
from .videofyme import VideofyMeIE
|
||||||
|
from .videomega import VideoMegaIE
|
||||||
from .videopremium import VideoPremiumIE
|
from .videopremium import VideoPremiumIE
|
||||||
from .videott import VideoTtIE
|
from .videott import VideoTtIE
|
||||||
from .videoweed import VideoWeedIE
|
from .videoweed import VideoWeedIE
|
||||||
@@ -441,6 +452,7 @@ from .yahoo import (
|
|||||||
from .youjizz import YouJizzIE
|
from .youjizz import YouJizzIE
|
||||||
from .youku import YoukuIE
|
from .youku import YoukuIE
|
||||||
from .youporn import YouPornIE
|
from .youporn import YouPornIE
|
||||||
|
from .yourupload import YourUploadIE
|
||||||
from .youtube import (
|
from .youtube import (
|
||||||
YoutubeIE,
|
YoutubeIE,
|
||||||
YoutubeChannelIE,
|
YoutubeChannelIE,
|
||||||
|
@@ -51,9 +51,6 @@ class ARDMediathekIE(InfoExtractor):
|
|||||||
else:
|
else:
|
||||||
video_id = m.group('video_id')
|
video_id = m.group('video_id')
|
||||||
|
|
||||||
urlp = compat_urllib_parse_urlparse(url)
|
|
||||||
url = urlp._replace(path=compat_urllib_parse.quote(urlp.path.encode('utf-8'))).geturl()
|
|
||||||
|
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
if '>Der gewünschte Beitrag ist nicht mehr verfügbar.<' in webpage:
|
if '>Der gewünschte Beitrag ist nicht mehr verfügbar.<' in webpage:
|
||||||
|
53
youtube_dl/extractor/behindkink.py
Normal file
53
youtube_dl/extractor/behindkink.py
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import url_basename
|
||||||
|
|
||||||
|
|
||||||
|
class BehindKinkIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'http://(?:www\.)?behindkink\.com/(?P<year>[0-9]{4})/(?P<month>[0-9]{2})/(?P<day>[0-9]{2})/(?P<id>[^/#?_]+)'
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://www.behindkink.com/2014/08/14/ab1576-performers-voice-finally-heard-the-bill-is-killed/',
|
||||||
|
'md5': '41ad01222b8442089a55528fec43ec01',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '36370',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'AB1576 - PERFORMERS VOICE FINALLY HEARD - THE BILL IS KILLED!',
|
||||||
|
'description': 'The adult industry voice was finally heard as Assembly Bill 1576 remained\xa0 in suspense today at the Senate Appropriations Hearing. AB1576 was, among other industry damaging issues, a condom mandate...',
|
||||||
|
'upload_date': '20140814',
|
||||||
|
'thumbnail': 'http://www.behindkink.com/wp-content/uploads/2014/08/36370_AB1576_Win.jpg',
|
||||||
|
'age_limit': 18,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
display_id = mobj.group('id')
|
||||||
|
year = mobj.group('year')
|
||||||
|
month = mobj.group('month')
|
||||||
|
day = mobj.group('day')
|
||||||
|
upload_date = year + month + day
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, display_id)
|
||||||
|
|
||||||
|
video_url = self._search_regex(
|
||||||
|
r"'file':\s*'([^']+)'",
|
||||||
|
webpage, 'URL base')
|
||||||
|
|
||||||
|
video_id = url_basename(video_url)
|
||||||
|
video_id = video_id.split('_')[0]
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'url': video_url,
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': self._og_search_title(webpage),
|
||||||
|
'display_id': display_id,
|
||||||
|
'thumbnail': self._og_search_thumbnail(webpage),
|
||||||
|
'description': self._og_search_description(webpage),
|
||||||
|
'upload_date': upload_date,
|
||||||
|
'age_limit': 18,
|
||||||
|
}
|
@@ -9,6 +9,8 @@ from ..utils import (
|
|||||||
compat_parse_qs,
|
compat_parse_qs,
|
||||||
compat_urllib_parse,
|
compat_urllib_parse,
|
||||||
remove_end,
|
remove_end,
|
||||||
|
HEADRequest,
|
||||||
|
compat_HTTPError,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -21,6 +23,7 @@ class CloudyIE(InfoExtractor):
|
|||||||
'''
|
'''
|
||||||
_EMBED_URL = 'http://www.%s/embed.php?id=%s'
|
_EMBED_URL = 'http://www.%s/embed.php?id=%s'
|
||||||
_API_URL = 'http://www.%s/api/player.api.php?%s'
|
_API_URL = 'http://www.%s/api/player.api.php?%s'
|
||||||
|
_MAX_TRIES = 2
|
||||||
_TESTS = [
|
_TESTS = [
|
||||||
{
|
{
|
||||||
'url': 'https://www.cloudy.ec/v/af511e2527aac',
|
'url': 'https://www.cloudy.ec/v/af511e2527aac',
|
||||||
@@ -42,24 +45,30 @@ class CloudyIE(InfoExtractor):
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _extract_video(self, video_host, video_id, file_key, error_url=None, try_num=0):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
|
||||||
video_host = mobj.group('host')
|
|
||||||
video_id = mobj.group('id')
|
|
||||||
|
|
||||||
url = self._EMBED_URL % (video_host, video_id)
|
if try_num > self._MAX_TRIES - 1:
|
||||||
webpage = self._download_webpage(url, video_id)
|
raise ExtractorError('Unable to extract video URL', expected=True)
|
||||||
|
|
||||||
file_key = self._search_regex(
|
form = {
|
||||||
r'filekey\s*=\s*"([^"]+)"', webpage, 'file_key')
|
|
||||||
data_url = self._API_URL % (video_host, compat_urllib_parse.urlencode({
|
|
||||||
'file': video_id,
|
'file': video_id,
|
||||||
'key': file_key,
|
'key': file_key,
|
||||||
}))
|
}
|
||||||
|
|
||||||
|
if error_url:
|
||||||
|
form.update({
|
||||||
|
'numOfErrors': try_num,
|
||||||
|
'errorCode': '404',
|
||||||
|
'errorUrl': error_url,
|
||||||
|
})
|
||||||
|
|
||||||
|
data_url = self._API_URL % (video_host, compat_urllib_parse.urlencode(form))
|
||||||
player_data = self._download_webpage(
|
player_data = self._download_webpage(
|
||||||
data_url, video_id, 'Downloading player data')
|
data_url, video_id, 'Downloading player data')
|
||||||
data = compat_parse_qs(player_data)
|
data = compat_parse_qs(player_data)
|
||||||
|
|
||||||
|
try_num += 1
|
||||||
|
|
||||||
if 'error' in data:
|
if 'error' in data:
|
||||||
raise ExtractorError(
|
raise ExtractorError(
|
||||||
'%s error: %s' % (self.IE_NAME, ' '.join(data['error_msg'])),
|
'%s error: %s' % (self.IE_NAME, ' '.join(data['error_msg'])),
|
||||||
@@ -69,16 +78,31 @@ class CloudyIE(InfoExtractor):
|
|||||||
if title:
|
if title:
|
||||||
title = remove_end(title, '&asdasdas').strip()
|
title = remove_end(title, '&asdasdas').strip()
|
||||||
|
|
||||||
formats = []
|
|
||||||
video_url = data.get('url', [None])[0]
|
video_url = data.get('url', [None])[0]
|
||||||
|
|
||||||
if video_url:
|
if video_url:
|
||||||
formats.append({
|
try:
|
||||||
'format_id': 'sd',
|
self._request_webpage(HEADRequest(video_url), video_id, 'Checking video URL')
|
||||||
'url': video_url,
|
except ExtractorError as e:
|
||||||
})
|
if isinstance(e.cause, compat_HTTPError) and e.cause.code in [404, 410]:
|
||||||
|
self.report_warning('Invalid video URL, requesting another', video_id)
|
||||||
|
return self._extract_video(video_host, video_id, file_key, video_url, try_num)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
'url': video_url,
|
||||||
'title': title,
|
'title': title,
|
||||||
'formats': formats,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_host = mobj.group('host')
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
url = self._EMBED_URL % (video_host, video_id)
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
|
file_key = self._search_regex(
|
||||||
|
r'filekey\s*=\s*"([^"]+)"', webpage, 'file_key')
|
||||||
|
|
||||||
|
return self._extract_video(video_host, video_id, file_key)
|
||||||
|
@@ -130,6 +130,8 @@ class InfoExtractor(object):
|
|||||||
by YoutubeDL if it's missing)
|
by YoutubeDL if it's missing)
|
||||||
categories: A list of categories that the video falls in, for example
|
categories: A list of categories that the video falls in, for example
|
||||||
["Sports", "Berlin"]
|
["Sports", "Berlin"]
|
||||||
|
is_live: True, False, or None (=unknown). Whether this video is a
|
||||||
|
live stream that goes on instead of a fixed-length video.
|
||||||
|
|
||||||
Unless mentioned otherwise, the fields should be Unicode strings.
|
Unless mentioned otherwise, the fields should be Unicode strings.
|
||||||
|
|
||||||
|
@@ -11,10 +11,10 @@ from ..utils import (
|
|||||||
|
|
||||||
|
|
||||||
class DaumIE(InfoExtractor):
|
class DaumIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:m\.)?tvpot\.daum\.net/.*?clipid=(?P<id>\d+)'
|
_VALID_URL = r'https?://(?:m\.)?tvpot\.daum\.net/(?:v/|.*?clipid=)(?P<id>[^?#&]+)'
|
||||||
IE_NAME = 'daum.net'
|
IE_NAME = 'daum.net'
|
||||||
|
|
||||||
_TEST = {
|
_TESTS = [{
|
||||||
'url': 'http://tvpot.daum.net/clip/ClipView.do?clipid=52554690',
|
'url': 'http://tvpot.daum.net/clip/ClipView.do?clipid=52554690',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '52554690',
|
'id': '52554690',
|
||||||
@@ -24,11 +24,17 @@ class DaumIE(InfoExtractor):
|
|||||||
'upload_date': '20130831',
|
'upload_date': '20130831',
|
||||||
'duration': 3868,
|
'duration': 3868,
|
||||||
},
|
},
|
||||||
}
|
}, {
|
||||||
|
'url': 'http://tvpot.daum.net/v/vab4dyeDBysyBssyukBUjBz',
|
||||||
|
'only_matching': True,
|
||||||
|
}, {
|
||||||
|
'url': 'http://tvpot.daum.net/v/07dXWRka62Y%24',
|
||||||
|
'only_matching': True,
|
||||||
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
video_id = mobj.group(1)
|
video_id = mobj.group('id')
|
||||||
canonical_url = 'http://tvpot.daum.net/v/%s' % video_id
|
canonical_url = 'http://tvpot.daum.net/v/%s' % video_id
|
||||||
webpage = self._download_webpage(canonical_url, video_id)
|
webpage = self._download_webpage(canonical_url, video_id)
|
||||||
full_id = self._search_regex(
|
full_id = self._search_regex(
|
||||||
@@ -42,7 +48,6 @@ class DaumIE(InfoExtractor):
|
|||||||
'http://videofarm.daum.net/controller/api/open/v1_2/MovieData.apixml?' + query,
|
'http://videofarm.daum.net/controller/api/open/v1_2/MovieData.apixml?' + query,
|
||||||
video_id, 'Downloading video formats info')
|
video_id, 'Downloading video formats info')
|
||||||
|
|
||||||
self.to_screen(u'%s: Getting video urls' % video_id)
|
|
||||||
formats = []
|
formats = []
|
||||||
for format_el in urls.findall('result/output_list/output_list'):
|
for format_el in urls.findall('result/output_list/output_list'):
|
||||||
profile = format_el.attrib['profile']
|
profile = format_el.attrib['profile']
|
||||||
@@ -52,7 +57,7 @@ class DaumIE(InfoExtractor):
|
|||||||
})
|
})
|
||||||
url_doc = self._download_xml(
|
url_doc = self._download_xml(
|
||||||
'http://videofarm.daum.net/controller/api/open/v1_2/MovieLocation.apixml?' + format_query,
|
'http://videofarm.daum.net/controller/api/open/v1_2/MovieLocation.apixml?' + format_query,
|
||||||
video_id, note=False)
|
video_id, note='Downloading video data for %s format' % profile)
|
||||||
format_url = url_doc.find('result/url').text
|
format_url = url_doc.find('result/url').text
|
||||||
formats.append({
|
formats.append({
|
||||||
'url': format_url,
|
'url': format_url,
|
||||||
|
@@ -7,7 +7,7 @@ class DivxStageIE(NovaMovIE):
|
|||||||
IE_NAME = 'divxstage'
|
IE_NAME = 'divxstage'
|
||||||
IE_DESC = 'DivxStage'
|
IE_DESC = 'DivxStage'
|
||||||
|
|
||||||
_VALID_URL = NovaMovIE._VALID_URL_TEMPLATE % {'host': 'divxstage\.(?:eu|net|ch|co|at|ag)'}
|
_VALID_URL = NovaMovIE._VALID_URL_TEMPLATE % {'host': 'divxstage\.(?:eu|net|ch|co|at|ag|to)'}
|
||||||
|
|
||||||
_HOST = 'www.divxstage.eu'
|
_HOST = 'www.divxstage.eu'
|
||||||
|
|
||||||
|
@@ -5,24 +5,29 @@ import os.path
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import compat_urllib_parse_unquote
|
from ..utils import compat_urllib_parse_unquote, url_basename
|
||||||
|
|
||||||
|
|
||||||
class DropboxIE(InfoExtractor):
|
class DropboxIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?dropbox[.]com/s/(?P<id>[a-zA-Z0-9]{15})/(?P<title>[^?#]*)'
|
_VALID_URL = r'https?://(?:www\.)?dropbox[.]com/sh?/(?P<id>[a-zA-Z0-9]{15})/.*'
|
||||||
_TEST = {
|
_TESTS = [{
|
||||||
'url': 'https://www.dropbox.com/s/nelirfsxnmcfbfh/youtube-dl%20test%20video%20%27%C3%A4%22BaW_jenozKc.mp4?dl=0',
|
'url': 'https://www.dropbox.com/s/nelirfsxnmcfbfh/youtube-dl%20test%20video%20%27%C3%A4%22BaW_jenozKc.mp4?dl=0',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'nelirfsxnmcfbfh',
|
'id': 'nelirfsxnmcfbfh',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'youtube-dl test video \'ä"BaW_jenozKc'
|
'title': 'youtube-dl test video \'ä"BaW_jenozKc'
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
'url': 'https://www.dropbox.com/sh/662glsejgzoj9sr/AAByil3FGH9KFNZ13e08eSa1a/Pregame%20Ceremony%20Program%20PA%2020140518.m4v',
|
||||||
|
'only_matching': True,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
video_id = mobj.group('id')
|
video_id = mobj.group('id')
|
||||||
fn = compat_urllib_parse_unquote(mobj.group('title'))
|
fn = compat_urllib_parse_unquote(url_basename(url))
|
||||||
title = os.path.splitext(fn)[0]
|
title = os.path.splitext(fn)[0]
|
||||||
video_url = (
|
video_url = (
|
||||||
re.sub(r'[?&]dl=0', '', url) +
|
re.sub(r'[?&]dl=0', '', url) +
|
||||||
|
@@ -19,7 +19,7 @@ class DrTuberIE(InfoExtractor):
|
|||||||
'like_count': int,
|
'like_count': int,
|
||||||
'dislike_count': int,
|
'dislike_count': int,
|
||||||
'comment_count': int,
|
'comment_count': int,
|
||||||
'categories': list, # NSFW
|
'categories': ['Babe', 'Blonde', 'Erotic', 'Outdoor', 'Softcore', 'Solo'],
|
||||||
'thumbnail': 're:https?://.*\.jpg$',
|
'thumbnail': 're:https?://.*\.jpg$',
|
||||||
'age_limit': 18,
|
'age_limit': 18,
|
||||||
}
|
}
|
||||||
@@ -52,9 +52,9 @@ class DrTuberIE(InfoExtractor):
|
|||||||
r'<span class="comments_count">([\d,\.]+)</span>',
|
r'<span class="comments_count">([\d,\.]+)</span>',
|
||||||
webpage, 'comment count', fatal=False))
|
webpage, 'comment count', fatal=False))
|
||||||
|
|
||||||
cats_str = self._html_search_regex(
|
cats_str = self._search_regex(
|
||||||
r'<meta name="keywords" content="([^"]+)"', webpage, 'categories', fatal=False)
|
r'<span>Categories:</span><div>(.+?)</div>', webpage, 'categories', fatal=False)
|
||||||
categories = None if cats_str is None else cats_str.split(' ')
|
categories = [] if not cats_str else re.findall(r'<a title="([^"]+)"', cats_str)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
61
youtube_dl/extractor/einthusan.py
Normal file
61
youtube_dl/extractor/einthusan.py
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
|
class EinthusanIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?einthusan\.com/movies/watch.php\?([^#]*?)id=(?P<id>[0-9]+)'
|
||||||
|
_TESTS = [
|
||||||
|
{
|
||||||
|
'url': 'http://www.einthusan.com/movies/watch.php?id=2447',
|
||||||
|
'md5': 'af244f4458cd667205e513d75da5b8b1',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '2447',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Ek Villain',
|
||||||
|
'thumbnail': 're:^https?://.*\.jpg$',
|
||||||
|
'description': 'md5:9d29fc91a7abadd4591fb862fa560d93',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': 'http://www.einthusan.com/movies/watch.php?id=1671',
|
||||||
|
'md5': 'ef63c7a803e22315880ed182c10d1c5c',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '1671',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Soodhu Kavvuum',
|
||||||
|
'thumbnail': 're:^https?://.*\.jpg$',
|
||||||
|
'description': 'md5:05d8a0c0281a4240d86d76e14f2f4d51',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
|
video_title = self._html_search_regex(
|
||||||
|
r'<h1><a class="movie-title".*?>(.*?)</a></h1>', webpage, 'title')
|
||||||
|
|
||||||
|
video_url = self._html_search_regex(
|
||||||
|
r'''(?s)jwplayer\("mediaplayer"\)\.setup\({.*?'file': '([^']+)'.*?}\);''',
|
||||||
|
webpage, 'video url')
|
||||||
|
|
||||||
|
description = self._html_search_meta('description', webpage)
|
||||||
|
thumbnail = self._html_search_regex(
|
||||||
|
r'''<a class="movie-cover-wrapper".*?><img src=["'](.*?)["'].*?/></a>''',
|
||||||
|
webpage, "thumbnail url", fatal=False)
|
||||||
|
if thumbnail is not None:
|
||||||
|
thumbnail = thumbnail.replace('..', 'http://www.einthusan.com')
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': video_title,
|
||||||
|
'url': video_url,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
'description': description,
|
||||||
|
}
|
@@ -12,8 +12,8 @@ from ..utils import (
|
|||||||
compat_urllib_parse,
|
compat_urllib_parse,
|
||||||
compat_urllib_request,
|
compat_urllib_request,
|
||||||
urlencode_postdata,
|
urlencode_postdata,
|
||||||
|
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
|
limit_length,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -37,6 +37,14 @@ class FacebookIE(InfoExtractor):
|
|||||||
'duration': 38,
|
'duration': 38,
|
||||||
'title': 'Did you know Kei Nishikori is the first Asian man to ever reach a Grand Slam fin...',
|
'title': 'Did you know Kei Nishikori is the first Asian man to ever reach a Grand Slam fin...',
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
'note': 'Video without discernible title',
|
||||||
|
'url': 'https://www.facebook.com/video.php?v=274175099429670',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '274175099429670',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Facebook video #274175099429670',
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://www.facebook.com/video.php?v=10204634152394104',
|
'url': 'https://www.facebook.com/video.php?v=10204634152394104',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
@@ -131,8 +139,7 @@ class FacebookIE(InfoExtractor):
|
|||||||
video_title = self._html_search_regex(
|
video_title = self._html_search_regex(
|
||||||
r'(?s)<span class="fbPhotosPhotoCaption".*?id="fbPhotoPageCaption"><span class="hasCaption">(.*?)</span>',
|
r'(?s)<span class="fbPhotosPhotoCaption".*?id="fbPhotoPageCaption"><span class="hasCaption">(.*?)</span>',
|
||||||
webpage, 'alternative title', default=None)
|
webpage, 'alternative title', default=None)
|
||||||
if len(video_title) > 80 + 3:
|
video_title = limit_length(video_title, 80)
|
||||||
video_title = video_title[:80] + '...'
|
|
||||||
if not video_title:
|
if not video_title:
|
||||||
video_title = 'Facebook video #%s' % video_id
|
video_title = 'Facebook video #%s' % video_id
|
||||||
|
|
||||||
|
@@ -4,16 +4,21 @@ from __future__ import unicode_literals
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from ..utils import int_or_none
|
||||||
|
|
||||||
|
|
||||||
class FranceInterIE(InfoExtractor):
|
class FranceInterIE(InfoExtractor):
|
||||||
_VALID_URL = r'http://(?:www\.)?franceinter\.fr/player/reecouter\?play=(?P<id>[0-9]{6})'
|
_VALID_URL = r'http://(?:www\.)?franceinter\.fr/player/reecouter\?play=(?P<id>[0-9]+)'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'http://www.franceinter.fr/player/reecouter?play=793962',
|
'url': 'http://www.franceinter.fr/player/reecouter?play=793962',
|
||||||
'file': '793962.mp3',
|
|
||||||
'md5': '4764932e466e6f6c79c317d2e74f6884',
|
'md5': '4764932e466e6f6c79c317d2e74f6884',
|
||||||
"info_dict": {
|
"info_dict": {
|
||||||
"title": "L’Histoire dans les jeux vidéo",
|
'id': '793962',
|
||||||
|
'ext': 'mp3',
|
||||||
|
'title': 'L’Histoire dans les jeux vidéo',
|
||||||
|
'description': 'md5:7e93ddb4451e7530022792240a3049c7',
|
||||||
|
'timestamp': 1387369800,
|
||||||
|
'upload_date': '20131218',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,17 +27,26 @@ class FranceInterIE(InfoExtractor):
|
|||||||
video_id = mobj.group('id')
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
title = self._html_search_regex(
|
|
||||||
r'<span class="roll_overflow">(.*?)</span></h1>', webpage, 'title')
|
|
||||||
path = self._search_regex(
|
path = self._search_regex(
|
||||||
r'&urlAOD=(.*?)&startTime', webpage, 'video url')
|
r'<a id="player".+?href="([^"]+)"', webpage, 'video url')
|
||||||
video_url = 'http://www.franceinter.fr/' + path
|
video_url = 'http://www.franceinter.fr/' + path
|
||||||
|
|
||||||
|
title = self._html_search_regex(
|
||||||
|
r'<span class="title">(.+?)</span>', webpage, 'title')
|
||||||
|
description = self._html_search_regex(
|
||||||
|
r'<span class="description">(.*?)</span>',
|
||||||
|
webpage, 'description', fatal=False)
|
||||||
|
timestamp = int_or_none(self._search_regex(
|
||||||
|
r'data-date="(\d+)"', webpage, 'upload date', fatal=False))
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
'title': title,
|
||||||
|
'description': description,
|
||||||
|
'timestamp': timestamp,
|
||||||
'formats': [{
|
'formats': [{
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
'vcodec': 'none',
|
'vcodec': 'none',
|
||||||
}],
|
}],
|
||||||
'title': title,
|
|
||||||
}
|
}
|
||||||
|
@@ -8,45 +8,68 @@ import json
|
|||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
compat_urlparse,
|
compat_urlparse,
|
||||||
|
ExtractorError,
|
||||||
|
clean_html,
|
||||||
|
parse_duration,
|
||||||
|
compat_urllib_parse_urlparse,
|
||||||
|
int_or_none,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class FranceTVBaseInfoExtractor(InfoExtractor):
|
class FranceTVBaseInfoExtractor(InfoExtractor):
|
||||||
def _extract_video(self, video_id):
|
def _extract_video(self, video_id, catalogue):
|
||||||
info = self._download_xml(
|
info = self._download_json(
|
||||||
'http://www.francetvinfo.fr/appftv/webservices/video/'
|
'http://webservices.francetelevisions.fr/tools/getInfosOeuvre/v2/?idDiffusion=%s&catalogue=%s'
|
||||||
'getInfosOeuvre.php?id-diffusion='
|
% (video_id, catalogue),
|
||||||
+ video_id, video_id, 'Downloading XML config')
|
video_id, 'Downloading video JSON')
|
||||||
|
|
||||||
manifest_url = info.find('videos/video/url').text
|
if info.get('status') == 'NOK':
|
||||||
manifest_url = manifest_url.replace('/z/', '/i/')
|
raise ExtractorError(
|
||||||
|
'%s returned error: %s' % (self.IE_NAME, info['message']), expected=True)
|
||||||
|
|
||||||
if manifest_url.startswith('rtmp'):
|
|
||||||
formats = [{'url': manifest_url, 'ext': 'flv'}]
|
|
||||||
else:
|
|
||||||
formats = []
|
formats = []
|
||||||
available_formats = self._search_regex(r'/[^,]*,(.*?),k\.mp4', manifest_url, 'available formats')
|
for video in info['videos']:
|
||||||
for index, format_descr in enumerate(available_formats.split(',')):
|
if video['statut'] != 'ONLINE':
|
||||||
format_info = {
|
continue
|
||||||
'url': manifest_url.replace('manifest.f4m', 'index_%d_av.m3u8' % index),
|
video_url = video['url']
|
||||||
'ext': 'mp4',
|
if not video_url:
|
||||||
}
|
continue
|
||||||
m_resolution = re.search(r'(?P<width>\d+)x(?P<height>\d+)', format_descr)
|
format_id = video['format']
|
||||||
if m_resolution is not None:
|
if video_url.endswith('.f4m'):
|
||||||
format_info.update({
|
video_url_parsed = compat_urllib_parse_urlparse(video_url)
|
||||||
'width': int(m_resolution.group('width')),
|
f4m_url = self._download_webpage(
|
||||||
'height': int(m_resolution.group('height')),
|
'http://hdfauth.francetv.fr/esi/urltokengen2.html?url=%s' % video_url_parsed.path,
|
||||||
|
video_id, 'Downloading f4m manifest token', fatal=False)
|
||||||
|
if f4m_url:
|
||||||
|
f4m_formats = self._extract_f4m_formats(f4m_url, video_id)
|
||||||
|
for f4m_format in f4m_formats:
|
||||||
|
f4m_format['preference'] = 1
|
||||||
|
formats.extend(f4m_formats)
|
||||||
|
elif video_url.endswith('.m3u8'):
|
||||||
|
formats.extend(self._extract_m3u8_formats(video_url, video_id))
|
||||||
|
elif video_url.startswith('rtmp'):
|
||||||
|
formats.append({
|
||||||
|
'url': video_url,
|
||||||
|
'format_id': 'rtmp-%s' % format_id,
|
||||||
|
'ext': 'flv',
|
||||||
|
'preference': 1,
|
||||||
})
|
})
|
||||||
formats.append(format_info)
|
else:
|
||||||
|
formats.append({
|
||||||
thumbnail_path = info.find('image').text
|
'url': video_url,
|
||||||
|
'format_id': format_id,
|
||||||
|
'preference': 2,
|
||||||
|
})
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': info.find('titre').text,
|
'title': info['titre'],
|
||||||
|
'description': clean_html(info['synopsis']),
|
||||||
|
'thumbnail': compat_urlparse.urljoin('http://pluzz.francetv.fr', info['image']),
|
||||||
|
'duration': parse_duration(info['duree']),
|
||||||
|
'timestamp': int_or_none(info['diffusion']['timestamp']),
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'thumbnail': compat_urlparse.urljoin('http://pluzz.francetv.fr', thumbnail_path),
|
|
||||||
'description': info.find('synopsis').text,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -61,7 +84,7 @@ class PluzzIE(FranceTVBaseInfoExtractor):
|
|||||||
webpage = self._download_webpage(url, title)
|
webpage = self._download_webpage(url, title)
|
||||||
video_id = self._search_regex(
|
video_id = self._search_regex(
|
||||||
r'data-diffusion="(\d+)"', webpage, 'ID')
|
r'data-diffusion="(\d+)"', webpage, 'ID')
|
||||||
return self._extract_video(video_id)
|
return self._extract_video(video_id, 'Pluzz')
|
||||||
|
|
||||||
|
|
||||||
class FranceTvInfoIE(FranceTVBaseInfoExtractor):
|
class FranceTvInfoIE(FranceTVBaseInfoExtractor):
|
||||||
@@ -70,13 +93,13 @@ class FranceTvInfoIE(FranceTVBaseInfoExtractor):
|
|||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'http://www.francetvinfo.fr/replay-jt/france-3/soir-3/jt-grand-soir-3-lundi-26-aout-2013_393427.html',
|
'url': 'http://www.francetvinfo.fr/replay-jt/france-3/soir-3/jt-grand-soir-3-lundi-26-aout-2013_393427.html',
|
||||||
|
'md5': '9cecf35f99c4079c199e9817882a9a1c',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '84981923',
|
'id': '84981923',
|
||||||
'ext': 'mp4',
|
'ext': 'flv',
|
||||||
'title': 'Soir 3',
|
'title': 'Soir 3',
|
||||||
},
|
'upload_date': '20130826',
|
||||||
'params': {
|
'timestamp': 1377548400,
|
||||||
'skip_download': True,
|
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
'url': 'http://www.francetvinfo.fr/elections/europeennes/direct-europeennes-regardez-le-debat-entre-les-candidats-a-la-presidence-de-la-commission_600639.html',
|
'url': 'http://www.francetvinfo.fr/elections/europeennes/direct-europeennes-regardez-le-debat-entre-les-candidats-a-la-presidence-de-la-commission_600639.html',
|
||||||
@@ -88,15 +111,17 @@ class FranceTvInfoIE(FranceTVBaseInfoExtractor):
|
|||||||
},
|
},
|
||||||
'params': {
|
'params': {
|
||||||
'skip_download': 'HLS (reqires ffmpeg)'
|
'skip_download': 'HLS (reqires ffmpeg)'
|
||||||
}
|
},
|
||||||
|
'skip': 'Ce direct est terminé et sera disponible en rattrapage dans quelques minutes.',
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
page_title = mobj.group('title')
|
page_title = mobj.group('title')
|
||||||
webpage = self._download_webpage(url, page_title)
|
webpage = self._download_webpage(url, page_title)
|
||||||
video_id = self._search_regex(r'id-video=((?:[^0-9]*?_)?[0-9]+)[@"]', webpage, 'video id')
|
video_id, catalogue = self._search_regex(
|
||||||
return self._extract_video(video_id)
|
r'id-video=([^@]+@[^"]+)', webpage, 'video id').split('@')
|
||||||
|
return self._extract_video(video_id, catalogue)
|
||||||
|
|
||||||
|
|
||||||
class FranceTVIE(FranceTVBaseInfoExtractor):
|
class FranceTVIE(FranceTVBaseInfoExtractor):
|
||||||
@@ -112,91 +137,77 @@ class FranceTVIE(FranceTVBaseInfoExtractor):
|
|||||||
# france2
|
# france2
|
||||||
{
|
{
|
||||||
'url': 'http://www.france2.fr/emissions/13h15-le-samedi-le-dimanche/videos/75540104',
|
'url': 'http://www.france2.fr/emissions/13h15-le-samedi-le-dimanche/videos/75540104',
|
||||||
'file': '75540104.mp4',
|
'md5': 'c03fc87cb85429ffd55df32b9fc05523',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'title': '13h15, le samedi...',
|
'id': '109169362',
|
||||||
'description': 'md5:2e5b58ba7a2d3692b35c792be081a03d',
|
'ext': 'flv',
|
||||||
},
|
'title': '13h15, le dimanche...',
|
||||||
'params': {
|
'description': 'md5:9a0932bb465f22d377a449be9d1a0ff7',
|
||||||
# m3u8 download
|
'upload_date': '20140914',
|
||||||
'skip_download': True,
|
'timestamp': 1410693600,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
# france3
|
# france3
|
||||||
{
|
{
|
||||||
'url': 'http://www.france3.fr/emissions/pieces-a-conviction/diffusions/13-11-2013_145575',
|
'url': 'http://www.france3.fr/emissions/pieces-a-conviction/diffusions/13-11-2013_145575',
|
||||||
|
'md5': '679bb8f8921f8623bd658fa2f8364da0',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '000702326_CAPP_PicesconvictionExtrait313022013_120220131722_Au',
|
'id': '000702326_CAPP_PicesconvictionExtrait313022013_120220131722_Au',
|
||||||
'ext': 'flv',
|
'ext': 'mp4',
|
||||||
'title': 'Le scandale du prix des médicaments',
|
'title': 'Le scandale du prix des médicaments',
|
||||||
'description': 'md5:1384089fbee2f04fc6c9de025ee2e9ce',
|
'description': 'md5:1384089fbee2f04fc6c9de025ee2e9ce',
|
||||||
},
|
'upload_date': '20131113',
|
||||||
'params': {
|
'timestamp': 1384380000,
|
||||||
# rtmp download
|
|
||||||
'skip_download': True,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
# france4
|
# france4
|
||||||
{
|
{
|
||||||
'url': 'http://www.france4.fr/emissions/hero-corp/videos/rhozet_herocorp_bonus_1_20131106_1923_06112013172108_F4',
|
'url': 'http://www.france4.fr/emissions/hero-corp/videos/rhozet_herocorp_bonus_1_20131106_1923_06112013172108_F4',
|
||||||
|
'md5': 'a182bf8d2c43d88d46ec48fbdd260c1c',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'rhozet_herocorp_bonus_1_20131106_1923_06112013172108_F4',
|
'id': 'rhozet_herocorp_bonus_1_20131106_1923_06112013172108_F4',
|
||||||
'ext': 'flv',
|
'ext': 'mp4',
|
||||||
'title': 'Hero Corp Making of - Extrait 1',
|
'title': 'Hero Corp Making of - Extrait 1',
|
||||||
'description': 'md5:c87d54871b1790679aec1197e73d650a',
|
'description': 'md5:c87d54871b1790679aec1197e73d650a',
|
||||||
},
|
'upload_date': '20131106',
|
||||||
'params': {
|
'timestamp': 1383766500,
|
||||||
# rtmp download
|
|
||||||
'skip_download': True,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
# france5
|
# france5
|
||||||
{
|
{
|
||||||
'url': 'http://www.france5.fr/emissions/c-a-dire/videos/92837968',
|
'url': 'http://www.france5.fr/emissions/c-a-dire/videos/92837968',
|
||||||
|
'md5': '78f0f4064f9074438e660785bbf2c5d9',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '92837968',
|
'id': '108961659',
|
||||||
'ext': 'mp4',
|
'ext': 'flv',
|
||||||
'title': 'C à dire ?!',
|
'title': 'C à dire ?!',
|
||||||
'description': 'md5:fb1db1cbad784dcce7c7a7bd177c8e2f',
|
'description': 'md5:1a4aeab476eb657bf57c4ff122129f81',
|
||||||
},
|
'upload_date': '20140915',
|
||||||
'params': {
|
'timestamp': 1410795000,
|
||||||
# m3u8 download
|
|
||||||
'skip_download': True,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
# franceo
|
# franceo
|
||||||
{
|
{
|
||||||
'url': 'http://www.franceo.fr/jt/info-afrique/04-12-2013',
|
'url': 'http://www.franceo.fr/jt/info-afrique/04-12-2013',
|
||||||
|
'md5': '52f0bfe202848b15915a2f39aaa8981b',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '92327925',
|
'id': '108634970',
|
||||||
'ext': 'mp4',
|
'ext': 'flv',
|
||||||
'title': 'Infô-Afrique',
|
'title': 'Infô Afrique',
|
||||||
'description': 'md5:ebf346da789428841bee0fd2a935ea55',
|
'description': 'md5:ebf346da789428841bee0fd2a935ea55',
|
||||||
|
'upload_date': '20140915',
|
||||||
|
'timestamp': 1410822000,
|
||||||
},
|
},
|
||||||
'params': {
|
|
||||||
# m3u8 download
|
|
||||||
'skip_download': True,
|
|
||||||
},
|
|
||||||
'skip': 'The id changes frequently',
|
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
if mobj.group('key'):
|
webpage = self._download_webpage(url, mobj.group('key') or mobj.group('id'))
|
||||||
webpage = self._download_webpage(url, mobj.group('key'))
|
video_id, catalogue = self._html_search_regex(
|
||||||
id_res = [
|
r'href="http://videos\.francetv\.fr/video/([^@]+@[^"]+)"',
|
||||||
(r'''(?x)<div\s+class="video-player">\s*
|
webpage, 'video ID').split('@')
|
||||||
<a\s+href="http://videos.francetv.fr/video/([0-9]+)"\s+
|
return self._extract_video(video_id, catalogue)
|
||||||
class="francetv-video-player">'''),
|
|
||||||
(r'<a id="player_direct" href="http://info\.francetelevisions'
|
|
||||||
'\.fr/\?id-video=([^"/&]+)'),
|
|
||||||
(r'<a class="video" id="ftv_player_(.+?)"'),
|
|
||||||
]
|
|
||||||
video_id = self._html_search_regex(id_res, webpage, 'video ID')
|
|
||||||
else:
|
|
||||||
video_id = mobj.group('id')
|
|
||||||
return self._extract_video(video_id)
|
|
||||||
|
|
||||||
|
|
||||||
class GenerationQuoiIE(InfoExtractor):
|
class GenerationQuoiIE(InfoExtractor):
|
||||||
@@ -232,16 +243,15 @@ class CultureboxIE(FranceTVBaseInfoExtractor):
|
|||||||
_VALID_URL = r'https?://(?:m\.)?culturebox\.francetvinfo\.fr/(?P<name>.*?)(\?|$)'
|
_VALID_URL = r'https?://(?:m\.)?culturebox\.francetvinfo\.fr/(?P<name>.*?)(\?|$)'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'http://culturebox.francetvinfo.fr/einstein-on-the-beach-au-theatre-du-chatelet-146813',
|
'url': 'http://culturebox.francetvinfo.fr/festivals/dans-les-jardins-de-william-christie/dans-les-jardins-de-william-christie-le-camus-162553',
|
||||||
|
'md5': '5ad6dec1ffb2a3fbcb20cc4b744be8d6',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'EV_6785',
|
'id': 'EV_22853',
|
||||||
'ext': 'mp4',
|
'ext': 'flv',
|
||||||
'title': 'Einstein on the beach au Théâtre du Châtelet',
|
'title': 'Dans les jardins de William Christie - Le Camus',
|
||||||
'description': 'md5:9ce2888b1efefc617b5e58b3f6200eeb',
|
'description': 'md5:4710c82315c40f0c865ca8b9a68b5299',
|
||||||
},
|
'upload_date': '20140829',
|
||||||
'params': {
|
'timestamp': 1409317200,
|
||||||
# m3u8 download
|
|
||||||
'skip_download': True,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,5 +259,7 @@ class CultureboxIE(FranceTVBaseInfoExtractor):
|
|||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
name = mobj.group('name')
|
name = mobj.group('name')
|
||||||
webpage = self._download_webpage(url, name)
|
webpage = self._download_webpage(url, name)
|
||||||
video_id = self._search_regex(r'"http://videos\.francetv\.fr/video/(.*?)"', webpage, 'video id')
|
video_id, catalogue = self._search_regex(
|
||||||
return self._extract_video(video_id)
|
r'"http://videos\.francetv\.fr/video/([^@]+@[^"]+)"', webpage, 'video id').split('@')
|
||||||
|
|
||||||
|
return self._extract_video(video_id, catalogue)
|
||||||
|
@@ -877,7 +877,7 @@ class GenericIE(InfoExtractor):
|
|||||||
if not found:
|
if not found:
|
||||||
found = re.search(
|
found = re.search(
|
||||||
r'(?i)<meta\s+(?=(?:[a-z-]+="[^"]+"\s+)*http-equiv="refresh")'
|
r'(?i)<meta\s+(?=(?:[a-z-]+="[^"]+"\s+)*http-equiv="refresh")'
|
||||||
r'(?:[a-z-]+="[^"]+"\s+)*?content="[0-9]{,2};url=\'([^\']+)\'"',
|
r'(?:[a-z-]+="[^"]+"\s+)*?content="[0-9]{,2};url=\'?([^\'"]+)',
|
||||||
webpage)
|
webpage)
|
||||||
if found:
|
if found:
|
||||||
new_url = found.group(1)
|
new_url = found.group(1)
|
||||||
|
@@ -71,6 +71,7 @@ class IGNIE(InfoExtractor):
|
|||||||
|
|
||||||
def _find_video_id(self, webpage):
|
def _find_video_id(self, webpage):
|
||||||
res_id = [
|
res_id = [
|
||||||
|
r'"video_id"\s*:\s*"(.*?)"',
|
||||||
r'data-video-id="(.+?)"',
|
r'data-video-id="(.+?)"',
|
||||||
r'<object id="vid_(.+?)"',
|
r'<object id="vid_(.+?)"',
|
||||||
r'<meta name="og:image" content=".*/(.+?)-(.+?)/.+.jpg"',
|
r'<meta name="og:image" content=".*/(.+?)-(.+?)/.+.jpg"',
|
||||||
@@ -85,7 +86,7 @@ class IGNIE(InfoExtractor):
|
|||||||
webpage = self._download_webpage(url, name_or_id)
|
webpage = self._download_webpage(url, name_or_id)
|
||||||
if page_type != 'video':
|
if page_type != 'video':
|
||||||
multiple_urls = re.findall(
|
multiple_urls = re.findall(
|
||||||
'<param name="flashvars" value="[^"]*?url=(https?://www\.ign\.com/videos/.*?)["&]',
|
'<param name="flashvars"[^>]*value="[^"]*?url=(https?://www\.ign\.com/videos/.*?)["&]',
|
||||||
webpage)
|
webpage)
|
||||||
if multiple_urls:
|
if multiple_urls:
|
||||||
return [self.url_result(u, ie='IGN') for u in multiple_urls]
|
return [self.url_result(u, ie='IGN') for u in multiple_urls]
|
||||||
@@ -111,13 +112,13 @@ class IGNIE(InfoExtractor):
|
|||||||
|
|
||||||
|
|
||||||
class OneUPIE(IGNIE):
|
class OneUPIE(IGNIE):
|
||||||
_VALID_URL = r'https?://gamevideos\.1up\.com/(?P<type>video)/id/(?P<name_or_id>.+)'
|
_VALID_URL = r'https?://gamevideos\.1up\.com/(?P<type>video)/id/(?P<name_or_id>.+)\.html'
|
||||||
IE_NAME = '1up.com'
|
IE_NAME = '1up.com'
|
||||||
|
|
||||||
_DESCRIPTION_RE = r'<div id="vid_summary">(.+?)</div>'
|
_DESCRIPTION_RE = r'<div id="vid_summary">(.+?)</div>'
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'http://gamevideos.1up.com/video/id/34976',
|
'url': 'http://gamevideos.1up.com/video/id/34976.html',
|
||||||
'md5': '68a54ce4ebc772e4b71e3123d413163d',
|
'md5': '68a54ce4ebc772e4b71e3123d413163d',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '34976',
|
'id': '34976',
|
||||||
|
87
youtube_dl/extractor/mgoon.py
Normal file
87
youtube_dl/extractor/mgoon.py
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
ExtractorError,
|
||||||
|
qualities,
|
||||||
|
unified_strdate,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class MgoonIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'''(?x)https?://(?:www\.)?
|
||||||
|
(?:(:?m\.)?mgoon\.com/(?:ch/(?:.+)/v|play/view)|
|
||||||
|
video\.mgoon\.com)/(?P<id>[0-9]+)'''
|
||||||
|
_API_URL = 'http://mpos.mgoon.com/player/video?id={0:}'
|
||||||
|
_TESTS = [
|
||||||
|
{
|
||||||
|
'url': 'http://m.mgoon.com/ch/hi6618/v/5582148',
|
||||||
|
'md5': 'dd46bb66ab35cf6d51cc812fd82da79d',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '5582148',
|
||||||
|
'uploader_id': 'hi6618',
|
||||||
|
'duration': 240.419,
|
||||||
|
'upload_date': '20131220',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'md5:543aa4c27a4931d371c3f433e8cebebc',
|
||||||
|
'thumbnail': 're:^https?://.*\.jpg$',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': 'http://www.mgoon.com/play/view/5582148',
|
||||||
|
'only_matching': True,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': 'http://video.mgoon.com/5582148',
|
||||||
|
'only_matching': True,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
data = self._download_json(self._API_URL.format(video_id), video_id)
|
||||||
|
|
||||||
|
if data.get('errorInfo', {}).get('code') != 'NONE':
|
||||||
|
raise ExtractorError('%s encountered an error: %s' % (
|
||||||
|
self.IE_NAME, data['errorInfo']['message']), expected=True)
|
||||||
|
|
||||||
|
v_info = data['videoInfo']
|
||||||
|
title = v_info.get('v_title')
|
||||||
|
thumbnail = v_info.get('v_thumbnail')
|
||||||
|
duration = v_info.get('v_duration')
|
||||||
|
upload_date = unified_strdate(v_info.get('v_reg_date'))
|
||||||
|
uploader_id = data.get('userInfo', {}).get('u_alias')
|
||||||
|
if duration:
|
||||||
|
duration /= 1000.0
|
||||||
|
|
||||||
|
age_limit = None
|
||||||
|
if data.get('accessInfo', {}).get('code') == 'VIDEO_STATUS_ADULT':
|
||||||
|
age_limit = 18
|
||||||
|
|
||||||
|
formats = []
|
||||||
|
get_quality = qualities(['360p', '480p', '720p', '1080p'])
|
||||||
|
for fmt in data['videoFiles']:
|
||||||
|
formats.append({
|
||||||
|
'format_id': fmt['label'],
|
||||||
|
'quality': get_quality(fmt['label']),
|
||||||
|
'url': fmt['url'],
|
||||||
|
'ext': fmt['format'],
|
||||||
|
|
||||||
|
})
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': title,
|
||||||
|
'formats': formats,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
'duration': duration,
|
||||||
|
'upload_date': upload_date,
|
||||||
|
'uploader_id': uploader_id,
|
||||||
|
'age_limit': age_limit,
|
||||||
|
}
|
70
youtube_dl/extractor/moniker.py
Normal file
70
youtube_dl/extractor/moniker.py
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import os.path
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
compat_urllib_parse,
|
||||||
|
compat_urllib_request,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class MonikerIE(InfoExtractor):
|
||||||
|
IE_DESC = 'allmyvideos.net and vidspot.net'
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?(?:allmyvideos|vidspot)\.net/(?P<id>[a-zA-Z0-9_-]+)'
|
||||||
|
|
||||||
|
_TESTS = [{
|
||||||
|
'url': 'http://allmyvideos.net/jih3nce3x6wn',
|
||||||
|
'md5': '710883dee1bfc370ecf9fa6a89307c88',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'jih3nce3x6wn',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'youtube-dl test video',
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
'url': 'http://vidspot.net/l2ngsmhs8ci5',
|
||||||
|
'md5': '710883dee1bfc370ecf9fa6a89307c88',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'l2ngsmhs8ci5',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'youtube-dl test video',
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
'url': 'https://www.vidspot.net/l2ngsmhs8ci5',
|
||||||
|
'only_matching': True,
|
||||||
|
}]
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
orig_webpage = self._download_webpage(url, video_id)
|
||||||
|
fields = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', orig_webpage)
|
||||||
|
data = dict(fields)
|
||||||
|
|
||||||
|
post = compat_urllib_parse.urlencode(data)
|
||||||
|
headers = {
|
||||||
|
b'Content-Type': b'application/x-www-form-urlencoded',
|
||||||
|
}
|
||||||
|
req = compat_urllib_request.Request(url, post, headers)
|
||||||
|
webpage = self._download_webpage(
|
||||||
|
req, video_id, note='Downloading video page ...')
|
||||||
|
|
||||||
|
title = os.path.splitext(data['fname'])[0]
|
||||||
|
|
||||||
|
#Could be several links with different quality
|
||||||
|
links = re.findall(r'"file" : "?(.+?)",', webpage)
|
||||||
|
# Assume the links are ordered in quality
|
||||||
|
formats = [{
|
||||||
|
'url': l,
|
||||||
|
'quality': i,
|
||||||
|
} for i, l in enumerate(links)]
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': title,
|
||||||
|
'formats': formats,
|
||||||
|
}
|
77
youtube_dl/extractor/muenchentv.py
Normal file
77
youtube_dl/extractor/muenchentv.py
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
import json
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
determine_ext,
|
||||||
|
int_or_none,
|
||||||
|
js_to_json,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class MuenchenTVIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?muenchen\.tv/livestream'
|
||||||
|
IE_DESC = 'münchen.tv'
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://www.muenchen.tv/livestream/',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '5334',
|
||||||
|
'display_id': 'live',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 're:^münchen.tv-Livestream [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
|
||||||
|
'is_live': True,
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
'skip_download': True,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
display_id = 'live'
|
||||||
|
webpage = self._download_webpage(url, display_id)
|
||||||
|
|
||||||
|
now = datetime.datetime.now()
|
||||||
|
now_str = now.strftime("%Y-%m-%d %H:%M")
|
||||||
|
title = self._og_search_title(webpage) + ' ' + now_str
|
||||||
|
|
||||||
|
data_js = self._search_regex(
|
||||||
|
r'(?s)\nplaylist:\s*(\[.*?}\]),related:',
|
||||||
|
webpage, 'playlist configuration')
|
||||||
|
data_json = js_to_json(data_js)
|
||||||
|
data = json.loads(data_json)[0]
|
||||||
|
|
||||||
|
video_id = data['mediaid']
|
||||||
|
thumbnail = data.get('image')
|
||||||
|
|
||||||
|
formats = []
|
||||||
|
for format_num, s in enumerate(data['sources']):
|
||||||
|
ext = determine_ext(s['file'], None)
|
||||||
|
label_str = s.get('label')
|
||||||
|
if label_str is None:
|
||||||
|
label_str = '_%d' % format_num
|
||||||
|
|
||||||
|
if ext is None:
|
||||||
|
format_id = label_str
|
||||||
|
else:
|
||||||
|
format_id = '%s-%s' % (ext, label_str)
|
||||||
|
|
||||||
|
formats.append({
|
||||||
|
'url': s['file'],
|
||||||
|
'tbr': int_or_none(s.get('label')),
|
||||||
|
'ext': 'mp4',
|
||||||
|
'format_id': format_id,
|
||||||
|
'preference': -100 if '.smil' in s['file'] else 0,
|
||||||
|
})
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'display_id': display_id,
|
||||||
|
'title': title,
|
||||||
|
'formats': formats,
|
||||||
|
'is_live': True,
|
||||||
|
}
|
||||||
|
|
@@ -16,9 +16,9 @@ class NBCIE(InfoExtractor):
|
|||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'http://www.nbc.com/chicago-fire/video/i-am-a-firefighter/2734188',
|
'url': 'http://www.nbc.com/chicago-fire/video/i-am-a-firefighter/2734188',
|
||||||
'md5': '54d0fbc33e0b853a65d7b4de5c06d64e',
|
# md5 checksum is not stable
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'u1RInQZRN7QJ',
|
'id': 'bTmnLCvIbaaH',
|
||||||
'ext': 'flv',
|
'ext': 'flv',
|
||||||
'title': 'I Am a Firefighter',
|
'title': 'I Am a Firefighter',
|
||||||
'description': 'An emergency puts Dawson\'sf irefighter skills to the ultimate test in this four-part digital series.',
|
'description': 'An emergency puts Dawson\'sf irefighter skills to the ultimate test in this four-part digital series.',
|
||||||
|
@@ -46,9 +46,9 @@ class NHLBaseInfoExtractor(InfoExtractor):
|
|||||||
|
|
||||||
class NHLIE(NHLBaseInfoExtractor):
|
class NHLIE(NHLBaseInfoExtractor):
|
||||||
IE_NAME = 'nhl.com'
|
IE_NAME = 'nhl.com'
|
||||||
_VALID_URL = r'https?://video(?P<team>\.[^.]*)?\.nhl\.com/videocenter/console\?.*?(?:[?&])id=(?P<id>[0-9]+)'
|
_VALID_URL = r'https?://video(?P<team>\.[^.]*)?\.nhl\.com/videocenter/console(?:\?(?:.*?[?&])?)id=(?P<id>[0-9]+)'
|
||||||
|
|
||||||
_TEST = {
|
_TESTS = [{
|
||||||
'url': 'http://video.canucks.nhl.com/videocenter/console?catid=6?id=453614',
|
'url': 'http://video.canucks.nhl.com/videocenter/console?catid=6?id=453614',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '453614',
|
'id': '453614',
|
||||||
@@ -58,7 +58,10 @@ class NHLIE(NHLBaseInfoExtractor):
|
|||||||
'duration': 18,
|
'duration': 18,
|
||||||
'upload_date': '20131006',
|
'upload_date': '20131006',
|
||||||
},
|
},
|
||||||
}
|
}, {
|
||||||
|
'url': 'http://video.flames.nhl.com/videocenter/console?id=630616',
|
||||||
|
'only_matching': True,
|
||||||
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
@@ -2,6 +2,8 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
import time
|
||||||
|
import hashlib
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
@@ -17,6 +19,7 @@ from ..utils import (
|
|||||||
class NocoIE(InfoExtractor):
|
class NocoIE(InfoExtractor):
|
||||||
_VALID_URL = r'http://(?:(?:www\.)?noco\.tv/emission/|player\.noco\.tv/\?idvideo=)(?P<id>\d+)'
|
_VALID_URL = r'http://(?:(?:www\.)?noco\.tv/emission/|player\.noco\.tv/\?idvideo=)(?P<id>\d+)'
|
||||||
_LOGIN_URL = 'http://noco.tv/do.php'
|
_LOGIN_URL = 'http://noco.tv/do.php'
|
||||||
|
_API_URL_TEMPLATE = 'https://api.noco.tv/1.1/%s?ts=%s&tk=%s'
|
||||||
_NETRC_MACHINE = 'noco'
|
_NETRC_MACHINE = 'noco'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
@@ -57,31 +60,50 @@ class NocoIE(InfoExtractor):
|
|||||||
if 'erreur' in login:
|
if 'erreur' in login:
|
||||||
raise ExtractorError('Unable to login: %s' % clean_html(login['erreur']), expected=True)
|
raise ExtractorError('Unable to login: %s' % clean_html(login['erreur']), expected=True)
|
||||||
|
|
||||||
|
def _call_api(self, path, video_id, note):
|
||||||
|
ts = compat_str(int(time.time() * 1000))
|
||||||
|
tk = hashlib.md5(hashlib.md5(ts).hexdigest() + '#8S?uCraTedap6a').hexdigest()
|
||||||
|
url = self._API_URL_TEMPLATE % (path, ts, tk)
|
||||||
|
|
||||||
|
resp = self._download_json(url, video_id, note)
|
||||||
|
|
||||||
|
if isinstance(resp, dict) and resp.get('error'):
|
||||||
|
self._raise_error(resp['error'], resp['description'])
|
||||||
|
|
||||||
|
return resp
|
||||||
|
|
||||||
|
def _raise_error(self, error, description):
|
||||||
|
raise ExtractorError(
|
||||||
|
'%s returned error: %s - %s' % (self.IE_NAME, error, description),
|
||||||
|
expected=True)
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
video_id = mobj.group('id')
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
medias = self._download_json(
|
medias = self._call_api(
|
||||||
'https://api.noco.tv/1.0/video/medias/%s' % video_id, video_id, 'Downloading video JSON')
|
'shows/%s/medias' % video_id,
|
||||||
|
video_id, 'Downloading video JSON')
|
||||||
|
|
||||||
|
qualities = self._call_api(
|
||||||
|
'qualities',
|
||||||
|
video_id, 'Downloading qualities JSON')
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
|
|
||||||
for fmt in medias['fr']['video_list']['default']['quality_list']:
|
for format_id, fmt in medias['fr']['video_list']['none']['quality_list'].items():
|
||||||
format_id = fmt['quality_key']
|
|
||||||
|
|
||||||
file = self._download_json(
|
video = self._call_api(
|
||||||
'https://api.noco.tv/1.0/video/file/%s/fr/%s' % (format_id.lower(), video_id),
|
'shows/%s/video/%s/fr' % (video_id, format_id.lower()),
|
||||||
video_id, 'Downloading %s video JSON' % format_id)
|
video_id, 'Downloading %s video JSON' % format_id)
|
||||||
|
|
||||||
file_url = file['file']
|
file_url = video['file']
|
||||||
if not file_url:
|
if not file_url:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if file_url == 'forbidden':
|
if file_url in ['forbidden', 'not found']:
|
||||||
raise ExtractorError(
|
popmessage = video['popmessage']
|
||||||
'%s returned error: %s - %s' % (
|
self._raise_error(popmessage['title'], popmessage['message'])
|
||||||
self.IE_NAME, file['popmessage']['title'], file['popmessage']['message']),
|
|
||||||
expected=True)
|
|
||||||
|
|
||||||
formats.append({
|
formats.append({
|
||||||
'url': file_url,
|
'url': file_url,
|
||||||
@@ -91,20 +113,31 @@ class NocoIE(InfoExtractor):
|
|||||||
'abr': fmt['audiobitrate'],
|
'abr': fmt['audiobitrate'],
|
||||||
'vbr': fmt['videobitrate'],
|
'vbr': fmt['videobitrate'],
|
||||||
'filesize': fmt['filesize'],
|
'filesize': fmt['filesize'],
|
||||||
'format_note': fmt['quality_name'],
|
'format_note': qualities[format_id]['quality_name'],
|
||||||
'preference': fmt['priority'],
|
'preference': qualities[format_id]['priority'],
|
||||||
})
|
})
|
||||||
|
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
show = self._download_json(
|
show = self._call_api(
|
||||||
'https://api.noco.tv/1.0/shows/show/%s' % video_id, video_id, 'Downloading show JSON')[0]
|
'shows/by_id/%s' % video_id,
|
||||||
|
video_id, 'Downloading show JSON')[0]
|
||||||
|
|
||||||
upload_date = unified_strdate(show['indexed'])
|
upload_date = unified_strdate(show['online_date_start_utc'])
|
||||||
uploader = show['partner_name']
|
uploader = show['partner_name']
|
||||||
uploader_id = show['partner_key']
|
uploader_id = show['partner_key']
|
||||||
duration = show['duration_ms'] / 1000.0
|
duration = show['duration_ms'] / 1000.0
|
||||||
thumbnail = show['screenshot']
|
|
||||||
|
thumbnails = []
|
||||||
|
for thumbnail_key, thumbnail_url in show.items():
|
||||||
|
m = re.search(r'^screenshot_(?P<width>\d+)x(?P<height>\d+)$', thumbnail_key)
|
||||||
|
if not m:
|
||||||
|
continue
|
||||||
|
thumbnails.append({
|
||||||
|
'url': thumbnail_url,
|
||||||
|
'width': int(m.group('width')),
|
||||||
|
'height': int(m.group('height')),
|
||||||
|
})
|
||||||
|
|
||||||
episode = show.get('show_TT') or show.get('show_OT')
|
episode = show.get('show_TT') or show.get('show_OT')
|
||||||
family = show.get('family_TT') or show.get('family_OT')
|
family = show.get('family_TT') or show.get('family_OT')
|
||||||
@@ -124,7 +157,7 @@ class NocoIE(InfoExtractor):
|
|||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': title,
|
'title': title,
|
||||||
'description': description,
|
'description': description,
|
||||||
'thumbnail': thumbnail,
|
'thumbnails': thumbnails,
|
||||||
'upload_date': upload_date,
|
'upload_date': upload_date,
|
||||||
'uploader': uploader,
|
'uploader': uploader,
|
||||||
'uploader_id': uploader_id,
|
'uploader_id': uploader_id,
|
||||||
|
@@ -8,11 +8,11 @@ from ..utils import (
|
|||||||
ExtractorError,
|
ExtractorError,
|
||||||
compat_urllib_request,
|
compat_urllib_request,
|
||||||
urlencode_postdata,
|
urlencode_postdata,
|
||||||
|
xpath_text,
|
||||||
xpath_with_ns,
|
xpath_with_ns,
|
||||||
)
|
)
|
||||||
|
|
||||||
_x = lambda p: xpath_with_ns(p, {'xspf': 'http://xspf.org/ns/0/'})
|
_x = lambda p: xpath_with_ns(p, {'xspf': 'http://xspf.org/ns/0/'})
|
||||||
_find = lambda el, p: el.find(_x(p)).text.strip()
|
|
||||||
|
|
||||||
|
|
||||||
class NosVideoIE(InfoExtractor):
|
class NosVideoIE(InfoExtractor):
|
||||||
@@ -53,9 +53,15 @@ class NosVideoIE(InfoExtractor):
|
|||||||
playlist = self._download_xml(playlist_url, video_id)
|
playlist = self._download_xml(playlist_url, video_id)
|
||||||
|
|
||||||
track = playlist.find(_x('.//xspf:track'))
|
track = playlist.find(_x('.//xspf:track'))
|
||||||
title = _find(track, './xspf:title')
|
if track is None:
|
||||||
url = _find(track, './xspf:file')
|
raise ExtractorError(
|
||||||
thumbnail = _find(track, './xspf:image')
|
'XML playlist is missing the \'track\' element',
|
||||||
|
expected=True)
|
||||||
|
title = xpath_text(track, _x('./xspf:title'), 'title')
|
||||||
|
url = xpath_text(track, _x('./xspf:file'), 'URL', fatal=True)
|
||||||
|
thumbnail = xpath_text(track, _x('./xspf:image'), 'thumbnail')
|
||||||
|
if title is not None:
|
||||||
|
title = title.strip()
|
||||||
|
|
||||||
formats = [{
|
formats = [{
|
||||||
'format_id': 'sd',
|
'format_id': 'sd',
|
||||||
|
@@ -5,7 +5,9 @@ import re
|
|||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
unified_strdate,
|
unified_strdate,
|
||||||
|
parse_duration,
|
||||||
qualities,
|
qualities,
|
||||||
|
url_basename,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -13,7 +15,8 @@ class NPOIE(InfoExtractor):
|
|||||||
IE_NAME = 'npo.nl'
|
IE_NAME = 'npo.nl'
|
||||||
_VALID_URL = r'https?://www\.npo\.nl/[^/]+/[^/]+/(?P<id>[^/?]+)'
|
_VALID_URL = r'https?://www\.npo\.nl/[^/]+/[^/]+/(?P<id>[^/?]+)'
|
||||||
|
|
||||||
_TEST = {
|
_TESTS = [
|
||||||
|
{
|
||||||
'url': 'http://www.npo.nl/nieuwsuur/22-06-2014/VPWON_1220719',
|
'url': 'http://www.npo.nl/nieuwsuur/22-06-2014/VPWON_1220719',
|
||||||
'md5': '4b3f9c429157ec4775f2c9cb7b911016',
|
'md5': '4b3f9c429157ec4775f2c9cb7b911016',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
@@ -23,12 +26,39 @@ class NPOIE(InfoExtractor):
|
|||||||
'description': 'Dagelijks tussen tien en elf: nieuws, sport en achtergronden.',
|
'description': 'Dagelijks tussen tien en elf: nieuws, sport en achtergronden.',
|
||||||
'upload_date': '20140622',
|
'upload_date': '20140622',
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': 'http://www.npo.nl/de-mega-mike-mega-thomas-show/27-02-2009/VARA_101191800',
|
||||||
|
'md5': 'da50a5787dbfc1603c4ad80f31c5120b',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'VARA_101191800',
|
||||||
|
'ext': 'm4v',
|
||||||
|
'title': 'De Mega Mike & Mega Thomas show',
|
||||||
|
'description': 'md5:3b74c97fc9d6901d5a665aac0e5400f4',
|
||||||
|
'upload_date': '20090227',
|
||||||
|
'duration': 2400,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': 'http://www.npo.nl/tegenlicht/25-02-2013/VPWON_1169289',
|
||||||
|
'md5': 'f8065e4e5a7824068ed3c7e783178f2c',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'VPWON_1169289',
|
||||||
|
'ext': 'm4v',
|
||||||
|
'title': 'Tegenlicht',
|
||||||
|
'description': 'md5:d6476bceb17a8c103c76c3b708f05dd1',
|
||||||
|
'upload_date': '20130225',
|
||||||
|
'duration': 3000,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
video_id = mobj.group('id')
|
video_id = mobj.group('id')
|
||||||
|
return self._get_info(video_id)
|
||||||
|
|
||||||
|
def _get_info(self, video_id):
|
||||||
metadata = self._download_json(
|
metadata = self._download_json(
|
||||||
'http://e.omroep.nl/metadata/aflevering/%s' % video_id,
|
'http://e.omroep.nl/metadata/aflevering/%s' % video_id,
|
||||||
video_id,
|
video_id,
|
||||||
@@ -43,19 +73,28 @@ class NPOIE(InfoExtractor):
|
|||||||
token = self._search_regex(r'npoplayer\.token = "(.+?)"', token_page, 'token')
|
token = self._search_regex(r'npoplayer\.token = "(.+?)"', token_page, 'token')
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
quality = qualities(['adaptive', 'h264_sb', 'h264_bb', 'h264_std'])
|
quality = qualities(['adaptive', 'wmv_sb', 'h264_sb', 'wmv_bb', 'h264_bb', 'wvc1_std', 'h264_std'])
|
||||||
for format_id in metadata['pubopties']:
|
for format_id in metadata['pubopties']:
|
||||||
streams_info = self._download_json(
|
format_info = self._download_json(
|
||||||
'http://ida.omroep.nl/odi/?prid=%s&puboptions=%s&adaptive=yes&token=%s' % (video_id, format_id, token),
|
'http://ida.omroep.nl/odi/?prid=%s&puboptions=%s&adaptive=yes&token=%s' % (video_id, format_id, token),
|
||||||
video_id, 'Downloading %s streams info' % format_id)
|
video_id, 'Downloading %s JSON' % format_id)
|
||||||
stream_info = self._download_json(
|
if format_info.get('error_code', 0) or format_info.get('errorcode', 0):
|
||||||
streams_info['streams'][0] + '&type=json',
|
continue
|
||||||
video_id, 'Downloading %s stream info' % format_id)
|
streams = format_info.get('streams')
|
||||||
|
if streams:
|
||||||
|
video_info = self._download_json(
|
||||||
|
streams[0] + '&type=json',
|
||||||
|
video_id, 'Downloading %s stream JSON' % format_id)
|
||||||
|
else:
|
||||||
|
video_info = format_info
|
||||||
|
video_url = video_info.get('url')
|
||||||
|
if not video_url:
|
||||||
|
continue
|
||||||
if format_id == 'adaptive':
|
if format_id == 'adaptive':
|
||||||
formats.extend(self._extract_m3u8_formats(stream_info['url'], video_id))
|
formats.extend(self._extract_m3u8_formats(video_url, video_id))
|
||||||
else:
|
else:
|
||||||
formats.append({
|
formats.append({
|
||||||
'url': stream_info['url'],
|
'url': video_url,
|
||||||
'format_id': format_id,
|
'format_id': format_id,
|
||||||
'quality': quality(format_id),
|
'quality': quality(format_id),
|
||||||
})
|
})
|
||||||
@@ -65,7 +104,35 @@ class NPOIE(InfoExtractor):
|
|||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': metadata['titel'],
|
'title': metadata['titel'],
|
||||||
'description': metadata['info'],
|
'description': metadata['info'],
|
||||||
'thumbnail': metadata['images'][-1]['url'],
|
'thumbnail': metadata.get('images', [{'url': None}])[-1]['url'],
|
||||||
'upload_date': unified_strdate(metadata['gidsdatum']),
|
'upload_date': unified_strdate(metadata.get('gidsdatum')),
|
||||||
|
'duration': parse_duration(metadata.get('tijdsduur')),
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class TegenlichtVproIE(NPOIE):
|
||||||
|
IE_NAME = 'tegenlicht.vpro.nl'
|
||||||
|
_VALID_URL = r'https?://tegenlicht\.vpro\.nl/afleveringen/.*?'
|
||||||
|
|
||||||
|
_TESTS = [
|
||||||
|
{
|
||||||
|
'url': 'http://tegenlicht.vpro.nl/afleveringen/2012-2013/de-toekomst-komt-uit-afrika.html',
|
||||||
|
'md5': 'f8065e4e5a7824068ed3c7e783178f2c',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'VPWON_1169289',
|
||||||
|
'ext': 'm4v',
|
||||||
|
'title': 'Tegenlicht',
|
||||||
|
'description': 'md5:d6476bceb17a8c103c76c3b708f05dd1',
|
||||||
|
'upload_date': '20130225',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
name = url_basename(url)
|
||||||
|
webpage = self._download_webpage(url, name)
|
||||||
|
urn = self._html_search_meta('mediaurn', webpage)
|
||||||
|
info_page = self._download_json(
|
||||||
|
'http://rs.vpro.nl/v2/api/media/%s.json' % urn, name)
|
||||||
|
return self._get_info(info_page['mid'])
|
||||||
|
@@ -21,7 +21,7 @@ class SBSIE(InfoExtractor):
|
|||||||
'md5': '3150cf278965eeabb5b4cea1c963fe0a',
|
'md5': '3150cf278965eeabb5b4cea1c963fe0a',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '320403011771',
|
'id': '320403011771',
|
||||||
'ext': 'flv',
|
'ext': 'mp4',
|
||||||
'title': 'Dingo Conservation',
|
'title': 'Dingo Conservation',
|
||||||
'description': 'Dingoes are on the brink of extinction; most of the animals we think are dingoes are in fact crossbred with wild dogs. This family run a dingo conservation park to prevent their extinction',
|
'description': 'Dingoes are on the brink of extinction; most of the animals we think are dingoes are in fact crossbred with wild dogs. This family run a dingo conservation park to prevent their extinction',
|
||||||
'thumbnail': 're:http://.*\.jpg',
|
'thumbnail': 're:http://.*\.jpg',
|
||||||
|
@@ -31,7 +31,8 @@ class SoundcloudIE(InfoExtractor):
|
|||||||
(?!sets/|likes/?(?:$|[?#]))
|
(?!sets/|likes/?(?:$|[?#]))
|
||||||
(?P<title>[\w\d-]+)/?
|
(?P<title>[\w\d-]+)/?
|
||||||
(?P<token>[^?]+?)?(?:[?].*)?$)
|
(?P<token>[^?]+?)?(?:[?].*)?$)
|
||||||
|(?:api\.soundcloud\.com/tracks/(?P<track_id>\d+))
|
|(?:api\.soundcloud\.com/tracks/(?P<track_id>\d+)
|
||||||
|
(?:/?\?secret_token=(?P<secret_token>[^&]+?))?$)
|
||||||
|(?P<player>(?:w|player|p.)\.soundcloud\.com/player/?.*?url=.*)
|
|(?P<player>(?:w|player|p.)\.soundcloud\.com/player/?.*?url=.*)
|
||||||
)
|
)
|
||||||
'''
|
'''
|
||||||
@@ -80,6 +81,20 @@ class SoundcloudIE(InfoExtractor):
|
|||||||
'duration': 9,
|
'duration': 9,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
# private link (alt format)
|
||||||
|
{
|
||||||
|
'url': 'https://api.soundcloud.com/tracks/123998367?secret_token=s-8Pjrp',
|
||||||
|
'md5': 'aa0dd32bfea9b0c5ef4f02aacd080604',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '123998367',
|
||||||
|
'ext': 'mp3',
|
||||||
|
'title': 'Youtube - Dl Test Video \'\' Ä↭',
|
||||||
|
'uploader': 'jaimeMF',
|
||||||
|
'description': 'test chars: \"\'/\\ä↭',
|
||||||
|
'upload_date': '20131209',
|
||||||
|
'duration': 9,
|
||||||
|
},
|
||||||
|
},
|
||||||
# downloadable song
|
# downloadable song
|
||||||
{
|
{
|
||||||
'url': 'https://soundcloud.com/oddsamples/bus-brakes',
|
'url': 'https://soundcloud.com/oddsamples/bus-brakes',
|
||||||
@@ -197,6 +212,9 @@ class SoundcloudIE(InfoExtractor):
|
|||||||
if track_id is not None:
|
if track_id is not None:
|
||||||
info_json_url = 'http://api.soundcloud.com/tracks/' + track_id + '.json?client_id=' + self._CLIENT_ID
|
info_json_url = 'http://api.soundcloud.com/tracks/' + track_id + '.json?client_id=' + self._CLIENT_ID
|
||||||
full_title = track_id
|
full_title = track_id
|
||||||
|
token = mobj.group('secret_token')
|
||||||
|
if token:
|
||||||
|
info_json_url += "&secret_token=" + token
|
||||||
elif mobj.group('player'):
|
elif mobj.group('player'):
|
||||||
query = compat_urlparse.parse_qs(compat_urlparse.urlparse(url).query)
|
query = compat_urlparse.parse_qs(compat_urlparse.urlparse(url).query)
|
||||||
return self.url_result(query['url'][0])
|
return self.url_result(query['url'][0])
|
||||||
@@ -220,7 +238,7 @@ class SoundcloudIE(InfoExtractor):
|
|||||||
|
|
||||||
|
|
||||||
class SoundcloudSetIE(SoundcloudIE):
|
class SoundcloudSetIE(SoundcloudIE):
|
||||||
_VALID_URL = r'https?://(?:www\.)?soundcloud\.com/([\w\d-]+)/sets/([\w\d-]+)'
|
_VALID_URL = r'https?://(?:www\.)?soundcloud\.com/(?P<uploader>[\w\d-]+)/sets/(?P<slug_title>[\w\d-]+)(?:/(?P<token>[^?/]+))?'
|
||||||
IE_NAME = 'soundcloud:set'
|
IE_NAME = 'soundcloud:set'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://soundcloud.com/the-concept-band/sets/the-royal-concept-ep',
|
'url': 'https://soundcloud.com/the-concept-band/sets/the-royal-concept-ep',
|
||||||
@@ -234,14 +252,19 @@ class SoundcloudSetIE(SoundcloudIE):
|
|||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
|
||||||
# extract uploader (which is in the url)
|
# extract uploader (which is in the url)
|
||||||
uploader = mobj.group(1)
|
uploader = mobj.group('uploader')
|
||||||
# extract simple title (uploader + slug of song title)
|
# extract simple title (uploader + slug of song title)
|
||||||
slug_title = mobj.group(2)
|
slug_title = mobj.group('slug_title')
|
||||||
full_title = '%s/sets/%s' % (uploader, slug_title)
|
full_title = '%s/sets/%s' % (uploader, slug_title)
|
||||||
|
url = 'http://soundcloud.com/%s/sets/%s' % (uploader, slug_title)
|
||||||
|
|
||||||
|
token = mobj.group('token')
|
||||||
|
if token:
|
||||||
|
full_title += '/' + token
|
||||||
|
url += '/' + token
|
||||||
|
|
||||||
self.report_resolve(full_title)
|
self.report_resolve(full_title)
|
||||||
|
|
||||||
url = 'http://soundcloud.com/%s/sets/%s' % (uploader, slug_title)
|
|
||||||
resolv_url = self._resolv_url(url)
|
resolv_url = self._resolv_url(url)
|
||||||
info = self._download_json(resolv_url, full_title)
|
info = self._download_json(resolv_url, full_title)
|
||||||
|
|
||||||
@@ -252,7 +275,7 @@ class SoundcloudSetIE(SoundcloudIE):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'_type': 'playlist',
|
'_type': 'playlist',
|
||||||
'entries': [self._extract_info_dict(track) for track in info['tracks']],
|
'entries': [self._extract_info_dict(track, secret_token=token) for track in info['tracks']],
|
||||||
'id': info['id'],
|
'id': info['id'],
|
||||||
'title': info['title'],
|
'title': info['title'],
|
||||||
}
|
}
|
||||||
@@ -315,11 +338,9 @@ class SoundcloudUserIE(SoundcloudIE):
|
|||||||
|
|
||||||
|
|
||||||
class SoundcloudPlaylistIE(SoundcloudIE):
|
class SoundcloudPlaylistIE(SoundcloudIE):
|
||||||
_VALID_URL = r'https?://api\.soundcloud\.com/playlists/(?P<id>[0-9]+)'
|
_VALID_URL = r'https?://api\.soundcloud\.com/playlists/(?P<id>[0-9]+)(?:/?\?secret_token=(?P<token>[^&]+?))?$'
|
||||||
IE_NAME = 'soundcloud:playlist'
|
IE_NAME = 'soundcloud:playlist'
|
||||||
_TESTS = [
|
_TESTS = [{
|
||||||
|
|
||||||
{
|
|
||||||
'url': 'http://api.soundcloud.com/playlists/4110309',
|
'url': 'http://api.soundcloud.com/playlists/4110309',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '4110309',
|
'id': '4110309',
|
||||||
@@ -327,22 +348,28 @@ class SoundcloudPlaylistIE(SoundcloudIE):
|
|||||||
'description': 're:.*?TILT Brass - Bowery Poetry Club',
|
'description': 're:.*?TILT Brass - Bowery Poetry Club',
|
||||||
},
|
},
|
||||||
'playlist_count': 6,
|
'playlist_count': 6,
|
||||||
}
|
}]
|
||||||
]
|
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
playlist_id = mobj.group('id')
|
playlist_id = mobj.group('id')
|
||||||
base_url = '%s//api.soundcloud.com/playlists/%s.json?' % (self.http_scheme(), playlist_id)
|
base_url = '%s//api.soundcloud.com/playlists/%s.json?' % (self.http_scheme(), playlist_id)
|
||||||
|
|
||||||
data = compat_urllib_parse.urlencode({
|
data_dict = {
|
||||||
'client_id': self._CLIENT_ID,
|
'client_id': self._CLIENT_ID,
|
||||||
})
|
}
|
||||||
|
token = mobj.group('token')
|
||||||
|
|
||||||
|
if token:
|
||||||
|
data_dict['secret_token'] = token
|
||||||
|
|
||||||
|
data = compat_urllib_parse.urlencode(data_dict)
|
||||||
data = self._download_json(
|
data = self._download_json(
|
||||||
base_url + data, playlist_id, 'Downloading playlist')
|
base_url + data, playlist_id, 'Downloading playlist')
|
||||||
|
|
||||||
entries = [
|
entries = [
|
||||||
self._extract_info_dict(t, quiet=True) for t in data['tracks']]
|
self._extract_info_dict(t, quiet=True, secret_token=token)
|
||||||
|
for t in data['tracks']]
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'_type': 'playlist',
|
'_type': 'playlist',
|
||||||
|
@@ -5,6 +5,7 @@ import json
|
|||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
compat_str,
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
xpath_with_ns,
|
xpath_with_ns,
|
||||||
)
|
)
|
||||||
@@ -55,21 +56,19 @@ class ThePlatformIE(InfoExtractor):
|
|||||||
body = meta.find(_x('smil:body'))
|
body = meta.find(_x('smil:body'))
|
||||||
|
|
||||||
f4m_node = body.find(_x('smil:seq//smil:video'))
|
f4m_node = body.find(_x('smil:seq//smil:video'))
|
||||||
if f4m_node is not None:
|
if f4m_node is not None and '.f4m' in f4m_node.attrib['src']:
|
||||||
f4m_url = f4m_node.attrib['src']
|
f4m_url = f4m_node.attrib['src']
|
||||||
if 'manifest.f4m?' not in f4m_url:
|
if 'manifest.f4m?' not in f4m_url:
|
||||||
f4m_url += '?'
|
f4m_url += '?'
|
||||||
# the parameters are from syfy.com, other sites may use others,
|
# the parameters are from syfy.com, other sites may use others,
|
||||||
# they also work for nbc.com
|
# they also work for nbc.com
|
||||||
f4m_url += '&g=UXWGVKRWHFSP&hdcore=3.0.3'
|
f4m_url += '&g=UXWGVKRWHFSP&hdcore=3.0.3'
|
||||||
formats = [{
|
formats = self._extract_f4m_formats(f4m_url, video_id)
|
||||||
'ext': 'flv',
|
|
||||||
'url': f4m_url,
|
|
||||||
}]
|
|
||||||
else:
|
else:
|
||||||
base_url = head.find(_x('smil:meta')).attrib['base']
|
|
||||||
switch = body.find(_x('smil:switch'))
|
|
||||||
formats = []
|
formats = []
|
||||||
|
switch = body.find(_x('smil:switch'))
|
||||||
|
if switch is not None:
|
||||||
|
base_url = head.find(_x('smil:meta')).attrib['base']
|
||||||
for f in switch.findall(_x('smil:video')):
|
for f in switch.findall(_x('smil:video')):
|
||||||
attr = f.attrib
|
attr = f.attrib
|
||||||
width = int(attr['width'])
|
width = int(attr['width'])
|
||||||
@@ -85,6 +84,16 @@ class ThePlatformIE(InfoExtractor):
|
|||||||
'height': height,
|
'height': height,
|
||||||
'vbr': vbr,
|
'vbr': vbr,
|
||||||
})
|
})
|
||||||
|
else:
|
||||||
|
switch = body.find(_x('smil:seq//smil:switch'))
|
||||||
|
for f in switch.findall(_x('smil:video')):
|
||||||
|
attr = f.attrib
|
||||||
|
vbr = int(attr['system-bitrate']) // 1000
|
||||||
|
formats.append({
|
||||||
|
'format_id': compat_str(vbr),
|
||||||
|
'url': attr['src'],
|
||||||
|
'vbr': vbr,
|
||||||
|
})
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
59
youtube_dl/extractor/thvideo.py
Normal file
59
youtube_dl/extractor/thvideo.py
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
unified_strdate
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class THVideoIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'http://(?:www\.)?thvideo\.tv/(?:v/th|mobile\.php\?cid=)(?P<id>[0-9]+)'
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://thvideo.tv/v/th1987/',
|
||||||
|
'md5': 'fa107b1f73817e325e9433505a70db50',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '1987',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': '【动画】秘封活动记录 ~ The Sealed Esoteric History.分镜稿预览',
|
||||||
|
'display_id': 'th1987',
|
||||||
|
'thumbnail': 'http://thvideo.tv/uploadfile/2014/0722/20140722013459856.jpg',
|
||||||
|
'description': '社团京都幻想剧团的第一个东方二次同人动画作品「秘封活动记录 ~ The Sealed Esoteric History.」 本视频是该动画第一期的分镜草稿...',
|
||||||
|
'upload_date': '20140722'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
# extract download link from mobile player page
|
||||||
|
webpage_player = self._download_webpage(
|
||||||
|
'http://thvideo.tv/mobile.php?cid=%s-0' % (video_id),
|
||||||
|
video_id, note='Downloading video source page')
|
||||||
|
video_url = self._html_search_regex(
|
||||||
|
r'<source src="(.*?)" type', webpage_player, 'video url')
|
||||||
|
|
||||||
|
# extract video info from main page
|
||||||
|
webpage = self._download_webpage(
|
||||||
|
'http://thvideo.tv/v/th%s' % (video_id), video_id)
|
||||||
|
title = self._og_search_title(webpage)
|
||||||
|
display_id = 'th%s' % video_id
|
||||||
|
thumbnail = self._og_search_thumbnail(webpage)
|
||||||
|
description = self._og_search_description(webpage)
|
||||||
|
upload_date = unified_strdate(self._html_search_regex(
|
||||||
|
r'span itemprop="datePublished" content="(.*?)">', webpage,
|
||||||
|
'upload date', fatal=False))
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'ext': 'mp4',
|
||||||
|
'url': video_url,
|
||||||
|
'title': title,
|
||||||
|
'display_id': display_id,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
'description': description,
|
||||||
|
'upload_date': upload_date
|
||||||
|
}
|
@@ -14,27 +14,35 @@ from ..aes import aes_decrypt_text
|
|||||||
|
|
||||||
|
|
||||||
class Tube8IE(InfoExtractor):
|
class Tube8IE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?tube8\.com/(?:[^/]+/){2}(?P<id>\d+)'
|
_VALID_URL = r'https?://(?:www\.)?tube8\.com/(?:[^/]+/)+(?P<display_id>[^/]+)/(?P<id>\d+)'
|
||||||
_TEST = {
|
_TESTS = [
|
||||||
|
{
|
||||||
'url': 'http://www.tube8.com/teen/kasia-music-video/229795/',
|
'url': 'http://www.tube8.com/teen/kasia-music-video/229795/',
|
||||||
'md5': '44bf12b98313827dd52d35b8706a4ea0',
|
'md5': '44bf12b98313827dd52d35b8706a4ea0',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '229795',
|
'id': '229795',
|
||||||
|
'display_id': 'kasia-music-video',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'description': 'hot teen Kasia grinding',
|
'description': 'hot teen Kasia grinding',
|
||||||
'uploader': 'unknown',
|
'uploader': 'unknown',
|
||||||
'title': 'Kasia music video',
|
'title': 'Kasia music video',
|
||||||
'age_limit': 18,
|
'age_limit': 18,
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
'url': 'http://www.tube8.com/shemale/teen/blonde-cd-gets-kidnapped-by-two-blacks-and-punished-for-being-a-slutty-girl/19569151/',
|
||||||
|
'only_matching': True,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
video_id = mobj.group('id')
|
video_id = mobj.group('id')
|
||||||
|
display_id = mobj.group('display_id')
|
||||||
|
|
||||||
req = compat_urllib_request.Request(url)
|
req = compat_urllib_request.Request(url)
|
||||||
req.add_header('Cookie', 'age_verified=1')
|
req.add_header('Cookie', 'age_verified=1')
|
||||||
webpage = self._download_webpage(req, video_id)
|
webpage = self._download_webpage(req, display_id)
|
||||||
|
|
||||||
flashvars = json.loads(self._html_search_regex(
|
flashvars = json.loads(self._html_search_regex(
|
||||||
r'var flashvars\s*=\s*({.+?})', webpage, 'flashvars'))
|
r'var flashvars\s*=\s*({.+?})', webpage, 'flashvars'))
|
||||||
@@ -70,6 +78,7 @@ class Tube8IE(InfoExtractor):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
'display_id': display_id,
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
'title': title,
|
'title': title,
|
||||||
'description': description,
|
'description': description,
|
||||||
|
67
youtube_dl/extractor/turbo.py
Normal file
67
youtube_dl/extractor/turbo.py
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
ExtractorError,
|
||||||
|
int_or_none,
|
||||||
|
qualities,
|
||||||
|
xpath_text,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class TurboIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?turbo\.fr/videos-voiture/(?P<id>[0-9]+)-'
|
||||||
|
_API_URL = 'http://www.turbo.fr/api/tv/xml.php?player_generique=player_generique&id={0:}'
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://www.turbo.fr/videos-voiture/454443-turbo-du-07-09-2014-renault-twingo-3-bentley-continental-gt-speed-ces-guide-achat-dacia.html',
|
||||||
|
'md5': '33f4b91099b36b5d5a91f84b5bcba600',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '454443',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'duration': 3715,
|
||||||
|
'title': 'Turbo du 07/09/2014 : Renault Twingo 3, Bentley Continental GT Speed, CES, Guide Achat Dacia... ',
|
||||||
|
'description': 'Retrouvez dans cette rubrique toutes les vidéos de l\'Turbo du 07/09/2014 : Renault Twingo 3, Bentley Continental GT Speed, CES, Guide Achat Dacia... ',
|
||||||
|
'thumbnail': 're:^https?://.*\.jpg$',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
|
playlist = self._download_xml(self._API_URL.format(video_id), video_id)
|
||||||
|
item = playlist.find('./channel/item')
|
||||||
|
if item is None:
|
||||||
|
raise ExtractorError('Playlist item was not found', expected=True)
|
||||||
|
|
||||||
|
title = xpath_text(item, './title', 'title')
|
||||||
|
duration = int_or_none(xpath_text(item, './durate', 'duration'))
|
||||||
|
thumbnail = xpath_text(item, './visuel_clip', 'thumbnail')
|
||||||
|
description = self._og_search_description(webpage)
|
||||||
|
|
||||||
|
formats = []
|
||||||
|
get_quality = qualities(['3g', 'sd', 'hq'])
|
||||||
|
for child in item:
|
||||||
|
m = re.search(r'url_video_(?P<quality>.+)', child.tag)
|
||||||
|
if m:
|
||||||
|
quality = m.group('quality')
|
||||||
|
formats.append({
|
||||||
|
'format_id': quality,
|
||||||
|
'url': child.text,
|
||||||
|
'quality': get_quality(quality),
|
||||||
|
})
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': title,
|
||||||
|
'duration': duration,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
'description': description,
|
||||||
|
'formats': formats,
|
||||||
|
}
|
57
youtube_dl/extractor/videomega.py
Normal file
57
youtube_dl/extractor/videomega.py
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
compat_urllib_parse,
|
||||||
|
remove_start,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class VideoMegaIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'''(?x)https?://
|
||||||
|
(?:www\.)?videomega\.tv/
|
||||||
|
(?:iframe\.php)?\?ref=(?P<id>[A-Za-z0-9]+)
|
||||||
|
'''
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://videomega.tv/?ref=GKeGPVedBe',
|
||||||
|
'md5': '240fb5bcf9199961f48eb17839b084d6',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'GKeGPVedBe',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'XXL - All Sports United',
|
||||||
|
'thumbnail': 're:^https?://.*\.jpg$',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
url = 'http://videomega.tv/iframe.php?ref={0:}'.format(video_id)
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
|
escaped_data = self._search_regex(
|
||||||
|
r'unescape\("([^"]+)"\)', webpage, 'escaped data')
|
||||||
|
playlist = compat_urllib_parse.unquote(escaped_data)
|
||||||
|
|
||||||
|
thumbnail = self._search_regex(
|
||||||
|
r'image:\s*"([^"]+)"', playlist, 'thumbnail', fatal=False)
|
||||||
|
url = self._search_regex(r'file:\s*"([^"]+)"', playlist, 'URL')
|
||||||
|
title = remove_start(self._html_search_regex(
|
||||||
|
r'<title>(.*?)</title>', webpage, 'title'), 'VideoMega.tv - ')
|
||||||
|
|
||||||
|
formats = [{
|
||||||
|
'format_id': 'sd',
|
||||||
|
'url': url,
|
||||||
|
}]
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': title,
|
||||||
|
'formats': formats,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
}
|
@@ -11,7 +11,8 @@ from ..utils import (
|
|||||||
|
|
||||||
class VpornIE(InfoExtractor):
|
class VpornIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?vporn\.com/[^/]+/(?P<display_id>[^/]+)/(?P<id>\d+)'
|
_VALID_URL = r'https?://(?:www\.)?vporn\.com/[^/]+/(?P<display_id>[^/]+)/(?P<id>\d+)'
|
||||||
_TEST = {
|
_TESTS = [
|
||||||
|
{
|
||||||
'url': 'http://www.vporn.com/masturbation/violet-on-her-th-birthday/497944/',
|
'url': 'http://www.vporn.com/masturbation/violet-on-her-th-birthday/497944/',
|
||||||
'md5': 'facf37c1b86546fa0208058546842c55',
|
'md5': 'facf37c1b86546fa0208058546842c55',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
@@ -25,8 +26,33 @@ class VpornIE(InfoExtractor):
|
|||||||
'categories': ['Masturbation', 'Teen'],
|
'categories': ['Masturbation', 'Teen'],
|
||||||
'duration': 393,
|
'duration': 393,
|
||||||
'age_limit': 18,
|
'age_limit': 18,
|
||||||
|
'view_count': int,
|
||||||
|
'like_count': int,
|
||||||
|
'dislike_count': int,
|
||||||
|
'comment_count': int,
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': 'http://www.vporn.com/female/hana-shower/523564/',
|
||||||
|
'md5': 'ced35a4656198a1664cf2cda1575a25f',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '523564',
|
||||||
|
'display_id': 'hana-shower',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Hana Shower',
|
||||||
|
'description': 'Hana showers at the bathroom.',
|
||||||
|
'thumbnail': 're:^https?://.*\.jpg$',
|
||||||
|
'uploader': 'Hmmmmm',
|
||||||
|
'categories': ['Big Boobs', 'Erotic', 'Teen', 'Female'],
|
||||||
|
'duration': 588,
|
||||||
|
'age_limit': 18,
|
||||||
|
'view_count': int,
|
||||||
|
'like_count': int,
|
||||||
|
'dislike_count': int,
|
||||||
|
'comment_count': int,
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
@@ -64,7 +90,7 @@ class VpornIE(InfoExtractor):
|
|||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
|
|
||||||
for video in re.findall(r'flashvars\.videoUrl([^=]+?)\s*=\s*"([^"]+)"', webpage):
|
for video in re.findall(r'flashvars\.videoUrl([^=]+?)\s*=\s*"(https?://[^"]+)"', webpage):
|
||||||
video_url = video[1]
|
video_url = video[1]
|
||||||
fmt = {
|
fmt = {
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
|
58
youtube_dl/extractor/yourupload.py
Normal file
58
youtube_dl/extractor/yourupload.py
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
|
class YourUploadIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'''(?x)https?://(?:www\.)?
|
||||||
|
(?:yourupload\.com/watch|
|
||||||
|
embed\.yourupload\.com|
|
||||||
|
embed\.yucache\.net
|
||||||
|
)/(?P<id>[A-Za-z0-9]+)
|
||||||
|
'''
|
||||||
|
_TESTS = [
|
||||||
|
{
|
||||||
|
'url': 'http://yourupload.com/watch/14i14h',
|
||||||
|
'md5': 'bf5c2f95c4c917536e80936af7bc51e1',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '14i14h',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'BigBuckBunny_320x180.mp4',
|
||||||
|
'thumbnail': 're:^https?://.*\.jpe?g',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': 'http://embed.yourupload.com/14i14h',
|
||||||
|
'only_matching': True,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': 'http://embed.yucache.net/14i14h?client_file_id=803349',
|
||||||
|
'only_matching': True,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
url = 'http://embed.yucache.net/{0:}'.format(video_id)
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
|
title = self._og_search_title(webpage)
|
||||||
|
thumbnail = self._og_search_thumbnail(webpage)
|
||||||
|
url = self._og_search_video_url(webpage)
|
||||||
|
|
||||||
|
formats = [{
|
||||||
|
'format_id': 'sd',
|
||||||
|
'url': url,
|
||||||
|
}]
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': title,
|
||||||
|
'formats': formats,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
}
|
@@ -218,7 +218,7 @@ def parseOpts(overrideArguments=None):
|
|||||||
|
|
||||||
video_format.add_option('-f', '--format',
|
video_format.add_option('-f', '--format',
|
||||||
action='store', dest='format', metavar='FORMAT', default=None,
|
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. You can also use the special names "best", "bestvideo", "bestaudio", "worst", "worstvideo" and "worstaudio". By default, youtube-dl will pick the best quality.')
|
help='video format code, specify the order of preference using slashes: -f 22/17/18 . -f mp4 , -f m4a and -f flv are also supported. You can also use the special names "best", "bestvideo", "bestaudio", "worst", "worstvideo" and "worstaudio". By default, youtube-dl will pick the best quality. Use commas to download multiple audio formats, such as -f 136/137/mp4/bestvideo,140/m4a/bestaudio')
|
||||||
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',
|
||||||
|
@@ -1437,6 +1437,24 @@ def uppercase_escape(s):
|
|||||||
lambda m: unicode_escape(m.group(0))[0],
|
lambda m: unicode_escape(m.group(0))[0],
|
||||||
s)
|
s)
|
||||||
|
|
||||||
|
|
||||||
|
def escape_rfc3986(s):
|
||||||
|
"""Escape non-ASCII characters as suggested by RFC 3986"""
|
||||||
|
if sys.version_info < (3, 0) and isinstance(s, unicode):
|
||||||
|
s = s.encode('utf-8')
|
||||||
|
return compat_urllib_parse.quote(s, "%/;:@&=+$,!~*'()?#[]")
|
||||||
|
|
||||||
|
|
||||||
|
def escape_url(url):
|
||||||
|
"""Escape URL as suggested by RFC 3986"""
|
||||||
|
url_parsed = compat_urllib_parse_urlparse(url)
|
||||||
|
return url_parsed._replace(
|
||||||
|
path=escape_rfc3986(url_parsed.path),
|
||||||
|
params=escape_rfc3986(url_parsed.params),
|
||||||
|
query=escape_rfc3986(url_parsed.query),
|
||||||
|
fragment=escape_rfc3986(url_parsed.fragment)
|
||||||
|
).geturl()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
struct.pack(u'!I', 0)
|
struct.pack(u'!I', 0)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
@@ -1571,3 +1589,13 @@ except AttributeError:
|
|||||||
if ret:
|
if ret:
|
||||||
raise subprocess.CalledProcessError(ret, p.args, output=output)
|
raise subprocess.CalledProcessError(ret, p.args, output=output)
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
|
def limit_length(s, length):
|
||||||
|
""" Add ellipses to overly long strings """
|
||||||
|
if s is None:
|
||||||
|
return None
|
||||||
|
ELLIPSES = '...'
|
||||||
|
if len(s) > length:
|
||||||
|
return s[:length - len(ELLIPSES)] + ELLIPSES
|
||||||
|
return s
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
|
|
||||||
__version__ = '2014.09.14.2'
|
__version__ = '2014.09.22'
|
||||||
|
Reference in New Issue
Block a user