refactor: remove api cookie query overrides
This commit is contained in:
@@ -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