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) sleep(0.1)
pass pass
strsearch=strsearch.replace('É','E') 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: if linkchaine == None:
strsearch=strsearch.replace(" ","") 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: if linkchaine == None:
return "can't find channel" 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'] href = link['href']
img=linkchaine.parent.parent.find_next_sibling().find_next('img')['src']
response = urllib.request.urlopen(href) response = urllib.request.urlopen(href)
parse=BeautifulSoup(response.read(),"html.parser") parse=BeautifulSoup(response.read(),"html.parser")
divcasting=parse.select_one(".descriptif") divcasting=parse.select_one(".peopleList")
if (divcasting): if (divcasting):
casting=divcasting.find_all(href=re.compile("biographie")) casting=divcasting.find_all(href=re.compile("\/biographie.*"))
count=0 count=0
for actor in casting: for actor in casting:
casting[count]=actor.text casting[count]=actor['title']
count+=1 count+=1
else: else:
casting= None casting= None
divsynopsis=parse.select_one(".episode-synopsis") divsynopsis=parse.select_one(".synopsis-text")
if (divsynopsis): if (divsynopsis):
img=divsynopsis.find_next('img')['data-src'] synopsis=divsynopsis.text
synopsis=divsynopsis.select_one(".d-b").text
else: else:
img=None img=None
synopsis="" synopsis=""