File tree Expand file tree Collapse file tree 4 files changed +12
-4
lines changed
Expand file tree Collapse file tree 4 files changed +12
-4
lines changed Original file line number Diff line number Diff line change 11import * as cheerio from 'cheerio' ;
22import { BaseScraper } from '../lib/base-scraper.js' ;
3+ import { MIN_VEHICLES } from '../lib/config.js' ;
34
45class CarMaxScraper extends BaseScraper {
56 constructor ( ) {
@@ -54,7 +55,6 @@ class CarMaxScraper extends BaseScraper {
5455 const allListings = [ ] ;
5556 const seenIds = new Set ( ) ;
5657 const searchUrl = buildSearchUrl ( query . make , query . model ) ;
57- const MIN_VEHICLES = 250 ;
5858
5959 await this . page . goto ( searchUrl , {
6060 waitUntil : 'networkidle2' ,
Original file line number Diff line number Diff line change 11import * as cheerio from 'cheerio' ;
22import { BaseScraper } from '../lib/base-scraper.js' ;
3+ import { MIN_VEHICLES } from '../lib/config.js' ;
34
45class CarvanaScraper extends BaseScraper {
56 constructor ( ) {
@@ -45,7 +46,6 @@ class CarvanaScraper extends BaseScraper {
4546
4647 async scrapeModel ( query ) {
4748 const allListings = [ ] ;
48- const MIN_VEHICLES = 250 ;
4949
5050 // Use the search box - let Carvana's autocomplete handle regularization
5151 // This is more robust than constructing filter URLs
Original file line number Diff line number Diff line change 1+ /**
2+ * Scraper configuration
3+ */
4+
5+ export const MIN_VEHICLES = 50 ; // Minimum vehicles to scrape per model before stopping
6+
7+ // TODO: Change back to 250 after testing
8+ // export const MIN_VEHICLES = 250;
Original file line number Diff line number Diff line change 11import * as cheerio from 'cheerio' ;
22import { BaseScraper } from '../lib/base-scraper.js' ;
3+ import { MIN_VEHICLES } from '../lib/config.js' ;
34
45class PlattAutoScraper extends BaseScraper {
56 constructor ( ) {
@@ -45,8 +46,7 @@ class PlattAutoScraper extends BaseScraper {
4546
4647 async scrapeModel ( query ) {
4748 const allListings = [ ] ;
48- const MIN_VEHICLES = 250 ;
49- const maxPages = 100 ; // High enough to get to 250 vehicles
49+ const maxPages = 100 ; // High enough to get to MIN_VEHICLES
5050
5151 for ( let pageNum = 1 ; pageNum <= maxPages && allListings . length < MIN_VEHICLES ; pageNum ++ ) {
5252 const searchUrl = buildSearchUrl ( query . make , query . model , pageNum ) ;
You can’t perform that action at this time.
0 commit comments