Added rss feed for novelupdates.com to auto pickup novel being published
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { subDays } from "date-fns";
|
||||
import { Book, Chapter, Editor } from "./types";
|
||||
|
||||
const API_URL = process.env.NEXT_PUBLIC_API_URL as string;
|
||||
@@ -48,6 +49,14 @@ export async function fetchBooks(): Promise<Book[]> {
|
||||
return data.data;
|
||||
}
|
||||
|
||||
export async function fetchChaptersRSS(): Promise<Chapter[]> {
|
||||
const currentDateTime = new Date()
|
||||
const yesterday = subDays(currentDateTime, 1);
|
||||
const data = await fetchFromAPI<{ data: Chapter[] }>
|
||||
(`/api/chapters?populate=book&filters[release_datetime][$lte]=${currentDateTime.toISOString()}&filters[release_datetime][$gte]=${yesterday.toISOString()}`);
|
||||
return data.data;
|
||||
}
|
||||
|
||||
export async function fetchBookChapterLinks(bookId: string): Promise<Book> {
|
||||
const currentDateTime = new Date().toISOString();
|
||||
const data = await fetchFromAPI<{ data: Book }>(`/api/books/${bookId}?populate[chapters][filters][release_datetime][$lte]=${currentDateTime}`);
|
||||
|
||||
Reference in New Issue
Block a user