python - Web Scraping Loop -
i'm trying listing price, address , floor area information on 1 philippine real-estate website: http://www.lamudi.com.ph/land/buy/, i'm not able error requested range not satisfiable, , can't move on. may give me bit hint on solution?
one question since there hundreds of pages need scrape, i'm considering creating loop don't need change url hand every time. may give me idea on how create loop?
here code:
count = 1 while (count < 10): lxml import html import requests import bs4 bs urllib.request import urlopen ureq bs4 import beautifulsoup soup my_url = 'http://www.lamudi.com.ph/land/buy?page=count' uclient = ureq(my_url) page_html = uclient.read() soup = bs.beautifulsoup(page_html,'lxml') g_data = soup.find_all("p",{"class": "listing-address icon-location"}) p in g_data: print(p.text) g_data2 = soup.find_all("span",{"class":"listing-price"}) span in g_data2: print(span.text) g_data3 = soup.find_all("ul",{"class":"listing-attributes has-agent"}) ul in g_data3: print(ul.text) count = count + 1
Comments
Post a Comment