Separated error log. Added search/summary update tool.
This commit is contained in:
@@ -15,7 +15,7 @@ function scrapeSceneMetadata(data, channel) {
|
||||
release.description = data.description;
|
||||
|
||||
release.date = new Date(data.release_date);
|
||||
release.duration = qu.durationToSeconds(data.videos_duration);
|
||||
release.duration = data.seconds_duration || qu.durationToSeconds(data.videos_duration);
|
||||
|
||||
release.actors = data.models.map((model) => ({
|
||||
entryId: model.id,
|
||||
@@ -50,6 +50,22 @@ function scrapeAllMetadata(scenes, channel) {
|
||||
return scenes.map((data) => scrapeSceneMetadata(data, channel));
|
||||
}
|
||||
|
||||
function scrapeAllApi(scenes, channel) {
|
||||
return scenes.map((data) => {
|
||||
const release = {};
|
||||
|
||||
release.entryId = data.id;
|
||||
|
||||
release.title = data.title;
|
||||
release.description = data.description;
|
||||
|
||||
console.log(data);
|
||||
console.log(release);
|
||||
|
||||
return release;
|
||||
});
|
||||
}
|
||||
|
||||
function scrapeProfileMetadata(data, channel) {
|
||||
const profile = {};
|
||||
|
||||
@@ -95,6 +111,16 @@ async function fetchLatestMetadata(channel, page = 1) {
|
||||
return res.status;
|
||||
}
|
||||
|
||||
async function fetchLatestApi(channel, page, { parameters }) {
|
||||
const res = await http.get(`${channel.url}/_next/data/${parameters.endpoint}/videos.json?order_by=publish_date&sort_by=desc&per_page=30&page=${page}`);
|
||||
|
||||
if (res.ok) {
|
||||
return scrapeAllApi(res.body.pageProps.contents.data, channel);
|
||||
}
|
||||
|
||||
return res.status;
|
||||
}
|
||||
|
||||
async function fetchSceneMetadata(url, channel) {
|
||||
const res = await http.get(url, {
|
||||
parse: true,
|
||||
@@ -136,8 +162,12 @@ async function fetchProfileMetadata(actor, channel) {
|
||||
|
||||
module.exports = {
|
||||
metadata: {
|
||||
// probably deprecated
|
||||
fetchLatest: fetchLatestMetadata,
|
||||
fetchScene: fetchSceneMetadata,
|
||||
fetchProfile: fetchProfileMetadata,
|
||||
},
|
||||
api: {
|
||||
fetchLatest: fetchLatestApi,
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user