Jump to content
UBot Underground

Scrape Question. I'm trying to learn. (I'M A NOOB)

Recommended Posts

I'm trying to scrape data from Yellow Pages. My bot works up too the point where it collects the business names and lists 30 of them in the .csv in order down the column. However, when it scrapes the others it puts all of the items in the list into the first row and doesn't separate them into corresponding rows with the business names. This bogs down my system and the bot locks up. Any advice would be appreciated.

ui text box("Search Business Type:",#keyword)
ui text box("City, State:",#citystate)
ui stat monitor("Business Names:",$list total(%businessnames))
ui stat monitor("Business Websites:",$list total(%businesswebsiteurls))
ui stat monitor("Business Street Addresses:",$list total(%businessstreetaddress))
ui stat monitor("Business Locality",$list total(%businesslocality))
ui stat monitor("Business Phone Numbers:",$list total(%businessphonenumber))
define Scrape Data {
    clear table(&BusinessList)
    clear list(%businessnames)
    clear list(%businesswebsiteurls)
    clear list(%businessstreetaddress)
    clear list(%businesslocality)
    clear list(%businessphonenumber)
    type text(<placeholder="What are you looking for?">,#keyword,"Standard")
    type text(<placeholder="Where?">,#citystate,"Standard")
    click(<type="submit">,"Left Click","No")
    add list to list(%businessnames,$scrape attribute(<class="business-name">,"outertext"),"Don\'t Delete","Global")
    add list to table as column(&BusinessList,0,0,%businessnames)
    add item to list(%businesswebsiteurls,$scrape attribute(<class="track-visit-website">,"href"),"Don\'t Delete","Global")
    add list to table as column(&BusinessList,0,1,%businesswebsiteurls)
    add item to list(%businessstreetaddress,$scrape attribute(<class="street-address">,"outertext"),"Don\'t Delete","Global")
    add list to table as column(&BusinessList,0,2,%businessstreetaddress)
    add item to list(%businesslocality,$scrape attribute(<class="locality">,"outertext"),"Don\'t Delete","Global")
    add list to table as column(&BusinessList,0,3,%businesslocality)
    add item to list(%businessphonenumber,$scrape attribute(<class="phones phone primary">,"outertext"),"Don\'t Delete","Global")
    add list to table as column(&BusinessList,0,4,%businessphonenumber)
    save to file("{$special folder("Desktop")}/YP-{#keyword}-{#citystate}.csv",&BusinessList)
Scrape Data()
Edited by MethodikalMe
Link to post
Share on other sites

You should use add list to list not add item to list.

%businessnames already using add list to list, but the other lists are still using add item to list.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...