xvideosx 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.codeclimate.yml +12 -0
- package/.editorconfig +12 -0
- package/.eslintignore +0 -0
- package/.eslintrc.yml +26 -0
- package/.gitattributes +107 -0
- package/.github/workflows/node.js.yml +29 -0
- package/.travis.yml +13 -0
- package/AUTHORS +2 -0
- package/CODE_OF_CONDUCT.md +5 -0
- package/LICENSE +29 -0
- package/README.md +188 -0
- package/index.js +1 -0
- package/lib/api/base.js +14 -0
- package/lib/api/index.js +5 -0
- package/lib/api/videos/best/best.js +19 -0
- package/lib/api/videos/best/best.spec.js +138 -0
- package/lib/api/videos/best/createHasNextFunction.js +10 -0
- package/lib/api/videos/best/createHasPreviousFunction.js +10 -0
- package/lib/api/videos/best/createNextFunction.js +12 -0
- package/lib/api/videos/best/createPreviousFunction.js +12 -0
- package/lib/api/videos/best/createRefreshFunction.js +11 -0
- package/lib/api/videos/best/index.js +1 -0
- package/lib/api/videos/best/parseResponse.js +45 -0
- package/lib/api/videos/best/parseVideo.js +27 -0
- package/lib/api/videos/dashboard/createHasNextFunction.js +10 -0
- package/lib/api/videos/dashboard/createHasPreviousFunction.js +10 -0
- package/lib/api/videos/dashboard/createNextFunction.js +12 -0
- package/lib/api/videos/dashboard/createPreviousFunction.js +12 -0
- package/lib/api/videos/dashboard/createRefreshFunction.js +11 -0
- package/lib/api/videos/dashboard/dashboard.js +14 -0
- package/lib/api/videos/dashboard/dashboard.spec.js +138 -0
- package/lib/api/videos/dashboard/index.js +1 -0
- package/lib/api/videos/dashboard/parseResponse.js +45 -0
- package/lib/api/videos/dashboard/parseVideo.js +27 -0
- package/lib/api/videos/details/details.js +48 -0
- package/lib/api/videos/details/details.spec.js +49 -0
- package/lib/api/videos/details/index.js +1 -0
- package/lib/api/videos/fresh/createHasNextFunction.js +10 -0
- package/lib/api/videos/fresh/createHasPreviousFunction.js +10 -0
- package/lib/api/videos/fresh/createNextFunction.js +12 -0
- package/lib/api/videos/fresh/createPreviousFunction.js +12 -0
- package/lib/api/videos/fresh/createRefreshFunction.js +11 -0
- package/lib/api/videos/fresh/fresh.js +14 -0
- package/lib/api/videos/fresh/fresh.spec.js +138 -0
- package/lib/api/videos/fresh/index.js +1 -0
- package/lib/api/videos/fresh/parseResponse.js +45 -0
- package/lib/api/videos/fresh/parseVideo.js +27 -0
- package/lib/api/videos/index.js +8 -0
- package/lib/api/videos/search/createHasNextFunction.js +10 -0
- package/lib/api/videos/search/createHasPreviousFunction.js +10 -0
- package/lib/api/videos/search/createNextFunction.js +12 -0
- package/lib/api/videos/search/createPreviousFunction.js +12 -0
- package/lib/api/videos/search/createRefreshFunction.js +11 -0
- package/lib/api/videos/search/index.js +1 -0
- package/lib/api/videos/search/parseResponse.js +45 -0
- package/lib/api/videos/search/parseVideo.js +27 -0
- package/lib/api/videos/search/search.js +23 -0
- package/lib/api/videos/search/search.spec.js +138 -0
- package/lib/api/videos/verified/createHasNextFunction.js +10 -0
- package/lib/api/videos/verified/createHasPreviousFunction.js +10 -0
- package/lib/api/videos/verified/createNextFunction.js +12 -0
- package/lib/api/videos/verified/createPreviousFunction.js +12 -0
- package/lib/api/videos/verified/createRefreshFunction.js +11 -0
- package/lib/api/videos/verified/index.js +1 -0
- package/lib/api/videos/verified/parseResponse.js +45 -0
- package/lib/api/videos/verified/parseVideo.js +27 -0
- package/lib/api/videos/verified/verified.js +14 -0
- package/lib/api/videos/verified/verified.spec.js +138 -0
- package/lib/index.js +1 -0
- package/lib/xvideos.js +1 -0
- package/lib/xvideos.spec.js +22 -0
- package/package.json +44 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
const base = require('../../base');
|
2
|
+
const parseResponse = require('./parseResponse');
|
3
|
+
|
4
|
+
const PATH = '/verified/videos';
|
5
|
+
|
6
|
+
const verified = async ({ page = 1 } = {}) => {
|
7
|
+
if (page < 1 || page > Number.MAX_SAFE_INTEGER) {
|
8
|
+
throw new Error(`Invalid page: ${page}`);
|
9
|
+
}
|
10
|
+
const request = base.createRequest();
|
11
|
+
return parseResponse(page, await request.get(`${PATH}/${page === 0 ? '' : page}`));
|
12
|
+
};
|
13
|
+
|
14
|
+
module.exports = verified;
|
@@ -0,0 +1,138 @@
|
|
1
|
+
/* eslint-disable padded-blocks */
|
2
|
+
|
3
|
+
const chai = require('chai');
|
4
|
+
const verified = require('./verified');
|
5
|
+
|
6
|
+
before(() => {
|
7
|
+
chai.should();
|
8
|
+
});
|
9
|
+
|
10
|
+
describe('api/videos/verified', () => {
|
11
|
+
|
12
|
+
it('should list verified video pages', async () => {
|
13
|
+
const list = await verified({ page: 2 });
|
14
|
+
|
15
|
+
list.should.be.an('object');
|
16
|
+
list.pagination.should.be.an('object');
|
17
|
+
list.pagination.page.should.be.equals(2);
|
18
|
+
list.pagination.pages.should.be.an('array');
|
19
|
+
list.pagination.pages[0].should.be.a('number');
|
20
|
+
list.hasNext.should.be.a('function');
|
21
|
+
list.hasNext().should.be.equals(true);
|
22
|
+
list.hasPrevious.should.be.a('function');
|
23
|
+
list.hasPrevious().should.be.equals(true);
|
24
|
+
list.next.should.be.a('function');
|
25
|
+
list.previous.should.be.a('function');
|
26
|
+
list.videos.should.be.an('array');
|
27
|
+
list.videos.forEach((video) => {
|
28
|
+
video.should.be.an('object');
|
29
|
+
video.should.have.ownPropertyDescriptor('duration');
|
30
|
+
video.duration.should.be.a('string');
|
31
|
+
video.should.have.ownPropertyDescriptor('path');
|
32
|
+
video.path.should.be.a('string');
|
33
|
+
video.should.have.ownPropertyDescriptor('profile');
|
34
|
+
video.profile.should.be.an('object');
|
35
|
+
video.profile.should.have.ownPropertyDescriptor('name');
|
36
|
+
video.profile.name.should.be.an('string');
|
37
|
+
video.profile.should.have.ownPropertyDescriptor('url');
|
38
|
+
video.profile.url.should.be.an('string');
|
39
|
+
video.should.have.ownPropertyDescriptor('title');
|
40
|
+
video.title.should.be.a('string');
|
41
|
+
video.should.have.ownPropertyDescriptor('url');
|
42
|
+
video.url.should.be.a('string');
|
43
|
+
video.should.have.ownPropertyDescriptor('views');
|
44
|
+
video.views.should.be.a('string');
|
45
|
+
});
|
46
|
+
|
47
|
+
const previous = await list.previous();
|
48
|
+
previous.should.be.an('object');
|
49
|
+
previous.pagination.should.be.an('object');
|
50
|
+
previous.pagination.page.should.be.equals(1);
|
51
|
+
previous.pagination.pages.should.be.an('array');
|
52
|
+
previous.pagination.pages[0].should.be.a('number');
|
53
|
+
previous.hasNext.should.be.a('function');
|
54
|
+
previous.hasNext().should.be.equals(true);
|
55
|
+
previous.hasPrevious.should.be.a('function');
|
56
|
+
previous.hasPrevious().should.be.equals(false);
|
57
|
+
previous.next.should.be.a('function');
|
58
|
+
previous.previous.should.be.a('function');
|
59
|
+
previous.videos.should.be.an('array');
|
60
|
+
previous.videos.forEach((video) => {
|
61
|
+
video.should.be.an('object');
|
62
|
+
video.should.have.ownPropertyDescriptor('duration');
|
63
|
+
video.duration.should.be.a('string');
|
64
|
+
video.should.have.ownPropertyDescriptor('path');
|
65
|
+
video.path.should.be.a('string');
|
66
|
+
video.should.have.ownPropertyDescriptor('profile');
|
67
|
+
video.profile.should.be.an('object');
|
68
|
+
video.profile.should.have.ownPropertyDescriptor('name');
|
69
|
+
video.profile.name.should.be.an('string');
|
70
|
+
video.profile.should.have.ownPropertyDescriptor('url');
|
71
|
+
video.profile.url.should.be.an('string');
|
72
|
+
video.should.have.ownPropertyDescriptor('title');
|
73
|
+
video.title.should.be.a('string');
|
74
|
+
video.should.have.ownPropertyDescriptor('url');
|
75
|
+
video.url.should.be.a('string');
|
76
|
+
video.should.have.ownPropertyDescriptor('views');
|
77
|
+
video.views.should.be.a('string');
|
78
|
+
});
|
79
|
+
|
80
|
+
const next = await list.next();
|
81
|
+
next.should.be.an('object');
|
82
|
+
next.pagination.should.be.an('object');
|
83
|
+
next.pagination.page.should.be.equals(3);
|
84
|
+
next.pagination.pages.should.be.an('array');
|
85
|
+
next.pagination.pages[0].should.be.a('number');
|
86
|
+
next.hasNext.should.be.a('function');
|
87
|
+
next.hasNext().should.be.equals(true);
|
88
|
+
next.hasPrevious.should.be.a('function');
|
89
|
+
next.hasPrevious().should.be.equals(true);
|
90
|
+
next.next.should.be.a('function');
|
91
|
+
next.previous.should.be.a('function');
|
92
|
+
next.videos.should.be.an('array');
|
93
|
+
next.videos.forEach((video) => {
|
94
|
+
video.should.be.an('object');
|
95
|
+
video.should.have.ownPropertyDescriptor('duration');
|
96
|
+
video.duration.should.be.a('string');
|
97
|
+
video.should.have.ownPropertyDescriptor('path');
|
98
|
+
video.path.should.be.a('string');
|
99
|
+
video.should.have.ownPropertyDescriptor('profile');
|
100
|
+
video.profile.should.be.an('object');
|
101
|
+
video.profile.should.have.ownPropertyDescriptor('name');
|
102
|
+
video.profile.name.should.be.an('string');
|
103
|
+
video.profile.should.have.ownPropertyDescriptor('url');
|
104
|
+
video.profile.url.should.be.an('string');
|
105
|
+
video.should.have.ownPropertyDescriptor('title');
|
106
|
+
video.title.should.be.a('string');
|
107
|
+
video.should.have.ownPropertyDescriptor('url');
|
108
|
+
video.url.should.be.a('string');
|
109
|
+
video.should.have.ownPropertyDescriptor('views');
|
110
|
+
video.views.should.be.a('string');
|
111
|
+
});
|
112
|
+
|
113
|
+
await list.refresh();
|
114
|
+
}).timeout(10000);
|
115
|
+
|
116
|
+
it('should fail when page parameter is beyond limit', async () => {
|
117
|
+
let err;
|
118
|
+
try {
|
119
|
+
await verified({ page: Number.MAX_SAFE_INTEGER + 1 });
|
120
|
+
} catch (error) {
|
121
|
+
err = error;
|
122
|
+
} finally {
|
123
|
+
err.should.be.an('error');
|
124
|
+
}
|
125
|
+
}).timeout(10000);
|
126
|
+
|
127
|
+
it('should fail when page parameter is less than 0', async () => {
|
128
|
+
let err;
|
129
|
+
try {
|
130
|
+
await verified({ page: -1 });
|
131
|
+
} catch (error) {
|
132
|
+
err = error;
|
133
|
+
} finally {
|
134
|
+
err.should.be.an('error');
|
135
|
+
}
|
136
|
+
}).timeout(10000);
|
137
|
+
|
138
|
+
});
|
package/lib/index.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
module.exports = require('./xvideos');
|
package/lib/xvideos.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
module.exports = require('./api');
|
@@ -0,0 +1,22 @@
|
|
1
|
+
/* eslint-disable padded-blocks */
|
2
|
+
|
3
|
+
const chai = require('chai');
|
4
|
+
const xvideos = require('.');
|
5
|
+
|
6
|
+
before(() => {
|
7
|
+
chai.should();
|
8
|
+
});
|
9
|
+
|
10
|
+
describe('xvideos', () => {
|
11
|
+
|
12
|
+
it('should have xvideos api functions', async () => {
|
13
|
+
xvideos.should.be.an('object');
|
14
|
+
xvideos.videos.should.be.an('object');
|
15
|
+
xvideos.videos.dashboard.should.be.a('function');
|
16
|
+
xvideos.videos.fresh.should.be.a('function');
|
17
|
+
xvideos.videos.best.should.be.a('function');
|
18
|
+
xvideos.videos.verified.should.be.a('function');
|
19
|
+
xvideos.videos.details.should.be.a('function');
|
20
|
+
}).timeout(10000);
|
21
|
+
|
22
|
+
});
|
package/package.json
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
{
|
2
|
+
"name": "xvideosx",
|
3
|
+
"description": "xvideos.com api implementation.",
|
4
|
+
"version": "1.4.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.10",
|
29
|
+
"puppeteer": "^8.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
|
+
}
|