Logging memory usage on media fetch.

This commit is contained in:
DebaucheryLibrarian
2021-12-27 17:29:23 +01:00
parent 0ad64ef5f4
commit 299f257a01
5 changed files with 16 additions and 22 deletions

View File

@@ -177,10 +177,10 @@ async function getThumbs(entryId, site, parameters) {
});
if (res.ok && res.body.results?.[0]?.hits[0]?.set_pictures) {
return res.body.results[0].hits[0].set_pictures.map((img) => ([
return res.body.results[0].hits[0].set_pictures.map((img) => img.thumb_path && ([
`https://transform.gammacdn.com/photo_set${img.thumb_path}`,
`https://images-evilangel.gammacdn.com/photo_set${img.thumb_path}`,
]));
])).filter(Boolean);
}
return [];
@@ -410,10 +410,14 @@ async function scrapeSceneApi(data, site, options) {
if (data.pictures) {
release.poster = [
`https://transform.gammacdn.com/movies${data.pictures['1920x1080']}`,
`https://images-evilangel.gammacdn.com/movies${data.pictures['1920x1080']}`,
`https://transform.gammacdn.com/movies${data.pictures.resized}`,
`https://images-evilangel.gammacdn.com/movies${data.pictures.resized}`,
...(data.pictures['1920x1080'] ? [
`https://transform.gammacdn.com/movies${data.pictures['1920x1080']}`,
`https://images-evilangel.gammacdn.com/movies${data.pictures['1920x1080']}`,
] : []),
...(data.pictures.resized ? [
`https://transform.gammacdn.com/movies${data.pictures.resized}`,
`https://images-evilangel.gammacdn.com/movies${data.pictures.resized}`,
] : []),
];
}
@@ -495,8 +499,6 @@ async function scrapeMovie({ query, el }, url, entity, baseRelease, options) {
release.trailer = await fetchMovieTrailer(release);
}
console.log(release);
return release;
}

View File

@@ -140,16 +140,6 @@ async function fetchLatest(site, page = 1) {
return res.status;
}
async function fetchScene(url, site) {
const res = await qu.get(url);
if (res.ok) {
return scrapeScene(res.item, url, site);
}
return res.status;
}
async function fetchProfile({ name: actorName }, entity, include) {
const searchRes = await qu.getAll(`https://kink.com/search?type=performers&q=${actorName}`, '.model');
@@ -176,6 +166,6 @@ async function fetchProfile({ name: actorName }, entity, include) {
module.exports = {
fetchLatest,
fetchScene,
fetchProfile,
scrapeScene,
};

View File

@@ -249,7 +249,8 @@ async function fetchLatest(entity, page, options) {
.where('is_sfw', true)
.pluck('path')
.orderByRaw('random()')
.limit(Math.floor(Math.random() * 10) + 1);
// .limit(Math.floor(Math.random() * 10) + 1)
.limit(100);
// const poster = 'sfw/kittens/thumbs/iNEXVlX-RLs.jpeg';