[gameone:playlist] Move test to extractor

This commit is contained in:
Philipp Hagemeister 2014-08-24 07:05:49 +02:00
parent 11f75cac3d
commit 28028629b9
2 changed files with 12 additions and 8 deletions

View file

@ -408,13 +408,6 @@ def test_TeacherTubeUser(self):
self.assertEqual(result['id'], 'rbhagwati2') self.assertEqual(result['id'], 'rbhagwati2')
assertGreaterEqual(self, len(result['entries']), 179) assertGreaterEqual(self, len(result['entries']), 179)
def test_GameOne_playlist(self):
dl = FakeYDL()
ie = GameOnePlaylistIE(dl)
result = ie.extract('http://www.gameone.de/tv')
self.assertIsPlaylist(result)
self.assertEqual(result['title'], 'GameOne')
assertGreaterEqual(self, len(result['entries']), 294)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()

View file

@ -89,13 +89,24 @@ def _real_extract(self, url):
'timestamp': timestamp, 'timestamp': timestamp,
} }
class GameOnePlaylistIE(InfoExtractor): class GameOnePlaylistIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?gameone\.de(?:/tv)?/?$' _VALID_URL = r'https?://(?:www\.)?gameone\.de(?:/tv)?/?$'
IE_NAME = 'gameone:playlist'
_TEST = {
'url': 'http://www.gameone.de/tv',
'info_dict': {
'title': 'GameOne',
},
'playlist_mincount': 294,
}
def _real_extract(self, url): def _real_extract(self, url):
webpage = self._download_webpage('http://www.gameone.de/tv', 'TV') webpage = self._download_webpage('http://www.gameone.de/tv', 'TV')
max_id = max(map(int, re.findall(r'<a href="/tv/(\d+)"', webpage))) max_id = max(map(int, re.findall(r'<a href="/tv/(\d+)"', webpage)))
entries = [self.url_result('http://www.gameone.de/tv/%d' % video_id, 'GameOne') for video_id in range(max_id, 0, -1)] entries = [
self.url_result('http://www.gameone.de/tv/%d' % video_id, 'GameOne')
for video_id in range(max_id, 0, -1)]
return { return {
'_type': 'playlist', '_type': 'playlist',