From e58639bbc85624c899126bc9e7f80f4f6a00da05 Mon Sep 17 00:00:00 2001 From: vincent Date: Tue, 16 Feb 2021 18:54:06 +0100 Subject: [PATCH] recrap programmeTV --- backend/chainetv/emission.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/backend/chainetv/emission.py b/backend/chainetv/emission.py index cfa032e..7eb7b8c 100644 --- a/backend/chainetv/emission.py +++ b/backend/chainetv/emission.py @@ -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=""