Forum

Web Scraping with V...
 
Notifications
Clear all

Web Scraping with VBA

6 Posts
2 Users
0 Reactions
111 Views
(@alloua26)
Posts: 3
Active Member
Topic starter
 

 I am reading the list of cars from Craigslist Miami using VBA. The code is working fine with printing the links for each vehicle and price. The only issue when I select a different city for instance, Los Angeles, the URL sysntax changes and I am not sure how to read the class name. Code below works fine for Miami link (in the code), but does not work for this link:  https://losangeles.craigslist.org/search/cta#search=1~list~1~0

Please see attached.

 

Thank you for helping.

 
Posted : 03/12/2022 7:23 pm
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

Crossposted here

excel - How Can I Extract list of prices from website using VBA? - Stack Overflow

 

Please read these Forum Rules

 
Posted : 05/12/2022 8:41 pm
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

Hi,

Have you tried using the updated code provided on Stack Overflow?  I tried it and it looks like it works.  You just need to incorporate your original code loop or each location you want to get data from.

I don't see that the url changes beyond the location name at the start or the URL so it's no different to dealing with different page numbers for each page of search results.

Phil

 
Posted : 13/12/2022 7:07 pm
(@alloua26)
Posts: 3
Active Member
Topic starter
 

Hi Phil - Sorry for the delayed response.

I tried the code on Stack Overflow, but it s super slow. My original code in the file I shared is very fast and works exactly how I want it.  I was thinking if I can use a Case Statement with expression checks the format of the URL. I just need to figure out how to update the URL Syntax, class names, etc..

It would be great if you can take a look at file attached.

 

Thanks

 
Posted : 21/12/2022 9:26 pm
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

Hi,

nothing attached.  You need to click Start Upload after selecting the file, then wait for it to upload.

Phil

 
Posted : 21/12/2022 10:28 pm
(@alloua26)
Posts: 3
Active Member
Topic starter
 

Hello - Can you please check now?

 
Posted : 22/12/2022 9:31 am
Share: