recrap programmeTV

This commit is contained in:
vincent 2021-02-16 18:54:06 +01:00
parent 02f408ac33
commit e58639bbc8

View File

@ -32,29 +32,30 @@ class Emmission(object):
sleep(0.1)
pass
strsearch=strsearch.replace('É','E')
linkchaine=self.html.find(text=re.compile(re.escape(strsearch)))
strsearch=strsearch.strip()
linkchaine=self.html.find(title=re.compile(re.escape(strsearch)))
if linkchaine == None:
strsearch=strsearch.replace(" ","")
linkchaine=self.html.find(text=re.compile(re.escape(strsearch)))
linkchaine=self.html.find(title=re.compile(re.escape(strsearch)))
if linkchaine == None:
return "can't find channel"
link = linkchaine.parent.parent.find_next_sibling().find_next_sibling().find("a")
link = linkchaine.parent.parent.find_next_sibling().find("a")
href = link['href']
img=linkchaine.parent.parent.find_next_sibling().find_next('img')['src']
response = urllib.request.urlopen(href)
parse=BeautifulSoup(response.read(),"html.parser")
divcasting=parse.select_one(".descriptif")
divcasting=parse.select_one(".peopleList")
if (divcasting):
casting=divcasting.find_all(href=re.compile("biographie"))
casting=divcasting.find_all(href=re.compile("\/biographie.*"))
count=0
for actor in casting:
casting[count]=actor.text
casting[count]=actor['title']
count+=1
else:
casting= None
divsynopsis=parse.select_one(".episode-synopsis")
divsynopsis=parse.select_one(".synopsis-text")
if (divsynopsis):
img=divsynopsis.find_next('img')['data-src']
synopsis=divsynopsis.select_one(".d-b").text
synopsis=divsynopsis.text
else:
img=None
synopsis=""