création parser function pour récupérer le lien vers l'émission du soir

This commit is contained in:
vincent 2018-08-18 16:44:04 +02:00
parent 1c184d5f33
commit 5918b1c999

View File

@ -41,6 +41,16 @@ def load_jsonfile(file):
with open(file, 'r', encoding='utf-8') as f: with open(file, 'r', encoding='utf-8') as f:
return json.load(f) return json.load(f)
parsechaine()
data=load_jsonfile('chaine.json') def parse_emmission(URL):
print(data["0"]) response = urllib.request.urlopen(URL)
html = response.read()
parse=BeautifulSoup(html,"html.parser")
link=parse.select_one(".prog_name")
return {'title':link['title'],'href':("https://www.programme-tv.net"+link['href'])}
print(parse_emmission("https://www.programme-tv.net/rechercher?q=France+3"))
#parsechaine()
#data=load_jsonfile('chaine.json')
#print(data["0"])