MethodikalMe 0 Posted October 17, 2021 Report Share Posted October 17, 2021 (edited) 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) navigate("https://www.yellowpages.com/","Wait") 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 October 17, 2021 by MethodikalMe Quote Link to post Share on other sites
Varo 28 Posted October 18, 2021 Report Share Posted October 18, 2021 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. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.