Skip to content
Discussion options

You must be logged in to vote

Yes, Cargurus is a dynamic site, but you can scrape it using requests since the API returns JSON data. No need for BeautifulSoup. Here's an example:

import requests
url = 'https://www.cargurus.com/Cars/searchPage.action?searchId=edbf91d6-ee03-4d89-b58d-20891db3a9a0&zip=95064&distance=50&sourceContext=carGurusHomePageModel&inventorySearchWidgetType=AUTO&sortDir=ASC&sortType=BEST_MATCH&srpVariation=DEFAULT_SEARCH&isDeliveryEnabled=true&nonShippableBaseline=0'
print(requests.get(url).json())

I got this url by

  1. Going to cargurus.com
  2. Making a search for all cars
  3. Going into inspect element and reloading the page
  4. Finding the request starting with seachPage.action?
  5. Clicking on it and looking at…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Naksh-Rathore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question Ask and answer questions about GitHub features and usage Programming Help Discussions around programming languages, open source and software development
2 participants