aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2015-04-30 00:47:52 +0800
committerYen Chi Hsuan <yan12125@gmail.com>2015-04-30 00:50:48 +0800
commit59d814f79341341e6390392a09e628ee12a6f18d (patch)
tree2915eabe3131d1b55dd6a5ea78d40e942bd3dd05 /youtube_dl
parentbb865f3a5e7290f0da43d180f068f8715c39e3ae (diff)
[niconico] Remove credentials from tests and enhance title extraction
All test videos can be downloaded without username and password now.
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/extractor/niconico.py17
1 files changed, 4 insertions, 13 deletions
diff --git a/youtube_dl/extractor/niconico.py b/youtube_dl/extractor/niconico.py
index 0ca046ac2..a9b770cb3 100644
--- a/youtube_dl/extractor/niconico.py
+++ b/youtube_dl/extractor/niconico.py
@@ -38,13 +38,10 @@ class NiconicoIE(InfoExtractor):
'description': '(c) copyright 2008, Blender Foundation / www.bigbuckbunny.org',
'duration': 33,
},
- 'params': {
- 'username': 'ydl.niconico@gmail.com',
- 'password': 'youtube-dl',
- },
}, {
+ # File downloaded with and without credentials are different, so omit
+ # the md5 field
'url': 'http://www.nicovideo.jp/watch/nm14296458',
- 'md5': '8db08e0158457cf852a31519fceea5bc',
'info_dict': {
'id': 'nm14296458',
'ext': 'swf',
@@ -56,10 +53,6 @@ class NiconicoIE(InfoExtractor):
'timestamp': 1304065916,
'duration': 209,
},
- 'params': {
- 'username': 'ydl.niconico@gmail.com',
- 'password': 'youtube-dl',
- },
}, {
# 'video exists but is marked as "deleted"
'url': 'http://www.nicovideo.jp/watch/sm10000',
@@ -70,10 +63,6 @@ class NiconicoIE(InfoExtractor):
'description': 'deleted',
'title': 'ドラえもんエターナル第3話「決戦第3新東京市」<前編>',
},
- 'params': {
- 'username': 'ydl.niconico@gmail.com',
- 'password': 'youtube-dl',
- }
}]
_VALID_URL = r'https?://(?:www\.|secure\.)?nicovideo\.jp/watch/(?P<id>(?:[a-z]{2})?[0-9]+)'
@@ -159,6 +148,8 @@ class NiconicoIE(InfoExtractor):
# Start extracting information
title = xpath_text(video_info, './/title')
if not title:
+ title = self._og_search_title(webpage, default=None)
+ if not title:
title = self._html_search_regex(
r'<span[^>]+class="videoHeaderTitle"[^>]*>([^<]+)</span>',
webpage, 'video title')