mirror of
https://github.com/wukko/cobalt.git
synced 2025-05-29 13:00:12 +02:00
tumblr: render error template for broken links
This commit is contained in:
parent
81e68c37f5
commit
34d8333d72
@ -4,7 +4,7 @@ import { genericUserAgent } from "../../config.js";
|
|||||||
export default async function(obj) {
|
export default async function(obj) {
|
||||||
const { subdomain } = psl.parse(obj.url.hostname);
|
const { subdomain } = psl.parse(obj.url.hostname);
|
||||||
if (subdomain?.includes('.'))
|
if (subdomain?.includes('.'))
|
||||||
return { error: 'ErrorBrokenLink' }
|
return { error: ['ErrorBrokenLink', 'tumblr'] }
|
||||||
|
|
||||||
let html = await fetch(`https://${obj.user ?? subdomain}.tumblr.com/post/${obj.id}`, {
|
let html = await fetch(`https://${obj.user ?? subdomain}.tumblr.com/post/${obj.id}`, {
|
||||||
headers: { "user-agent": genericUserAgent }
|
headers: { "user-agent": genericUserAgent }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user