création parser function pour récupérer le lien vers l'émission du soir
This commit is contained in:
parent
1c184d5f33
commit
5918b1c999
@ -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"])
|
||||
|
||||
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"])
|
Loading…
Reference in New Issue
Block a user