pinterest: replace filter with find

This commit is contained in:
wukko 2024-05-15 17:52:05 +06:00
parent ee2457be7a
commit 73a1d917b8
No known key found for this signature in database
GPG Key ID: 3E30B3F26C7B4AA2

View File

@ -22,7 +22,7 @@ export default async function(o) {
let videoLink = [...html.matchAll(videoRegex)] let videoLink = [...html.matchAll(videoRegex)]
.map(([, link]) => link) .map(([, link]) => link)
.filter(a => a.endsWith('.mp4') && a.includes('720p'))[0]; .find(a => a.endsWith('.mp4') && a.includes('720p'));
if (videoLink) return { if (videoLink) return {
urls: videoLink, urls: videoLink,
@ -32,7 +32,7 @@ export default async function(o) {
let imageLink = [...html.matchAll(imageRegex)] let imageLink = [...html.matchAll(imageRegex)]
.map(([, link]) => link) .map(([, link]) => link)
.filter(a => a.endsWith('.jpg') || a.endsWith('.gif'))[0]; .find(a => a.endsWith('.jpg') || a.endsWith('.gif'));
if (imageLink) return { if (imageLink) return {
urls: imageLink, urls: imageLink,