BeautifulSoup & Requests for Dynamic Websites Python #152530
-
BodyI was wondering if I could use BeautifulSoup and Requests in Python to scrape cargurus.com. I think it is a dynamic website, so can I get the car prices and images from those libraries? Guidelines
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
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: I got this url by
You can create a second list called headers and write code to generate the url based on what you want to find. So for example if you want a car from 2000 to 2010 you can modify the headers to get that instead of parsing the whole body on your own. I would highly suggest watching a few videos on youtube about scraping ecommerce sites as they would be the closest example to the cargurus site. |
Beta Was this translation helpful? Give feedback.
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:
I got this url by