mirror of
https://github.com/spaam/svtplay-dl.git
synced 2024-11-23 19:55:38 +01:00
some better error handling.
This commit is contained in:
parent
8ef02ef21f
commit
14694e46e3
18
svtplay-dl
18
svtplay-dl
@ -21,8 +21,9 @@ class Common(object):
|
||||
request.add_data(data)
|
||||
try:
|
||||
response = urllib2.urlopen(request)
|
||||
except urllib2.HTTPError:
|
||||
except (urllib2.HTTPError, urllib2.URLError), e:
|
||||
print "Something wrong with that url"
|
||||
print "Error code:", e.code
|
||||
sys.exit(2)
|
||||
|
||||
data = response.read()
|
||||
@ -186,6 +187,10 @@ class Aftonbladet(Common):
|
||||
if start > 0:
|
||||
other = other + " -A %s" % str(start)
|
||||
|
||||
if url == None:
|
||||
print "Error: Cant find any video on that page"
|
||||
sys.exit(2)
|
||||
|
||||
if not self.output:
|
||||
self.output = os.path.basename(path)
|
||||
print "Outfile: ", self.output
|
||||
@ -379,10 +384,19 @@ def main():
|
||||
print "Something wrong with that url"
|
||||
sys.exit(2)
|
||||
url = "http://tv.expressen.se/%s/?standAlone=true&output=xml" % urllib.quote_plus(match.group(1))
|
||||
print match.group(1)
|
||||
expressen = Expressen(output, quality, live)
|
||||
expressen.get(url)
|
||||
|
||||
elif re.findall("(kanal5play|kanal9play)", url):
|
||||
common = Common()
|
||||
data = common.getdata(url)
|
||||
match = re.search("@videoPlayer\" value=\"(.*)\"", data)
|
||||
if not match:
|
||||
print "Something wrong with that url"
|
||||
sys.exit(2)
|
||||
kanal5 = Kanal5(output, quality, live, match.group(1))
|
||||
kanal5.get("c.brightcove.com")
|
||||
|
||||
else:
|
||||
svtplay = Svtplay(output, quality, live)
|
||||
svtplay.get(url)
|
||||
|
Loading…
Reference in New Issue
Block a user