mirror of
https://github.com/imputnet/cobalt.git
synced 2025-06-28 01:18:27 +00:00
api/pinterest: better regex naming
This commit is contained in:
parent
cb78dd1db9
commit
82fa660568
@ -3,7 +3,7 @@ import { resolveRedirectingURL } from "../url.js";
|
||||
|
||||
const videoRegex = /"url":"(https:\/\/v1\.pinimg\.com\/videos\/.*?)"/g;
|
||||
const imageRegex = /src="(https:\/\/i\.pinimg\.com\/.*\.(jpg|gif))"/g;
|
||||
const validPinRegex = /"__typename"\s*:\s*"PinNotFound"/;
|
||||
const notFoundRegex = /"__typename"\s*:\s*"PinNotFound"/;
|
||||
|
||||
export default async function(o) {
|
||||
let id = o.id;
|
||||
@ -20,9 +20,9 @@ export default async function(o) {
|
||||
headers: { "user-agent": genericUserAgent }
|
||||
}).then(r => r.text()).catch(() => {});
|
||||
|
||||
const invalidPin = html.match(validPinRegex);
|
||||
const invalidPin = html.match(notFoundRegex);
|
||||
|
||||
if (invalidPin) return { error: "fetch.empty" }
|
||||
if (invalidPin) return { error: "fetch.empty" };
|
||||
|
||||
if (!html) return { error: "fetch.fail" };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user