summaryrefslogtreecommitdiffhomepage
path: root/youtube_dl/extractor/youtube.py
diff options
context:
space:
mode:
authorJaime Marquínez Ferrándiz <[email protected]>2015-07-23 13:20:21 +0200
committerJaime Marquínez Ferrándiz <[email protected]>2015-07-23 13:20:21 +0200
commit297a564beeb20ca8b00d94f5707532110631f409 (patch)
tree29c7822e808bd2f6fdb5595fef979eb9e45e6d76 /youtube_dl/extractor/youtube.py
parent7c80519cbf7e3daa029239fbbd147652817877f8 (diff)
downloadyoutube-dl-297a564beeb20ca8b00d94f5707532110631f409.tar.gz
youtube-dl-297a564beeb20ca8b00d94f5707532110631f409.zip
[youtube] Extract end_time
Diffstat (limited to 'youtube_dl/extractor/youtube.py')
-rw-r--r--youtube_dl/extractor/youtube.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py
index afbd34f4a..117ef2e77 100644
--- a/youtube_dl/extractor/youtube.py
+++ b/youtube_dl/extractor/youtube.py
@@ -319,7 +319,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
IE_NAME = 'youtube'
_TESTS = [
{
- 'url': 'http://www.youtube.com/watch?v=BaW_jenozKcj&t=1s',
+ 'url': 'http://www.youtube.com/watch?v=BaW_jenozKcj&t=1s&end=9',
'info_dict': {
'id': 'BaW_jenozKc',
'ext': 'mp4',
@@ -332,6 +332,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
'like_count': int,
'dislike_count': int,
'start_time': 1,
+ 'end_time': 9,
}
},
{
@@ -893,12 +894,14 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
else 'https')
start_time = None
+ end_time = None
parsed_url = compat_urllib_parse_urlparse(url)
for component in [parsed_url.fragment, parsed_url.query]:
query = compat_parse_qs(component)
- if 't' in query:
+ if start_time is None and 't' in query:
start_time = parse_duration(query['t'][0])
- break
+ if end_time is None and 'end' in query:
+ end_time = parse_duration(query['end'][0])
# Extract original video URL from URL with redirection, like age verification, using next_url parameter
mobj = re.search(self._NEXT_URL_RE, url)
@@ -1267,6 +1270,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
'formats': formats,
'is_live': is_live,
'start_time': start_time,
+ 'end_time': end_time,
}