Fixed pagination for Killergram, added pagination to actor profiles, added Killergram Platinum. Added experimental m3u8 stream support.
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
const moment = require('moment');
|
||||
// const fs = require('fs');
|
||||
// const m3u8stream = require('m3u8stream');
|
||||
|
||||
// const logger = require('../logger')(__filename);
|
||||
const logger = require('../logger')(__filename);
|
||||
const http = require('../utils/http');
|
||||
const qu = require('../utils/qu');
|
||||
const slugify = require('../utils/slugify');
|
||||
@@ -45,10 +43,11 @@ function scrapeAll(scenes, entity) {
|
||||
});
|
||||
}
|
||||
|
||||
async function scrapeScene({ query }, url, _entity) {
|
||||
async function scrapeScene({ query }, url) {
|
||||
const release = {};
|
||||
const { pathname, origin, host } = new URL(url);
|
||||
|
||||
const entryId = new URL(url).pathname.match(/\/video\/(\d+)/)[1];
|
||||
const entryId = pathname.match(/\/video\/(\d+)/)[1];
|
||||
release.entryId = entryId;
|
||||
|
||||
const title = query.meta('name=title');
|
||||
@@ -74,30 +73,19 @@ async function scrapeScene({ query }, url, _entity) {
|
||||
release.poster = query.q('.detail-hero').style['background-image'].match(/url\((.+)\)/)[1];
|
||||
release.photos = query.imgs('.detail-grabs img');
|
||||
|
||||
/*
|
||||
// example https://video.pictalk.com/5d13d6e5f7533152a61ee20e/2020-07-06/ab92b1e24d1c249e508bf5c73f047baf.m3u8
|
||||
m3u8stream('https://video.pictalk.com/5d13d6e5f7533152a61ee20e/2020-07-06/ab92b1e24d1c249e508bf5c73f047baf.m3u8')
|
||||
.pipe(fs.createWriteStream('./test.mp4'));
|
||||
|
||||
const streamData = await http.get(`${entity.url}/video/source/${entryId}`, {
|
||||
host: new URL(entity.url).host,
|
||||
const streamData = await http.get(`${origin}/video/source/${entryId}`, {
|
||||
host,
|
||||
referer: url,
|
||||
});
|
||||
}, { queueMethod: '5s' });
|
||||
|
||||
if (streamData.ok && streamData.body.status === 'success') {
|
||||
console.log(streamData.body);
|
||||
|
||||
await m3u8stream(streamData.body.link)
|
||||
.pipe(fs.createWriteStream('./trailer.mp4'))
|
||||
.on('progress', status => console.log(status))
|
||||
.on('error', error => console.log(error));
|
||||
release.trailer = {
|
||||
stream: streamData.body.link,
|
||||
};
|
||||
} else {
|
||||
logger.warn(`Failed to fetch trailer for ${url}: ${streamData.ok ? streamData.body.status : streamData.status }`);
|
||||
}
|
||||
|
||||
if (streamData.body.status !== 'success') {
|
||||
logger.warn(`Could not retrieve trailer from ${entity.name} (Teen Core Club): ${streamData.body.status}`);
|
||||
}
|
||||
*/
|
||||
|
||||
return release;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user