feat: update fetchFacebookItems with cookie auto-loading
This commit is contained in:
@@ -942,9 +942,18 @@ export default async function fetchFacebookItems(
|
|||||||
LOCATION = "toronto",
|
LOCATION = "toronto",
|
||||||
MAX_ITEMS = 25,
|
MAX_ITEMS = 25,
|
||||||
cookiesSource?: string,
|
cookiesSource?: string,
|
||||||
|
cookiePath?: string,
|
||||||
) {
|
) {
|
||||||
// Load Facebook cookies - required for Facebook Marketplace access
|
// Load Facebook cookies - required for Facebook Marketplace access
|
||||||
const cookies = await loadFacebookCookies(cookiesSource);
|
let cookies: Cookie[];
|
||||||
|
if (cookiesSource) {
|
||||||
|
// Use provided cookie source (backward compatibility)
|
||||||
|
cookies = await loadFacebookCookies(cookiesSource);
|
||||||
|
} else {
|
||||||
|
// Auto-load from file or parse from env var
|
||||||
|
cookies = await ensureFacebookCookies(cookiePath);
|
||||||
|
}
|
||||||
|
|
||||||
if (cookies.length === 0) {
|
if (cookies.length === 0) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
"Facebook cookies are required for marketplace access. " +
|
"Facebook cookies are required for marketplace access. " +
|
||||||
|
|||||||
Reference in New Issue
Block a user