ajout de la variable href a parse emission pour eviter répétition de programme-tv.net

This commit is contained in:
vincent 2018-08-18 19:09:10 +02:00
parent e89626e630
commit eda4baa011

View File

@ -151,7 +151,8 @@ def parse_emmission(URL):
html = response.read() html = response.read()
parse=BeautifulSoup(html,"html.parser") parse=BeautifulSoup(html,"html.parser")
link=parse.select_one(".prog_name") link=parse.select_one(".prog_name")
response = urllib.request.urlopen(("https://www.programme-tv.net"+link['href'])) href="https://www.programme-tv.net"+link['href']
response = urllib.request.urlopen(href)
html = response.read() html = response.read()
parse=BeautifulSoup(html,"html.parser") parse=BeautifulSoup(html,"html.parser")
divcasting=parse.select_one(".descriptif") divcasting=parse.select_one(".descriptif")
@ -164,7 +165,7 @@ def parse_emmission(URL):
img=divsynopsis.find_next('img')['data-src'] img=divsynopsis.find_next('img')['data-src']
synopsis=divsynopsis.select_one(".d-b").text synopsis=divsynopsis.select_one(".d-b").text
return {'title':link['title'],'href':("https://www.programme-tv.net"+link['href']),'casting':casting,'synopsis':synopsis,'img':img} return {'title':link['title'],'href':href,'casting':casting,'synopsis':synopsis,'img':img}
def cli(num): def cli(num):