Browse Source

recrap programmeTV

master
vincent 2 months ago
parent
commit
e58639bbc8
1 changed files with 10 additions and 9 deletions
  1. +10
    -9
      backend/chainetv/emission.py

+ 10
- 9
backend/chainetv/emission.py 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=""


Loading…
Cancel
Save