aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl
diff options
context:
space:
mode:
authorremitamine <remitamine@gmail.com>2015-09-05 21:03:13 +0100
committerremitamine <remitamine@gmail.com>2015-09-05 21:03:13 +0100
commit673bf566fc1aa1351a40c7378893aff6cb0fc91b (patch)
treeb8058e65af8b8668bbcfb6f81e8a353192f2f048 /youtube_dl
parentf95c5e1218aacc5cc4c01b19f5ee9f7baf9269d6 (diff)
[nowness] more api abstraction
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/extractor/nowness.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/youtube_dl/extractor/nowness.py b/youtube_dl/extractor/nowness.py
index a8ee4fe68..3371145c1 100644
--- a/youtube_dl/extractor/nowness.py
+++ b/youtube_dl/extractor/nowness.py
@@ -30,11 +30,11 @@ class NownessBaseIE(InfoExtractor):
elif source == 'cinematique':
return self.url_result('http://cinematique.com/embed/%s' % video_id, 'Cinematique')
- def api_request(self, url, request_url):
+ def api_request(self, url, request_path):
display_id = self._match_id(url)
lang = 'zh-cn' if 'cn.nowness.com' in url else 'en-us'
- request = compat_urllib_request.Request(request_url % display_id, headers={
+ request = compat_urllib_request.Request('http://api.nowness.com/api/' + request_path % display_id, headers={
'X-Nowness-Language': lang,
})
json_data = self._download_json(request, display_id)
@@ -72,7 +72,7 @@ class NownessIE(NownessBaseIE):
]
def _real_extract(self, url):
- display_id, post = self.api_request(url, 'http://api.nowness.com/api/post/getBySlug/%s')
+ display_id, post = self.api_request(url, 'post/getBySlug/%s')
return self.extract_url_result(post)
@@ -89,7 +89,7 @@ class NownessPlaylistIE(NownessBaseIE):
}
def _real_extract(self, url):
- playlist_id, playlist = self.api_request(url, 'http://api.nowness.com/api/post?PlaylistId=%s')
+ playlist_id, playlist = self.api_request(url, 'post?PlaylistId=%s')
entries = [self.extract_url_result(item) for item in playlist['items']]
return self.playlist_result(entries, playlist_id)
@@ -107,7 +107,7 @@ class NownessSerieIE(NownessBaseIE):
}
def _real_extract(self, url):
- display_id, serie = self.api_request(url, 'http://api.nowness.com/api/series/getBySlug/%s')
+ display_id, serie = self.api_request(url, 'series/getBySlug/%s')
serie_id = str(serie['id'])
entries = [self.extract_url_result(post) for post in serie['posts']]
return self.playlist_result(entries, serie_id)