Fix for newer BS4?

This commit is contained in:
Pedro de Oliveira 2020-05-04 22:00:30 +01:00
parent 896bdd1572
commit 97589e4645
1 changed files with 1 additions and 1 deletions

View File

@ -11,7 +11,7 @@ class Bollycao():
def get_price(self):
content = self.requests.get(self.url).content
soup = BeautifulSoup(content, 'html.parser')
data_layer = soup.find('script', text=re.compile('dataLayer')).text
data_layer = soup.find('script', text=re.compile('dataLayer')).string
return float(json.loads(data_layer.split('=', 2)[-1][:-1])[0]['product']['price']['final'])