Added support for various tube and social media sites via youtube-dl.
This commit is contained in:
@@ -11,11 +11,12 @@ async function imgurAlbumApi(host, post) {
|
||||
},
|
||||
});
|
||||
|
||||
const { data } = await res.json();
|
||||
|
||||
if (res.status !== 200) {
|
||||
throw new Error(`Could not fetch info for imgur album '${host.id}': ${res.data.error}`);
|
||||
}
|
||||
|
||||
const { data } = await res.json();
|
||||
const extract = config.library.extractSingleAlbumItem && data.images.length === 1;
|
||||
|
||||
if (extract) {
|
||||
|
||||
@@ -13,7 +13,7 @@ async function imgurImageApi(host) {
|
||||
const { data } = await res.json();
|
||||
|
||||
if (res.status !== 200) {
|
||||
throw new Error(`Could not fetch info for imgur image '${host.id}': ${res.data.error}`);
|
||||
throw new Error(`Could not fetch info for imgur image '${host.id}': ${data.error}`);
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -6,7 +6,6 @@ const eroshareItem = require('./eroshareItem');
|
||||
const gfycat = require('./gfycat');
|
||||
const imgurAlbum = require('./imgurAlbum');
|
||||
const imgurImage = require('./imgurImage');
|
||||
const pornhub = require('./pornhub');
|
||||
const redditImage = require('./redditImage');
|
||||
const redditPreview = require('./redditPreview');
|
||||
const redditVideo = require('./redditVideo');
|
||||
@@ -14,6 +13,7 @@ const self = require('./self');
|
||||
const vidbleAlbum = require('./vidbleAlbum');
|
||||
const vidbleImage = require('./vidbleImage');
|
||||
const vidbleVideo = require('./vidbleVideo');
|
||||
const tube = require('./tube');
|
||||
|
||||
module.exports = {
|
||||
erome,
|
||||
@@ -22,11 +22,11 @@ module.exports = {
|
||||
gfycat,
|
||||
imgurAlbum,
|
||||
imgurImage,
|
||||
pornhub,
|
||||
redditImage,
|
||||
redditPreview,
|
||||
redditVideo,
|
||||
self,
|
||||
tube,
|
||||
vidbleAlbum,
|
||||
vidbleImage,
|
||||
vidbleVideo,
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
const youtubedl = require('youtube-dl');
|
||||
const dateFns = require('date-fns');
|
||||
|
||||
async function pornhub(host) {
|
||||
async function tube(host) {
|
||||
const data = await new Promise((resolve, reject) => {
|
||||
youtubedl.getInfo(`https://www.pornhub.com/view_video.php?viewkey=${host.id}`, null, (error, info) => {
|
||||
youtubedl.getInfo(host.url, null, (error, info) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
}
|
||||
@@ -21,6 +21,7 @@ async function pornhub(host) {
|
||||
id: data.id,
|
||||
url: data.url,
|
||||
title: data.fulltitle || data.title,
|
||||
description: data.description,
|
||||
type: `video/${data.ext}`,
|
||||
datetime: dateFns.format(data.upload_date, 'YYYYMMDD'),
|
||||
original: data,
|
||||
@@ -29,4 +30,4 @@ async function pornhub(host) {
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = pornhub;
|
||||
module.exports = tube;
|
||||
Reference in New Issue
Block a user