From 5918b1c9997b6cf8245a41031eee3b9bb98ceafb Mon Sep 17 00:00:00 2001 From: vincent Date: Sat, 18 Aug 2018 16:44:04 +0200 Subject: [PATCH] =?UTF-8?q?cr=C3=A9ation=20parser=20function=20pour=20r?= =?UTF-8?q?=C3=A9cup=C3=A9rer=20le=20lien=20vers=20l'=C3=A9mission=20du=20?= =?UTF-8?q?soir?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parserHTML.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/parserHTML.py b/parserHTML.py index 686927e..986f43c 100644 --- a/parserHTML.py +++ b/parserHTML.py @@ -41,6 +41,16 @@ def load_jsonfile(file): with open(file, 'r', encoding='utf-8') as f: return json.load(f) -parsechaine() -data=load_jsonfile('chaine.json') -print(data["0"]) \ No newline at end of file + +def parse_emmission(URL): + 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"]) \ No newline at end of file