1
1
import assert from "node:assert" ;
2
- import sinon from "sinon" ;
3
- import { kodi } from "../../../../src/core/kodi.js" ;
4
2
import * as scraper from "../../../../src/core/scraper/lepoint.js" ;
5
3
6
4
describe ( "core/scraper/lepoint.js" , function ( ) {
@@ -14,44 +12,12 @@ describe("core/scraper/lepoint.js", function () {
14
12
} ) ;
15
13
16
14
it ( "should return undefined when it's not a video" , async function ( ) {
17
- const url = new URL ( "https://www.lepoint.fr/foo" ) ;
18
- const content = {
19
- html : ( ) => Promise . resolve ( new DOMParser ( ) . parseFromString ( `
20
- <html>
21
- <body></body>
22
- </html>` , "text/html" ) ) ,
23
- } ;
24
- const options = { depth : false , incognito : false } ;
25
-
26
- const file = await scraper . extract ( url , content , options ) ;
27
- assert . strictEqual ( file , undefined ) ;
28
- } ) ;
29
-
30
- it ( "should return undefined when it's depther" , async function ( ) {
31
15
const url = new URL ( "https://www.lepoint.fr/foo" ) ;
32
16
const content = {
33
17
html : ( ) => Promise . resolve ( new DOMParser ( ) . parseFromString ( `
34
18
<html>
35
19
<body>
36
- <div data-video-src="https://www.youtube.com/embed/baz">
37
- </div>
38
- </body>
39
- </html>` , "text/html" ) ) ,
40
- } ;
41
- const options = { depth : true , incognito : false } ;
42
-
43
- const file = await scraper . extract ( url , content , options ) ;
44
- assert . strictEqual ( file , undefined ) ;
45
- } ) ;
46
-
47
- it ( "should return undefined when sub-page doesn't have media" ,
48
- async function ( ) {
49
- const url = new URL ( "https://www.lepoint.fr/foo" ) ;
50
- const content = {
51
- html : ( ) => Promise . resolve ( new DOMParser ( ) . parseFromString ( `
52
- <html>
53
- <body>
54
- <div data-video-src="http://bar.com/"></div>
20
+ <blockquote></blockquote>
55
21
</body>
56
22
</html>` , "text/html" ) ) ,
57
23
} ;
@@ -61,38 +27,14 @@ describe("core/scraper/lepoint.js", function () {
61
27
assert . strictEqual ( file , undefined ) ;
62
28
} ) ;
63
29
64
- it ( "should return video URL" , async function ( ) {
65
- const stub = sinon . stub ( kodi . addons , "getAddons" ) . resolves ( [ ] ) ;
66
-
67
- const url = new URL ( "https://www.lepoint.fr/foo" ) ;
68
- const content = {
69
- html : ( ) => Promise . resolve ( new DOMParser ( ) . parseFromString ( `
70
- <html>
71
- <body>
72
- <div data-video-src="https://www.youtube.com/embed/baz">
73
- </div>
74
- </body>
75
- </html>` , "text/html" ) ) ,
76
- } ;
77
- const options = { depth : false , incognito : false } ;
78
-
79
- const file = await scraper . extract ( url , content , options ) ;
80
- assert . strictEqual ( file ,
81
- "plugin://plugin.video.youtube/play/" +
82
- "?video_id=baz&incognito=false" ) ;
83
-
84
- assert . strictEqual ( stub . callCount , 1 ) ;
85
- assert . deepStrictEqual ( stub . firstCall . args , [ "video" ] ) ;
86
- } ) ;
87
-
88
- it ( "should return URL from iframe" , async function ( ) {
30
+ it ( "should return URL" , async function ( ) {
89
31
const url = new URL ( "https://www.lepoint.fr/foo" ) ;
90
32
const content = {
91
33
html : ( ) => Promise . resolve ( new DOMParser ( ) . parseFromString ( `
92
34
<html>
93
35
<body>
94
- <iframe src="https://www.dailymotion.com/embed/ video` +
95
- `/ bar"></iframe >
36
+ <blockquote class=" video-dailymotion-unloaded"
37
+ data-videoid=" bar"></blockquote >
96
38
</body>
97
39
</html>` , "text/html" ) ) ,
98
40
} ;
@@ -103,25 +45,5 @@ describe("core/scraper/lepoint.js", function () {
103
45
"plugin://plugin.video.dailymotion_com/" +
104
46
"?mode=playVideo&url=bar" ) ;
105
47
} ) ;
106
-
107
- it ( "should return URL from second iframe" , async function ( ) {
108
- const url = new URL ( "https://www.lepoint.fr/foo" ) ;
109
- const content = {
110
- html : ( ) => Promise . resolve ( new DOMParser ( ) . parseFromString ( `
111
- <html>
112
- <body>
113
- <iframe src="http://exemple.com/data.zip"></iframe>
114
- <iframe src="https://www.dailymotion.com/embed/video` +
115
- `/bar"></iframe>
116
- </body>
117
- </html>` , "text/html" ) ) ,
118
- } ;
119
- const options = { depth : false , incognito : false } ;
120
-
121
- const file = await scraper . extract ( url , content , options ) ;
122
- assert . strictEqual ( file ,
123
- "plugin://plugin.video.dailymotion_com/" +
124
- "?mode=playVideo&url=bar" ) ;
125
- } ) ;
126
48
} ) ;
127
49
} ) ;
0 commit comments