[kwuo:song] Improve error detection (closes #10650)
authorYen Chi Hsuan <yan12125@gmail.com>
Wed, 14 Sep 2016 16:56:15 +0000 (00:56 +0800)
committerYen Chi Hsuan <yan12125@gmail.com>
Wed, 14 Sep 2016 16:56:15 +0000 (00:56 +0800)
ChangeLog
youtube_dl/extractor/kuwo.py

index 25c916eb2068a38f9bc12569a523def288ad3003..c3c8bf037959bd1e0f0f13ac6c7f8645269295bb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 version <unreleased>
 
 Extractors
+* [kwuo] Improve error detection (#10650)
 * [bilibili] Fix extraction for specific videos (#10647)
 + [nbc] Add support for NBC Olympics (#10361)
 
index 081af86f64fd8cd4b086a6a96bfc313d1db086e1..63e10125e670b96cf706bb6c1c131ea33377a920 100644 (file)
@@ -91,10 +91,10 @@ class KuwoIE(KuwoBaseIE):
 
     def _real_extract(self, url):
         song_id = self._match_id(url)
-        webpage = self._download_webpage(
+        webpage, urlh = self._download_webpage_handle(
             url, song_id, note='Download song detail info',
             errnote='Unable to get song detail info')
-        if '对不起,该歌曲由于版权问题已被下线,将返回网站首页' in webpage:
+        if song_id not in urlh.geturl() or '对不起,该歌曲由于版权问题已被下线,将返回网站首页' in webpage:
             raise ExtractorError('this song has been offline because of copyright issues', expected=True)
 
         song_name = self._html_search_regex(