1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-24 04:05:39 +01:00

Handle error from get_http_data

This commit is contained in:
Johan Andersson 2014-12-22 11:02:03 +01:00
parent 08e9ca162f
commit 3fa00d18be
4 changed files with 12 additions and 0 deletions

View File

@ -67,6 +67,9 @@ class Justin(Service):
url = "http://api.justin.tv/api/broadcast/by_%s/%s.xml?onsite=true" % (
vidtype, vid)
error, data = get_http_data(url)
if error:
log.error("Cant get api page")
return
xml = ET.XML(data)
url = xml.find("archive").find("video_file_url").text

View File

@ -13,6 +13,9 @@ class OppetArkiv(Svtplay):
def find_all_episodes(self, options):
page = 1
error, data = self.get_urldata()
if error:
log.error("Cant get web page")
return
match = re.search(r'"http://www.oppetarkiv.se/etikett/titel/([^"/]+)', data)
if match is None:
match = re.search(r'"http://www.oppetarkiv.se/etikett/titel/([^"/]+)', self.url)

View File

@ -113,6 +113,9 @@ class Svtplay(Service, OpenGraphThumbMixin):
log.error("Couldn't retrieve episode list")
return
error, data = get_http_data(match.group(1))
if error:
log.error("Cant get rss page")
return
xml = ET.XML(data)
episodes = [x.text for x in xml.findall(".//item/link")]

View File

@ -155,6 +155,9 @@ class Tv4play(Service, OpenGraphThumbMixin):
if not re.search("%", show):
show = quote_plus(show)
error, data = get_http_data("http://webapi.tv4play.se/play/video_assets?type=episode&is_live=false&platform=web&node_nids=%s&per_page=99999" % show)
if error:
log.error("Can't get api page")
return
jsondata = json.loads(data)
episodes = []
n = 1