correction cas ou la chaine n'est pas une chaine referencer

This commit is contained in:
vincent 2018-08-18 19:34:55 +02:00
parent eda4baa011
commit 86ccdbee75

View File

@ -148,9 +148,12 @@ def parse_emmission(URL):
response = urllib.request.urlopen(URL)
except urllib.error.URLError:
return False
html = response.read()
parse=BeautifulSoup(html,"html.parser")
link=parse.select_one(".prog_name")
if link == None:
return "can't find show"
href="https://www.programme-tv.net"+link['href']
response = urllib.request.urlopen(href)
html = response.read()
@ -179,16 +182,19 @@ def cli(num):
return
emision=parse_emmission(geturlprogrammetv(data[num]))
if emision:
print("emmision ce soir: "+emision["title"])
if len(emision['casting']) > 0:
print("réalisateur: "+emision['casting'][0])
print("acteur: "+str(emision['casting'][1:]))
print("synopsys: " +emision['synopsis'])
print("lien: "+emision['href'])
if emision == "can't find show":
print ("impssible de parser cette chaine")
else:
print("emmision ce soir: "+emision["title"])
if len(emision['casting']) > 0:
print("réalisateur: "+emision['casting'][0])
print("acteur: "+str(emision['casting'][1:]))
print("synopsys: " +emision['synopsis'])
print("lien: "+emision['href'])
else:
print("pas de connection internet impossible de determiner l'émission du soir")
print("")
if len(sys.argv) > 1:
for i in sys.argv[1:]:
if i =="update":