Added support for /i/ eroshare items.

This commit is contained in:
ThePendulum 2018-05-14 00:38:49 +02:00
parent 9dc067c84f
commit 6f21d41cd0
3 changed files with 9 additions and 45 deletions

View File

@ -39,9 +39,13 @@ const hosts = [{
label: 'gfycat', label: 'gfycat',
pattern: new urlPattern('http(s)\\://(:server.)gfycat.com/:id(.:ext)') pattern: new urlPattern('http(s)\\://(:server.)gfycat.com/:id(.:ext)')
}, { }, {
method: 'eroshare', method: 'eroshareAlbum',
label: 'eroshare', label: 'eroshare',
pattern: new urlPattern('http(s)\\://eroshare.com/:id(#)(:query)') pattern: new urlPattern('http(s)\\://eroshare.com/:id(#)(:query)')
}, {
method: 'eroshareItem',
label: 'eroshare',
pattern: new urlPattern('http(s)\\://eroshare.com/i/:id(#)(:query)')
}]; }];
module.exports = function dissectLink(url) { module.exports = function dissectLink(url) {

View File

@ -1,42 +0,0 @@
'use strict';
const util = require('util');
const config = require('config');
const fetch = require('node-fetch');
function eroshare(post) {
return fetch(`https://web.archive.org/web/20170630040157im_/https://eroshare.com/${post.host.id}`).then(res => {
if(res.ok) {
return res.text();
}
return Promise.reject(`Unable to recover Eroshare video '${post.host.id}' :(`);
}).then(res => {
const data = JSON.parse(res.match(/var album = .*/)[0].slice(12, -1));
const extract = config.library.album.extractSingleItem && data.items.length === 1;
return {
album: extract ? null : {
id: data.slug,
title: data.title,
datetime: new Date(data.created_at)
},
items: data.items.map(item => {
return {
extracted: extract,
id: item.slug,
url: item.type === 'Image' ? item.url_full_protocol : item.url_mp4,
title: data.title,
description: item.description,
type: item.type === 'Image' ? 'image/jpeg' : 'video/mp4',
datetime: new Date(data.created_at),
width: data.width,
height: data.height,
original: item
};
})
};
});
};
module.exports = eroshare;

View File

@ -9,7 +9,8 @@ const imgurAlbum = require('./imgurAlbum.js');
const vidbleImage = require('./vidbleImage.js'); const vidbleImage = require('./vidbleImage.js');
const vidbleAlbum = require('./vidbleAlbum.js'); const vidbleAlbum = require('./vidbleAlbum.js');
const gfycat = require('./gfycat.js'); const gfycat = require('./gfycat.js');
const eroshare = require('./eroshare.js'); const eroshareAlbum = require('./eroshareAlbum.js');
const eroshareItem = require('./eroshareItem.js');
module.exports = { module.exports = {
self, self,
@ -21,5 +22,6 @@ module.exports = {
vidbleImage, vidbleImage,
vidbleAlbum, vidbleAlbum,
gfycat, gfycat,
eroshare eroshareAlbum,
eroshareItem
}; };