xvideosx 1.5.8 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
@@ -30,6 +30,20 @@ console.log(fresh.pagination.pages); // [1, 2, 3, 4, 5...]
|
|
30
30
|
console.log(fresh.hasNext()); // true
|
31
31
|
console.log(fresh.hasPrevious()); // false
|
32
32
|
|
33
|
+
const newFresh = await xvideos.videos.newFresh({ page: 1 });
|
34
|
+
console.log(fresh.videos)
|
35
|
+
/*{
|
36
|
+
title,
|
37
|
+
url,
|
38
|
+
thumbNail,
|
39
|
+
preview,
|
40
|
+
path,
|
41
|
+
duration,
|
42
|
+
channel,
|
43
|
+
views,
|
44
|
+
};
|
45
|
+
*/
|
46
|
+
|
33
47
|
const nextPage = await fresh.next();
|
34
48
|
console.log(nextPage.pagination.current); // 2
|
35
49
|
console.log(nextPage.hasNext()); // true
|
@@ -1,40 +1,20 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
const
|
5
|
-
|
6
|
-
const newFresh = async ({
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
const
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
const thumbNail = $element.find('.thumb img').attr('src');
|
22
|
-
const duration = $element.find('.duration').text();
|
23
|
-
const name = $element.find('.metadata .name').text();
|
24
|
-
|
25
|
-
return {
|
26
|
-
|
27
|
-
title,
|
28
|
-
url,
|
29
|
-
thumbNail,
|
30
|
-
duration,
|
31
|
-
name,
|
32
|
-
};
|
33
|
-
}).get();
|
34
|
-
return videos;
|
35
|
-
} finally {
|
36
|
-
if (browser) await browser.close();
|
37
|
-
}
|
38
|
-
};
|
39
|
-
|
40
|
-
module.exports = newFresh;
|
1
|
+
const base = require('../../base');
|
2
|
+
const parseResponse = require('./parseResponse');
|
3
|
+
|
4
|
+
const PATH = '/new/';
|
5
|
+
|
6
|
+
const newFresh = async ({ page = 1 } = {}) => {
|
7
|
+
if (page < 1 || page > Number.MAX_SAFE_INTEGER) {
|
8
|
+
throw new Error(`Invalid page: ${page}`);
|
9
|
+
}
|
10
|
+
try {
|
11
|
+
const request = base.createRequest();
|
12
|
+
const verificationPath = page > 1 ? `${PATH}${page}` : '';
|
13
|
+
|
14
|
+
return parseResponse(page, await request.get(`${verificationPath}`));
|
15
|
+
} catch (e) {
|
16
|
+
console.log(e);
|
17
|
+
}
|
18
|
+
};
|
19
|
+
|
20
|
+
module.exports = newFresh;
|
@@ -7,8 +7,10 @@ const createHasPreviousFunction = require('./createHasPreviousFunction');
|
|
7
7
|
const createPreviousFunction = require('./createPreviousFunction');
|
8
8
|
|
9
9
|
const getVideos = ($) => {
|
10
|
-
return $('
|
11
|
-
.map((i, video) =>
|
10
|
+
return $('.thumb-block')
|
11
|
+
.map((i, video) => {
|
12
|
+
return parseVideo($, video);
|
13
|
+
})
|
12
14
|
.get();
|
13
15
|
};
|
14
16
|
|
@@ -1,25 +1,34 @@
|
|
1
1
|
const base = require('../../base');
|
2
2
|
|
3
|
+
const extractorUrl = (imageUrl) => {
|
4
|
+
const regex = /\/thumbs169ll(\/(?:[0-9a-f]{2}\/){3}[0-9a-f]{32})\//i;
|
5
|
+
const match = imageUrl.match(regex);
|
6
|
+
if (match && match[1]) {
|
7
|
+
const extractedPart = match[1];
|
8
|
+
const newUrl = `https://gcore-pic.xvideos-cdn.com/videos/videopreview${extractedPart}_169.mp4`;
|
9
|
+
return newUrl;
|
10
|
+
} return null;
|
11
|
+
};
|
12
|
+
|
3
13
|
const parseVideo = ($, video) => {
|
4
14
|
const $video = $(video);
|
5
|
-
|
6
|
-
const title = $video.find('p:not(.metadata) a').attr('title');
|
15
|
+
const title = $video.find('.title a').attr('title');
|
7
16
|
const path = $video.find('.thumb > a').attr('href');
|
8
17
|
const url = `${base.BASE_URL}${path}`;
|
9
|
-
const
|
18
|
+
const thumbNail = $video.find('div.thumb img').attr('data-src');
|
19
|
+
const preview = extractorUrl(thumbNail);
|
10
20
|
const duration = $video.find('p.metadata > span.bg > span.duration').text();
|
11
|
-
const
|
12
|
-
const
|
13
|
-
name: profileElement.text(),
|
14
|
-
url: `${base.BASE_URL}${profileElement.attr('href')}`,
|
15
|
-
};
|
21
|
+
const channel = $video.find('.metadata .name').text();
|
22
|
+
const views = $video.find('.metadata > span > span:not(.duration) > span:not(.sprluous) ').text();
|
16
23
|
|
17
24
|
return {
|
25
|
+
title,
|
18
26
|
url,
|
27
|
+
thumbNail,
|
28
|
+
preview,
|
19
29
|
path,
|
20
|
-
title,
|
21
30
|
duration,
|
22
|
-
|
31
|
+
channel,
|
23
32
|
views,
|
24
33
|
};
|
25
34
|
};
|
package/package.json
CHANGED
@@ -1,44 +1,44 @@
|
|
1
|
-
{
|
2
|
-
"name": "xvideosx",
|
3
|
-
"description": "xvideos.com api implementation.",
|
4
|
-
"version": "1.
|
5
|
-
"main": "index.js",
|
6
|
-
"license": "BSD-3-Clause",
|
7
|
-
"repository": {
|
8
|
-
"type": "git",
|
9
|
-
"url": "https://github.com/4CROS2/xvideos.git"
|
10
|
-
},
|
11
|
-
"keywords": [
|
12
|
-
"crawler",
|
13
|
-
"porn",
|
14
|
-
"spider",
|
15
|
-
"scrapper",
|
16
|
-
"api",
|
17
|
-
"xvideos",
|
18
|
-
"api",
|
19
|
-
"library"
|
20
|
-
],
|
21
|
-
"scripts": {
|
22
|
-
"eslint": "eslint . --ext .js",
|
23
|
-
"test": "cross-env NODE_ENV=test mocha --exit lib/**/*.spec.js",
|
24
|
-
"coverage": "nyc --reporter=html --reporter=lcov npm test"
|
25
|
-
},
|
26
|
-
"dependencies": {
|
27
|
-
"axios": "^0.21.4",
|
28
|
-
"cheerio": "^1.0.0-rc.12",
|
29
|
-
"puppeteer": "^22.0.0"
|
30
|
-
},
|
31
|
-
"devDependencies": {
|
32
|
-
"chai": "^4.3.4",
|
33
|
-
"codeclimate-test-reporter": "^0.5.1",
|
34
|
-
"cross-env": "^7.0.3",
|
35
|
-
"eslint": "^7.23.0",
|
36
|
-
"eslint-config-airbnb-base": "^14.2.1",
|
37
|
-
"eslint-plugin-import": "^2.22.1",
|
38
|
-
"mocha": "^9.1.4",
|
39
|
-
"nyc": "^15.1.0"
|
40
|
-
},
|
41
|
-
"engines": {
|
42
|
-
"node": ">=7.6.0"
|
43
|
-
}
|
44
|
-
}
|
1
|
+
{
|
2
|
+
"name": "xvideosx",
|
3
|
+
"description": "xvideos.com api implementation.",
|
4
|
+
"version": "1.6.0",
|
5
|
+
"main": "index.js",
|
6
|
+
"license": "BSD-3-Clause",
|
7
|
+
"repository": {
|
8
|
+
"type": "git",
|
9
|
+
"url": "https://github.com/4CROS2/xvideos.git"
|
10
|
+
},
|
11
|
+
"keywords": [
|
12
|
+
"crawler",
|
13
|
+
"porn",
|
14
|
+
"spider",
|
15
|
+
"scrapper",
|
16
|
+
"api",
|
17
|
+
"xvideos",
|
18
|
+
"api",
|
19
|
+
"library"
|
20
|
+
],
|
21
|
+
"scripts": {
|
22
|
+
"eslint": "eslint . --ext .js",
|
23
|
+
"test": "cross-env NODE_ENV=test mocha --exit lib/**/*.spec.js",
|
24
|
+
"coverage": "nyc --reporter=html --reporter=lcov npm test"
|
25
|
+
},
|
26
|
+
"dependencies": {
|
27
|
+
"axios": "^0.21.4",
|
28
|
+
"cheerio": "^1.0.0-rc.12",
|
29
|
+
"puppeteer": "^22.0.0"
|
30
|
+
},
|
31
|
+
"devDependencies": {
|
32
|
+
"chai": "^4.3.4",
|
33
|
+
"codeclimate-test-reporter": "^0.5.1",
|
34
|
+
"cross-env": "^7.0.3",
|
35
|
+
"eslint": "^7.23.0",
|
36
|
+
"eslint-config-airbnb-base": "^14.2.1",
|
37
|
+
"eslint-plugin-import": "^2.22.1",
|
38
|
+
"mocha": "^9.1.4",
|
39
|
+
"nyc": "^15.1.0"
|
40
|
+
},
|
41
|
+
"engines": {
|
42
|
+
"node": ">=7.6.0"
|
43
|
+
}
|
44
|
+
}
|