@@ -21,16 +21,16 @@ describe("Scraper: Arte", function () {
21
21
} ) ;
22
22
23
23
it ( "should return french video URL" , async function ( ) {
24
- // Récupérer l'URL d'une vidéo sur la page d'accueil .
25
- const response = await fetch ( "https://www.arte.tv/fr/" ) ;
26
- const text = await response . text ( ) ;
27
- const doc = new DOMParser ( ) . parseFromString ( text , "text/html ") ;
28
-
29
- // Récupérer le dernier de la liste pour ne pas prendre des vidéos qui
30
- // ne sont pas encore disponibles .
31
- const url = new URL (
32
- doc . querySelector ( `[data-testid="teaserItem"]:last-child a` ) . href ,
33
- ) ;
24
+ // Récupérer l'URL d'une vidéo parmi les vidéos les plus vues .
25
+ const response = await fetch ( "https://www.arte.tv/api/rproxy/emac/v3" +
26
+ "/fr/web/data/VIDEO_LISTING/" +
27
+ "?videoType=MOST_VIEWED&authorizedAreas=ALL ") ;
28
+ const json = await response . json ( ) ;
29
+ // Garder les éléments pointant vers une seule vidéos (et non vers une
30
+ // liste de vidéos) .
31
+ const video = json . data . find ( ( d ) => ! d . kind . isCollection ) ;
32
+
33
+ const url = new URL ( video . url ) ;
34
34
const options = { depth : false , incognito : false } ;
35
35
36
36
const file = await extract ( url , options ) ;
@@ -39,16 +39,16 @@ describe("Scraper: Arte", function () {
39
39
} ) ;
40
40
41
41
it ( "should return german video URL" , async function ( ) {
42
- // Récupérer l'URL d'une vidéo sur la page d'accueil .
43
- const response = await fetch ( "https://www.arte.tv/de/" ) ;
44
- const text = await response . text ( ) ;
45
- const doc = new DOMParser ( ) . parseFromString ( text , "text/html ") ;
46
-
47
- // Récupérer le dernier de la liste pour ne pas prendre des vidéos qui
48
- // ne sont pas encore disponibles .
49
- const url = new URL (
50
- doc . querySelector ( `[data-testid="teaserItem"]:last-child a` ) . href ,
51
- ) ;
42
+ // Récupérer l'URL d'une vidéo parmi les vidéos les plus vues .
43
+ const response = await fetch ( "https://www.arte.tv/api/rproxy/emac/v3" +
44
+ "/de/web/data/VIDEO_LISTING/" +
45
+ "?videoType=MOST_VIEWED&authorizedAreas=ALL ") ;
46
+ const json = await response . json ( ) ;
47
+ // Garder les éléments pointant vers une seule vidéos (et non vers une
48
+ // liste de vidéos) .
49
+ const video = json . data . find ( ( d ) => ! d . kind . isCollection ) ;
50
+
51
+ const url = new URL ( video . url ) ;
52
52
const options = { depth : false , incognito : false } ;
53
53
54
54
const file = await extract ( url , options ) ;
0 commit comments