Advertisement
wansyahi1

beautifulSoup

Jan 15th, 2020
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. import re
  2. import requests
  3. from bs4 import BeautifulSoup
  4.  
  5. raw = requests.get('https://www.yellowpages.my/listing/results.php?keyword=boutique&where=selangor&screen=1').text
  6. raw = raw.replace("</br>", "")
  7.  
  8. soup = BeautifulSoup(raw, 'html.parser')
  9. phone = [re.findall('\\>.*?<',d.find('span')['data-content'])[0][1:][:-1] for d in soup.find_all('div',{'class':'cbp-vm-cta'})]
  10. print(phone)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement