This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { isDefined } from 'remeda' | |
import type { KeyFields } from '@/cache/utils/generate-cache-key' | |
import type { JsonParsed } from '@/utils' | |
import { Cache } from '@/cache' | |
import { generateCacheKey } from '@/cache/utils/generate-cache-key' | |
interface UseCachedOptions<T> { | |
parser?: (raw: JsonParsed<NonNullable<T>>) => NonNullable<T> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Browser, launch, Page } from "puppeteer"; | |
async function checkUrl(browser: Browser, url: string): Promise<boolean> { | |
let page: Page | null = null; | |
try { | |
// Mở 1 trang mới cho URL cụ thể | |
page = await browser.newPage(); | |
await page.setUserAgent( | |
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36', | |
); |