feat: add Consumet as provider for stream URL

Summary:

Test Plan:
This commit is contained in:
2024-05-30 09:47:07 -04:00
parent 40daf70209
commit 7e3c818828
7 changed files with 137 additions and 21 deletions

View File

@@ -50,4 +50,44 @@ describe('requests the "/episodes/:id/url" route', () => {
expect(response.json()).resolves.toEqual({ success: false });
expect(response.status).toBe(404);
});
it("with sources from Consumet", async () => {
const response = await app.request(
"/episodes/1/url",
{
method: "POST",
body: JSON.stringify({
provider: "consumet",
id: "/ore-dake-level-up-na-ken-episode-2",
}),
headers: { "Content-Type": "application/json" },
},
{
ENABLE_ANIFY: "true",
},
);
expect(response.json()).resolves.toEqual({
success: true,
result: {
source: "https://consumet.com",
subtitles: [],
audio: [],
},
});
});
it("with no URL from Consumet source", async () => {
const response = await app.request("/episodes/-1/url", {
method: "POST",
body: JSON.stringify({
provider: "consumet",
id: "unknown",
}),
headers: { "Content-Type": "application/json" },
});
expect(response.json()).resolves.toEqual({ success: false });
expect(response.status).toBe(404);
});
});