Skip to content

Commit 75fe30f

Browse files
min_vehicles global
1 parent 371a653 commit 75fe30f

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

scrapers/carmax/scrape.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as cheerio from 'cheerio';
22
import { BaseScraper } from '../lib/base-scraper.js';
3+
import { MIN_VEHICLES } from '../lib/config.js';
34

45
class 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',

scrapers/carvana/scrape.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as cheerio from 'cheerio';
22
import { BaseScraper } from '../lib/base-scraper.js';
3+
import { MIN_VEHICLES } from '../lib/config.js';
34

45
class 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

scrapers/lib/config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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;

scrapers/plattauto/scrape.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as cheerio from 'cheerio';
22
import { BaseScraper } from '../lib/base-scraper.js';
3+
import { MIN_VEHICLES } from '../lib/config.js';
34

45
class 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);

0 commit comments

Comments
 (0)