0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-12-30 02:01:05 +00:00

use provided function to get JSON

This commit is contained in:
Georg Jaehnig 2014-05-30 17:51:36 +02:00
parent 4ffeca4ea2
commit 0cdf576d86

View file

@ -2,8 +2,6 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import re import re
import json
import urllib
from .common import InfoExtractor from .common import InfoExtractor
class SpiegeltvIE(InfoExtractor): class SpiegeltvIE(InfoExtractor):
@ -28,22 +26,17 @@ def _real_extract(self, url):
apihost = 'http://spiegeltv-ivms2-restapi.s3.amazonaws.com'; apihost = 'http://spiegeltv-ivms2-restapi.s3.amazonaws.com';
version_json_code = urllib.urlopen('%s/version.json' % apihost).read() version_json = self._download_json('%s/version.json' % apihost, None)
version_json = json.loads(version_json_code)
version_name = version_json['version_name'] version_name = version_json['version_name']
slug_json_code = urllib.urlopen('%s/%s/restapi/slugs/%s.json' % (apihost, version_name, video_id)).read() slug_json = self._download_json('%s/%s/restapi/slugs/%s.json' % (apihost, version_name, video_id), None)
slug_json = json.loads(slug_json_code)
oid = slug_json['object_id'] oid = slug_json['object_id']
media_json_code = urllib.urlopen('%s/%s/restapi/media/%s.json' % (apihost, version_name, oid)).read() media_json = self._download_json('%s/%s/restapi/media/%s.json' % (apihost, version_name, oid), None)
media_json = json.loads(media_json_code)
uuid = media_json['uuid'] uuid = media_json['uuid']
is_wide = media_json['is_wide'] is_wide = media_json['is_wide']
server_json_code = urllib.urlopen('http://www.spiegel.tv/streaming_servers/').read() server_json = self._download_json('http://www.spiegel.tv/streaming_servers/', None)
server_json = json.loads(server_json_code)
server = server_json[0]['endpoint'] server = server_json[0]['endpoint']
thumbnails = [] thumbnails = []