mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-18 06:09:58 +00:00
tumblr: formatting
This commit is contained in:
parent
354fbdfa55
commit
0dcd36c16f
1 changed files with 6 additions and 4 deletions
|
@ -3,10 +3,12 @@ import { genericUserAgent } from "../../config.js";
|
||||||
|
|
||||||
export default async function(obj) {
|
export default async function(obj) {
|
||||||
let { subdomain } = psl.parse(obj.url.hostname);
|
let { subdomain } = psl.parse(obj.url.hostname);
|
||||||
if (subdomain?.includes('.'))
|
|
||||||
|
if (subdomain?.includes('.')) {
|
||||||
return { error: ['ErrorBrokenLink', 'tumblr'] }
|
return { error: ['ErrorBrokenLink', 'tumblr'] }
|
||||||
else if (subdomain === 'www')
|
} else if (subdomain === 'www') {
|
||||||
subdomain = undefined;
|
subdomain = undefined
|
||||||
|
}
|
||||||
|
|
||||||
let html = await fetch(`https://${subdomain ?? obj.user}.tumblr.com/post/${obj.id}`, {
|
let html = await fetch(`https://${subdomain ?? obj.user}.tumblr.com/post/${obj.id}`, {
|
||||||
headers: { "user-agent": genericUserAgent }
|
headers: { "user-agent": genericUserAgent }
|
||||||
|
@ -29,5 +31,5 @@ export default async function(obj) {
|
||||||
}
|
}
|
||||||
} else r = { error: 'ErrorEmptyDownload' };
|
} else r = { error: 'ErrorEmptyDownload' };
|
||||||
|
|
||||||
return r;
|
return r
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue