Sign in to follow this  
Followers 0
klatuu

Window Cleaning (Scraping)

2 posts in this topic

Hi developers,

I'm a little stumpped as to where to go next. I'd like to be able to get the text results out of this listing (scraping), however, I'm thinking of using a collection and iterating through them, but something's not gelling in how I do this.

Here's a snippet of the source from this link:

<div id="list-results" class=""><ul id="search-results" class="pop-bubble"><li id="zpid_66658207" statusType="1" class="search-result clearfix rollable" longitude="-117132611" latitude="32786006"><div class="featured featured-listing"></div><div class="broker"><span id="agent-photo-tip-66658207" class="definition yui3-tooltip-trigger"><input value="http://photos2.zillow.com/l_b/IS26wn3vbl5pr7.jpg" class="broker-url" type="hidden"></input><img height="60" width="60"></img></span><div id="agent-photo-tip-66658207_tooltip" class="hide"><p class="agent-photo-tip">Agents! Want to get your picture on your listings? <a href="/advertising/realtor-advertising/" class="learn-how" href="#">Learn how</a></p></div></div><div class="plisting property clearfix"><div class="photo photoex"><input value="http://photos1.zillow.com/p_b/IS-1srmvgrmmy8gt.jpg" class="photo-url" type="hidden"></input><a href="/homedetails/2716-Prato-Ln-San-Diego-CA-92108/66658207_zpid/"><img src="http://www.zillowstatic.com/static/images/indicator.gif" class="loading" rel="nofollow" alt="2716 Prato Ln, San Diego, CA"></img></a><img src="http://www.zillowstatic.com/static/images/indicator.gif" class="photoex-loader loading hide"></img><div class="photo-num"><a href="/homedetails/2716-Prato-Ln-San-Diego-CA-92108/66658207_zpid/">25 Photos<span class="zbt dcarat"></span></a></div></div><div class="property-info"><div class="adr"><a title="2716 Prato Ln, San Diego, CA Real Estate" href="/homedetails/2716-Prato-Ln-San-Diego-CA-92108/66658207_zpid/">2716 Prato Ln, San Diego, CA</a><span class="de-emph">(Mission Valley East)</span></div><ul class="value-info"><li class="type-forSale"><span class="zts icon">&nbsp;</span><span class="type">Condo For Sale:</span><span class="price">$459,000</span></li><li class="secondary"><div class="monthly-payment colabc"><div class="zestimate"><span class="definition yui3-tooltip-trigger" data-tooltip-key="zest-tip-list">Zestimate</span><sup>&reg;</sup>: $388,100</div><div class="monthly-payment">Est. Mortgage: $2,147/mo</div><ul class="carrot view-rates-aftertext"><li><a href="/mortgage-rates/" rel="nofollow"><span>See current rates</span></a></li></ul></div></li></ul><ul class="attributes"><li class="prop-cola">Beds: 3<br/> Baths: 2.5<br/> Sqft: 1,439<br/>Lot: --</li><li class="prop-colb">Days on Zillow: <span class="sorted-attribute">1</span><br/>Built: 2004<br/>Condo<br/>Price/sqft: $318</li></ul><ul class="actions"><li class="mapHome ztsa" longitude="-117132611" latitude="32786006" zpid="66658207"><a href="#">Maps</a></li><li class="faves ztsa"><a onclick="trackLink({ category : 'Homes', action : 'Save to Favorites', label : 'Map List' }); return favoriteManager.addFavorite(66658207, favoriteManager.doneSaving(this), event, true);" class="not-saved" rel="nofollow">Save</a></li><li class="similar ztsa"><a rel="nofollow" href="/homes/comps/66658207_zpid/">Comps</a></li></ul></div></div></li><li id="zpid_2120402395" statusType="6" class="search-result clearfix rollable" longitude="-117168619" latitude="32769802"><div class="featured "></div><div class="plisting property clearfix"><div class="photo photoex"><input value="http://photos1.zillow.com/p_b/IS-5b1c35mfae71.jpg" class="photo-url" type="hidden"></input><a href="/homedetails/7084-Friars-Rd-3-San-Diego-CA-92108/2120402395_zpid/"><img src="http://www.zillowstatic.com/static/images/indicator.gif" class="loading" rel="nofollow" alt="7084 Friars Rd # 3, San Diego, CA"></img></a><img src="http://www.zillowstatic.com/static/images/indicator.gif" class="photoex-loader loading hide"></img><div class="photo-num"><a href="/homedetails/7084-Friars-Rd-3-San-Diego-CA-92108/2120402395_zpid/">5 Photos<span class="zbt dcarat"></span></a></div></div><div class="property-info"><div class="adr"><a title="7084 Friars Rd # 3, San Diego, CA Real Estate" href="/homedetails/7084-Friars-Rd-3-San-Diego-CA-92108/2120402395_zpid/">7084 Friars Rd # 3, San Diego, CA</a><span class="de-emph">(Linda Vista)</span></div><ul class="value-info"><li class="type-forRent"><span class="zts icon">&nbsp;</span><span class="type">Apt. For Rent:</span><span class="price">$2,650/mo</span></li><li class="secondary"><div class="colabc"><div class="zestimate"><span class="definition yui3-tooltip-trigger" data-tooltip-key="rzest-tip-list">Rent Zestimate</span><sup>&reg;</sup>: --</div><div>Pets: cats, large dogs</div><div>Availability: now</div></div></li></ul><ul class="attributes"><li class="prop-cola">Beds: 3<br/> Baths: 2.0<br/> Sqft: 1,495<br/>Lot: --</li><li class="prop-colb">Days on Zillow: <span class="sorted-attribute">1</span><br/>Built: --<br/>Apartment<br/></li></ul><ul class="actions"><li class="mapHome ztsa" longitude="-117168619" latitude="32769802" zpid="2120402395"><a href="#">Maps</a></li><li class="faves ztsa"><a onclick="trackLink({ category : 'Homes', action : 'Save to Favorites', label : 'Map List' }); return favoriteManager.addFavorite(2120402395, favoriteManager.doneSaving(this), event, true);" class="not-saved" rel="nofollow">Save</a></li></ul></div></div></li><li id="zpid_2120402425" statusType="6" class="search-result clearfix rollable" longitude="-117175575" latitude="32760433"><div class="featured "></div><div class="plisting property clearfix"><div class="photo photoex"><input value="http://photos3.zillow.com/p_b/IS-1srnogqvcfe59.jpg" class="photo-url" type="hidden"></input><a href="/homedetails/1440-Hotel-Cir-N-1-San-Diego-CA-92108/2120402425_zpid/"><img src="http://www.zillowstatic.com/static/images/indicator.gif" class="loading" rel="nofollow" alt="1440 Hotel Cir N # 1, San Diego, CA"></img></a><img src="http://www.zillowstatic.com/static/images/indicator.gif" class="photoex-loader loading hide"></img><div class="photo-num"><a href="/homedetails/1440-Hotel-Cir-N-1-San-Diego-CA-92108/2120402425_zpid/">5 Photos<span class="zbt dcarat"></span></a></div></div><div class="property-info"><div class="adr"><a title="1440 Hotel Cir N # 1, San Diego, CA Real Estate" href="/homedetails/1440-Hotel-Cir-N-1-San-Diego-CA-92108/2120402425_zpid/">1440 Hotel Cir N # 1, San Diego, CA</a><span class="de-emph">(Mission Valley West)</span></div><ul class="value-info"><li class="type-forRent"><span class="zts icon">&nbsp;</span><span class="type">Apt. For Rent:</span><span class="price">$1,649/mo</span></li>

