about summary refs log tree commit diff
path: root/youtube_dl/extractor/xiami.py
diff options
context:
space:
mode:
authorphi <crispyfrog@163.com>2016-08-14 02:18:59 +0800
committerGitHub <noreply@github.com>2016-08-14 02:18:59 +0800
commit097eba019d0d5cab93e9ce66e1b727b782d48250 (patch)
treed71f9843e14331b327b1c979f530e616f93c1e88 /youtube_dl/extractor/xiami.py
parent73a85620eeb2d595cd86f73357bc4cb081cb3bc9 (diff)
downloadyoutube-dl-097eba019d0d5cab93e9ce66e1b727b782d48250.tar.gz
youtube-dl-097eba019d0d5cab93e9ce66e1b727b782d48250.tar.xz
youtube-dl-097eba019d0d5cab93e9ce66e1b727b782d48250.zip
bug fix for extractor xiami.py
Before applying this patch, when downloading resources from xiami.com, it crashes with these:
Traceback (most recent call last):
  File "/home/phi/.local/bin/youtube-dl", line 11, in <module>
    sys.exit(main())
  File "/home/phi/.local/lib/python3.5/site-packages/youtube_dl/__init__.py", line 433, in main
    _real_main(argv)
  File "/home/phi/.local/lib/python3.5/site-packages/youtube_dl/__init__.py", line 423, in _real_main
    retcode = ydl.download(all_urls)
  File "/home/phi/.local/lib/python3.5/site-packages/youtube_dl/YoutubeDL.py", line 1786, in download
    url, force_generic_extractor=self.params.get('force_generic_extractor', False))
  File "/home/phi/.local/lib/python3.5/site-packages/youtube_dl/YoutubeDL.py", line 691, in extract_info
    ie_result = ie.extract(url)
  File "/home/phi/.local/lib/python3.5/site-packages/youtube_dl/extractor/common.py", line 347, in extract
    return self._real_extract(url)
  File "/home/phi/.local/lib/python3.5/site-packages/youtube_dl/extractor/xiami.py", line 116, in _real_extract
    return self._extract_tracks(self._match_id(url))[0]
  File "/home/phi/.local/lib/python3.5/site-packages/youtube_dl/extractor/xiami.py", line 43, in _extract_tracks
    '%s/%s%s' % (self._API_BASE_URL, item_id, '/type/%s' % typ if typ else ''), item_id)
  File "/home/phi/.local/lib/python3.5/site-packages/youtube_dl/extractor/common.py", line 562, in _download_json
    json_string, video_id, transform_source=transform_source, fatal=fatal)
  File "/home/phi/.local/lib/python3.5/site-packages/youtube_dl/extractor/common.py", line 568, in _parse_json
    return json.loads(json_string)
  File "/usr/lib/python3.5/json/__init__.py", line 312, in loads
    s.__class__.__name__))
TypeError: the JSON object must be str, not 'NoneType'

This patch solves exactly this problem.
Diffstat (limited to 'youtube_dl/extractor/xiami.py')
-rw-r--r--youtube_dl/extractor/xiami.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/youtube_dl/extractor/xiami.py b/youtube_dl/extractor/xiami.py
index a6dfc4af9..86abef257 100644
--- a/youtube_dl/extractor/xiami.py
+++ b/youtube_dl/extractor/xiami.py
@@ -13,6 +13,7 @@ class XiamiBaseIE(InfoExtractor):
         webpage = super(XiamiBaseIE, self)._download_webpage(*args, **kwargs)
         if '>Xiami is currently not available in your country.<' in webpage:
             self.raise_geo_restricted('Xiami is currently not available in your country')
+        return webpage
 
     def _extract_track(self, track, track_id=None):
         title = track['title']