refactor: remove api cookie query overrides
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
import { fetchEbayItems } from "@marketplace-scrapers/core";
|
||||
|
||||
/**
|
||||
* GET /api/ebay?q={query}&minPrice={minPrice}&maxPrice={maxPrice}&strictMode={strictMode}&exclusions={exclusions}&keywords={keywords}&buyItNowOnly={buyItNowOnly}&canadaOnly={canadaOnly}&cookies={cookies}
|
||||
* GET /api/ebay?q={query}&minPrice={minPrice}&maxPrice={maxPrice}&strictMode={strictMode}&exclusions={exclusions}&keywords={keywords}&buyItNowOnly={buyItNowOnly}&canadaOnly={canadaOnly}
|
||||
* Search eBay for listings (default: Buy It Now only, Canada only)
|
||||
* Optional: Pass cookies parameter to bypass bot detection
|
||||
*/
|
||||
export async function ebayRoute(req: Request): Promise<Response> {
|
||||
try {
|
||||
@@ -38,8 +37,6 @@ export async function ebayRoute(req: Request): Promise<Response> {
|
||||
|
||||
const maxItemsParam = reqUrl.searchParams.get("maxItems");
|
||||
const maxItems = maxItemsParam ? parseInt(maxItemsParam, 10) : undefined;
|
||||
const cookies = reqUrl.searchParams.get("cookies") || undefined;
|
||||
|
||||
const items = await fetchEbayItems(SEARCH_QUERY, 1, {
|
||||
minPrice,
|
||||
maxPrice,
|
||||
@@ -48,7 +45,6 @@ export async function ebayRoute(req: Request): Promise<Response> {
|
||||
keywords,
|
||||
buyItNowOnly,
|
||||
canadaOnly,
|
||||
cookies,
|
||||
});
|
||||
|
||||
const results = maxItems ? items.slice(0, maxItems) : items;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { fetchFacebookItems } from "@marketplace-scrapers/core";
|
||||
|
||||
/**
|
||||
* GET /api/facebook?q={query}&location={location}&cookies={cookies}
|
||||
* GET /api/facebook?q={query}&location={location}
|
||||
* Search Facebook Marketplace for listings
|
||||
*/
|
||||
export async function facebookRoute(req: Request): Promise<Response> {
|
||||
@@ -18,19 +18,11 @@ export async function facebookRoute(req: Request): Promise<Response> {
|
||||
);
|
||||
|
||||
const LOCATION = reqUrl.searchParams.get("location") || "toronto";
|
||||
const COOKIES_SOURCE = reqUrl.searchParams.get("cookies") || undefined;
|
||||
const maxItemsParam = reqUrl.searchParams.get("maxItems");
|
||||
const maxItems = maxItemsParam ? parseInt(maxItemsParam, 10) : 25;
|
||||
|
||||
try {
|
||||
const items = await fetchFacebookItems(
|
||||
SEARCH_QUERY,
|
||||
1,
|
||||
LOCATION,
|
||||
maxItems,
|
||||
COOKIES_SOURCE,
|
||||
undefined,
|
||||
);
|
||||
const items = await fetchFacebookItems(SEARCH_QUERY, 1, LOCATION, maxItems);
|
||||
if (!items || items.length === 0)
|
||||
return Response.json(
|
||||
{ message: "Search didn't return any results!" },
|
||||
|
||||
Reference in New Issue
Block a user