Python Forum
web scraping with python regular expression
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
web scraping with python regular expression
#1
Given a website, I want to use python regular expression to get the data out from the web page.
Although I can use other packages, my requirement is only to use regular expression to get the required data from webpage.

If I want to find the Mexican restaurants in Dalals, I go to this link
https://www.yelp.com/search?find_desc=Re...2C+TX&ns=1

From here I want to find (from the first page) the restaurant name, its ranking, its number of reviews etc.
This information will be stored in the list of dictionaries.
My program looks like as follows but I m stuck on how to loop / how to find the required data.
import urllib.request
from re import findall
import re

url = "https://www.yelp.com/search?find_desc=Restaurants+Mexican&find_loc=Dallas%2C+TX&ns=1"
response = urllib.request.urlopen(url)
html = response.read()
htmlStr = html.decode()
Reply


Messages In This Thread
web scraping with python regular expression - by dbpython2017 - Sep-25-2017, 06:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Regular Expression rakhmadiev 6 5,395 Aug-21-2023, 01:52 PM
Last Post: Gribouillis
  BeautifulSoup : how to have a html5 attribut searched for in a regular expression ? arbiel 2 2,638 May-09-2020, 03:05 PM
Last Post: arbiel
  Extract text from tag content using regular expression Pavel_47 8 5,275 Nov-25-2019, 03:17 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020