Refactored 21sextury scraper.
This commit is contained in:
@@ -8,7 +8,6 @@ const moment = require('moment');
|
||||
|
||||
const { fetchSites } = require('../sites');
|
||||
const { matchTags } = require('../tags');
|
||||
const pluckPhotos = require('../utils/pluck-photos');
|
||||
|
||||
const defaultTags = {
|
||||
hardx: [],
|
||||
@@ -38,7 +37,7 @@ function scrapePhotos(html) {
|
||||
return unlockedPhotos.concat(lockedThumbnails);
|
||||
}
|
||||
|
||||
async function getPhotos(albumPath, siteDomain, site) {
|
||||
async function getPhotos(albumPath, siteDomain) {
|
||||
const albumUrl = `https://${siteDomain}${albumPath}`;
|
||||
|
||||
const html = await fetchPhotos(albumUrl);
|
||||
@@ -56,14 +55,7 @@ async function getPhotos(albumPath, siteDomain, site) {
|
||||
concurrency: 2,
|
||||
});
|
||||
|
||||
const allPhotos = photos.concat(otherPhotos.flat());
|
||||
|
||||
const photoLimit = (site.network.parameters && site.network.parameters.photoLimit) || 25;
|
||||
const photoIndexes = pluckPhotos(allPhotos.length - 1, photoLimit);
|
||||
|
||||
const pluckedPhotos = photoIndexes.map(photoIndex => allPhotos[photoIndex]);
|
||||
|
||||
return pluckedPhotos;
|
||||
return photos.concat(otherPhotos.flat());
|
||||
}
|
||||
|
||||
function scrape(html, site) {
|
||||
|
||||
Reference in New Issue
Block a user