feat: add airingTimestamp and secondsUntilAiring to /anime/schedule endpoint
This commit is contained in:
@@ -40,6 +40,10 @@ async function scrapeEstimatedSchedule(
|
|||||||
}
|
}
|
||||||
|
|
||||||
$(selector).each((_, el) => {
|
$(selector).each((_, el) => {
|
||||||
|
const airingTimestamp = new Date(
|
||||||
|
`${date}T${$(el)?.find("a .time")?.text()?.trim()}:00`
|
||||||
|
).getTime();
|
||||||
|
|
||||||
res.scheduledAnimes.push({
|
res.scheduledAnimes.push({
|
||||||
id: $(el)?.find("a")?.attr("href")?.slice(1)?.trim() || null,
|
id: $(el)?.find("a")?.attr("href")?.slice(1)?.trim() || null,
|
||||||
time: $(el)?.find("a .time")?.text()?.trim() || null,
|
time: $(el)?.find("a .time")?.text()?.trim() || null,
|
||||||
@@ -49,6 +53,8 @@ async function scrapeEstimatedSchedule(
|
|||||||
?.find("a .film-name.dynamic-name")
|
?.find("a .film-name.dynamic-name")
|
||||||
?.attr("data-jname")
|
?.attr("data-jname")
|
||||||
?.trim() || null,
|
?.trim() || null,
|
||||||
|
airingTimestamp,
|
||||||
|
secondsUntilAiring: Math.floor((airingTimestamp - Date.now()) / 1000),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user