Skip to content

Commit

Permalink
test: Actualiser les tests d'intégration.
Browse files Browse the repository at this point in the history
  • Loading branch information
regseb committed Oct 18, 2024
1 parent 18559de commit 316f06d
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 30 deletions.
13 changes: 12 additions & 1 deletion test/integration/labeler/vimeo.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,18 @@ import assert from "node:assert/strict";
import { complete } from "../../../src/core/labelers.js";
import { extract } from "../../../src/core/scrapers.js";

describe("Labeler: Vimeo", function () {
// Désactiver les tests, car Vimeo détecte que la requête provient d'un robot et
// il affiche une page de vérification.
//
// """
// Verify to continue
//
// To continue, please confirm that you're a human (and not a spambot).
// Checking if the site connection is secure
//
// vimeo.com needs to review the security of your connection before proceeding.
// """
describe.skip("Labeler: Vimeo", function () {
it("should return video label", async function () {
const url = new URL("https://vimeo.com/265045525");
const context = { depth: false, incognito: false };
Expand Down
8 changes: 4 additions & 4 deletions test/integration/scraper/dumpert.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ describe("Scraper: Dumpert", function () {
const file = await extract(url, context);
assert.equal(
file,
"https://media.dumpert.nl/tablet" +
"/3a727e30_d9d8ccbfaeef83c3.mp4.mp4.mp4",
"https://media.dumpert.nl/dmp/media/video/a/1/6" +
"/a167015b-93df-5ead-e5c6-c3768463966e/270/index.m3u8",
);
});

Expand All @@ -26,8 +26,8 @@ describe("Scraper: Dumpert", function () {
const file = await extract(url, context);
assert.equal(
file,
"https://media.dumpert.nl/tablet" +
"/3a727e30_d9d8ccbfaeef83c3.mp4.mp4.mp4",
"https://media.dumpert.nl/dmp/media/video/a/1/6" +
"/a167015b-93df-5ead-e5c6-c3768463966e/270/index.m3u8",
);
});

Expand Down
6 changes: 3 additions & 3 deletions test/integration/scraper/megaphone.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ import assert from "node:assert/strict";
import { extract } from "../../../src/core/scrapers.js";

describe("Scraper: Megaphone", function () {
it("should return video URL", async function () {
it("should return audio URL", async function () {
const url = new URL("https://player.megaphone.fm/SLT2646036872?");
const context = { depth: false, incognito: false };

const file = await extract(url, context);
assert.equal(file, "https://dcs.megaphone.fm/SLT2646036872.mp3");
});

it("should return video URL when protocol is HTTP ", async function () {
it("should return audio URL when protocol is HTTP ", async function () {
const url = new URL("http://player.megaphone.fm/SLT5236779375");
const context = { depth: false, incognito: false };

const file = await extract(url, context);
assert.equal(file, "https://dcs.megaphone.fm/SLT5236779375.mp3");
});

it("should return video URL from playlist", async function () {
it("should return audio URL from playlist", async function () {
const url = new URL("https://playlist.megaphone.fm?e=SLT5884670747");
const context = { depth: false, incognito: false };

Expand Down
20 changes: 8 additions & 12 deletions test/integration/scraper/ouestfrance.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,10 @@ describe("Scraper: Ouest-France [fr]", function () {
const context = { depth: false, incognito: false };

const file = await extract(url, context);
assert.ok(
undefined !== file &&
new URL(file).pathname.endsWith(
"/cd/be/cdbeda603ae5805ab0561403d5e1afabcd685162.mp4",
),
`new URL(${file}).pathname.endsWith(...)`,
assert.equal(
file,
"https://assets.digiteka.com/encoded/ngs-5e1bea72/mp4" +
"/ac6ff5d1f0924ed0748739b3db3100a8d707dae8.mp4",
);
});

Expand All @@ -59,12 +57,10 @@ describe("Scraper: Ouest-France [fr]", function () {
const context = { depth: false, incognito: false };

const file = await extract(url, context);
assert.ok(
undefined !== file &&
new URL(file).pathname.endsWith(
"/d7/5d/d75df81c7abb517d514bff22ab74816fa86a3850.mp4",
),
`new URL(${file}).pathname.endsWith(...)`,
assert.equal(
file,
"https://assets.digiteka.com/encoded/ngs-60e0a434/mp4" +
"/d75df81c7abb517d514bff22ab74816fa86a3850.mp4",
);
},
);
Expand Down
2 changes: 1 addition & 1 deletion test/integration/scraper/podcastaddict.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe("Scraper: Podcast Addict", function () {
assert.equal(
file,
"https://sphinx.acast.com/p/open/s/5b7ac427c6a58e726f576cff/e" +
"/62b5812411883600129b5886/media.mp3?from=PodcastAddict",
"/62b5812411883600129b5886/media.mp3",
);
});
});
4 changes: 2 additions & 2 deletions test/integration/scraper/primevideo.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ describe("Scraper: Prime Video", function () {
file?.startsWith(
"plugin://plugin.video.amazon-test/" +
"?mode=PlayVideo" +
"&asin=amzn1.dv.gti.026cbf6c-0d46-4128-85a0-6e6c882af0ed" +
"&name=Jack%20Ryan%20%E2%80%93%20Season%204",
"&asin=amzn1.dv.gti.a3f19de4-9ec3-4428-a3ea-a7aa4a0792d8" +
"&name=Tom%20Clancy%26%2339%3Bs%20Jack%20Ryan",
),
`"${file}"?.startsWith(...)`,
);
Expand Down
10 changes: 8 additions & 2 deletions test/integration/scraper/rumble.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,20 @@ describe("Scraper: Rumble [us]", function () {
const context = { depth: false, incognito: false };

const file = await extract(url, context);
assert.equal(file, "https://ak2.rmbl.ws/s8/2/2/5/p/N/25pNf.haa.mp4");
assert.equal(
file,
"https://1a-1791.com/video/s8/2/2/5/p/N/25pNf.haa.mp4",
);
});

it("should return video URL from embed", async function () {
const url = new URL("https://rumble.com/embed/v1gga0u/?pub=4");
const context = { depth: false, incognito: false };

const file = await extract(url, context);
assert.equal(file, "https://ak2.rmbl.ws/s8/2/-/p/1/G/-p1Gf.haa.mp4");
assert.equal(
file,
"https://1a-1791.com/video/s8/2/-/p/1/G/-p1Gf.haa.mp4",
);
});
});
5 changes: 2 additions & 3 deletions test/integration/scraper/stargr.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ describe("Scraper: StarGR", function () {
const file = await extract(url, context);
assert.equal(
file,
"https://cdnapisec.siliconweb.com/p/713821/sp/0/playManifest" +
"/entryId/1_p9vdk3nq/format/applehttp/protocol/https" +
"/flavorParamId/0/manifest.m3u8",
"https://deliver2.siliconweb.com/kwik/star.m3u8" +
"?key=bJD0eU0GwsGMMg5dgYDa6Q",
);
});

Expand Down
4 changes: 2 additions & 2 deletions test/integration/scraper/streamable.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import { extract } from "../../../src/core/scrapers.js";

describe("Scraper: Streamable", function () {
it("should return video URL [opengraph]", async function () {
const url = new URL("https://streamable.com/bvyeck");
const url = new URL("https://streamable.com/ewubkc");
const context = { depth: false, incognito: false };

const file = await extract(url, context);
assert.ok(
undefined !== file && new URL(file).pathname.endsWith("bvyeck.mp4"),
undefined !== file && new URL(file).pathname.endsWith("ewubkc.mp4"),
`new URL("${file}").pathname.endsWith(...)`,
);
});
Expand Down
9 changes: 9 additions & 0 deletions test/integration/scraper/vimeo.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ import { extract } from "../../../src/core/scrapers.js";

// Désactiver les tests, car Vimeo détecte que la requête provient d'un robot et
// il affiche une page de vérification.
//
// """
// Verify to continue
//
// To continue, please confirm that you're a human (and not a spambot).
// Checking if the site connection is secure
//
// vimeo.com needs to review the security of your connection before proceeding.
// """
describe.skip("Scraper: Vimeo", function () {
it("should return undefined when it isn't a video", async function () {
const url = new URL("https://vimeo.com/channels");
Expand Down

0 comments on commit 316f06d

Please sign in to comment.