And this is my code so far:

#include <IE.au3>
#include <Excel.au3>
#include <Array.au3>
Local $FileName = "C:\ZillowExtraction.xlsx"
If Not FileExists($FileName) Then
    MsgBox(0, "Excel File Test", "This file is not there:  " & $FileName)
    Exit
Else
   Local $oExcel = _ExcelBookOpen($FileName, 1, 1) ; Get an Excel Object from an existing filename
  
   If @error = 1 Then
   MsgBox(0, "Error!", "Unable to Create the Excel Object")
   Exit
   ElseIf @error = 2 Then
   MsgBox(0, "Error!", "File does not exist - Shame on you!")
   Exit
   EndIf
EndIf

Local $RowCount = 2
Local $max = 0
Local $zipcode = InputBox("Where to look?", "What zip code would you like to search? ")
;for $RowCount = 2 to $max + 1
;   Local $aArray2 = _ExcelReadArray($oExcel, $RowCount, 1, 4) ;Direction is Horizontal

Local $oIE = _IECreate("http://www.zillow.com/homes/" & $zipcode & "/") ; check out the parameters to set IE and Excel invisible

I need to get the following but I'm not sure how I access them:

PropertyAddress.......

  • Apt. For Rent:$2,650/mo
  • Rent Zestimate®: --

    Pets: cats, large dogs

    Availability: now

  • Beds: 3

    Baths: 2.0

    Sqft: 1,495

    Lot: --

  • Days on Zillow: 1

    Built: --

    Apartment

Share this post


Link to post
Share on other sites



save yourself some time and do it direct from excel.

look at "Data - Get External Data - From Web"

just input your url select data/table from web page

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0