aboutsummaryrefslogtreecommitdiffstats
path: root/youtube_dl/extractor/xiami.py
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2016-05-03 16:19:20 +0800
committerYen Chi Hsuan <yan12125@gmail.com>2016-05-03 16:19:43 +0800
commit7759be38da1b5ad99a8ef04d9a1df21b989e3b8c (patch)
treefd32cf0d0f1b3282fdcc5cfdac15844452773b68 /youtube_dl/extractor/xiami.py
parenta0a309b9734ea3d5f66d4a52e42f5cc24df7f808 (diff)
downloadyoutube-dl-7759be38da1b5ad99a8ef04d9a1df21b989e3b8c.zip
youtube-dl-7759be38da1b5ad99a8ef04d9a1df21b989e3b8c.tar.gz
youtube-dl-7759be38da1b5ad99a8ef04d9a1df21b989e3b8c.tar.bz2
[xiami] Detect georestriction and skip tests
Diffstat (limited to 'youtube_dl/extractor/xiami.py')
-rw-r--r--youtube_dl/extractor/xiami.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/youtube_dl/extractor/xiami.py b/youtube_dl/extractor/xiami.py
index e4ed306..a6dfc4a 100644
--- a/youtube_dl/extractor/xiami.py
+++ b/youtube_dl/extractor/xiami.py
@@ -9,6 +9,11 @@ from ..utils import int_or_none
class XiamiBaseIE(InfoExtractor):
_API_BASE_URL = 'http://www.xiami.com/song/playlist/cat/json/id'
+ def _download_webpage(self, *args, **kwargs):
+ 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')
+
def _extract_track(self, track, track_id=None):
title = track['title']
track_url = self._decrypt(track['location'])
@@ -81,7 +86,8 @@ class XiamiSongIE(XiamiBaseIE):
'ext': 'lrc',
}],
},
- }
+ },
+ 'skip': 'Georestricted',
}, {
'url': 'http://www.xiami.com/song/1775256504',
'md5': '932a3abd45c6aa2b1fdbe028fcb4c4fc',
@@ -100,7 +106,8 @@ class XiamiSongIE(XiamiBaseIE):
'ext': 'lrc',
}],
},
- }
+ },
+ 'skip': 'Georestricted',
}]
def _real_extract(self, url):
@@ -124,6 +131,7 @@ class XiamiAlbumIE(XiamiPlaylistBaseIE):
'id': '2100300444',
},
'playlist_count': 10,
+ 'skip': 'Georestricted',
}, {
'url': 'http://www.xiami.com/album/512288?spm=a1z1s.6843761.1110925389.6.hhE9p9',
'only_matching': True,
@@ -141,6 +149,7 @@ class XiamiArtistIE(XiamiPlaylistBaseIE):
'id': '2132',
},
'playlist_count': 20,
+ 'skip': 'Georestricted',
}
@@ -155,4 +164,5 @@ class XiamiCollectionIE(XiamiPlaylistBaseIE):
'id': '156527391',
},
'playlist_mincount': 29,
+ 'skip': 'Georestricted',
}