Dec-18-2019, 01:43 PM
Hello,
I'm new to python, I'm trying to pull the number from the document using BeautifulSoup.
Here is my code :
Anyone here to help ?
I'm new to python, I'm trying to pull the number from the document using BeautifulSoup.
Here is my code :
from textwrap import shorten from bs4 import BeautifulSoup import json import requests import re url = 'https://m.propertyfinder.ae/en/rent/apartment-for-rent-dubai-dubai-marina-marina-promenade-delphine-tower-7276805.html' response = requests.get(url) soup = BeautifulSoup(response.text, 'lxml') all_scripts = soup.find_all('script') whatsapp_script = all_scripts[6] whatsapp = re.search('{"type":"whatsapp","value":"([^"]+)"[^}]+}', whatsapp_script) print(whatsapp.group())I'm getting error like :
Error:Traceback (most recent call last):
File "/Users/evilslab/Documents/Websites/www.futurepoint.dev.cc/dobuyme/python/fetchFinder.py", line 12, in <module>
whatsapp = re.search('{"type":"whatsapp","value":"([^"]+)"[^}]+}', whatsapp_script)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/re.py", line 199, in search
return _compile(pattern, flags).search(string)
TypeError: expected string or bytes-like object
I'm trying to get the whatsapp number. How i can do that ?Anyone here to help ?