- rewrote and/or optimized all service modules - rewrote matching and processing modules to optimize readability and performance - added support for reddit gifs - fixed various issues with twitter error explanations - code optimizations and enhancements (such as finally getting rid of ==, prettier and more readable formatting, etc) - added branch information - all functions in currentCommit submodule run only once and cache received data - added a test script. only twitter and soundcloud are 100% covered and tested atm, will add tests (and probably fixes) for the rest of services in next commits - changed some localization strings for russian - added more clarity to rate limit message - moved services folder into processing folder
15 lines
731 B
JavaScript
15 lines
731 B
JavaScript
import { genericUserAgent } from "../../config.js";
|
|
|
|
export default async function(obj) {
|
|
let html = await fetch(`https://${
|
|
obj.user ? obj.user : obj.url.split('.')[0].replace('https://', '')
|
|
}.tumblr.com/post/${obj.id}`, {
|
|
headers: { "user-agent": genericUserAgent }
|
|
}).then((r) => { return r.text() }).catch(() => { return false });
|
|
|
|
if (!html) return { error: 'ErrorCouldntFetch' };
|
|
if (!html.includes('property="og:video" content="https://va.media.tumblr.com/')) return { error: 'ErrorEmptyDownload' };
|
|
|
|
return { urls: `https://va.media.tumblr.com/${html.split('property="og:video" content="https://va.media.tumblr.com/')[1].split('"')[0]}`, audioFilename: `tumblr_${obj.id}_audio` }
|
|
}
|