Skip to content

Commit 5b9b710

Browse files
committedNov 27, 2023
fix: Corriger le scraper pour Arte.
1 parent 79e872a commit 5b9b710

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed
 

‎src/core/scraper/arte.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ const action = async function ({ pathname }) {
2727
const response = await fetch(`${API_URL}/${lang}/${id}`);
2828
const json = await response.json();
2929

30-
return json.data.attributes.streams?.[0].url;
30+
return json.data.attributes.streams[0]?.url;
3131
};
3232
export const extract = matchPattern(action, "*://www.arte.tv/*/videos/*/*");

‎test/unit/core/scraper/arte.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ describe("core/scraper/arte.js", function () {
1818
});
1919

2020
it("should return undefined when video is unavailable", async function () {
21-
const stub = sinon.stub(globalThis, "fetch").resolves(
22-
// eslint-disable-next-line unicorn/no-null
23-
Response.json({ data: { attributes: { streams: null } } }),
24-
);
21+
const stub = sinon
22+
.stub(globalThis, "fetch")
23+
.resolves(
24+
Response.json({ data: { attributes: { streams: [] } } }),
25+
);
2526

2627
const url = new URL("https://www.arte.tv/de/videos/foo/bar");
2728

0 commit comments

Comments
 (0)