xvideosx 1.6.2 → 1.6.4
Sign up to get free protection for your applications and to get access to all the features.
- package/AUTHORS +2 -2
- package/README.md +3 -2
- package/index.js +1 -1
- package/lib/api/base.js +14 -14
- package/lib/api/index.js +5 -5
- package/lib/api/videos/best/best.js +19 -19
- package/lib/api/videos/best/best.spec.js +138 -138
- package/lib/api/videos/best/createHasNextFunction.js +10 -10
- package/lib/api/videos/best/createHasPreviousFunction.js +10 -10
- package/lib/api/videos/best/createNextFunction.js +12 -12
- package/lib/api/videos/best/createPreviousFunction.js +12 -12
- package/lib/api/videos/best/createRefreshFunction.js +11 -11
- package/lib/api/videos/best/index.js +1 -1
- package/lib/api/videos/best/parseResponse.js +45 -45
- package/lib/api/videos/best/parseVideo.js +27 -27
- package/lib/api/videos/dashboard/createHasNextFunction.js +10 -10
- package/lib/api/videos/dashboard/createHasPreviousFunction.js +10 -10
- package/lib/api/videos/dashboard/createNextFunction.js +12 -12
- package/lib/api/videos/dashboard/createPreviousFunction.js +12 -12
- package/lib/api/videos/dashboard/createRefreshFunction.js +11 -11
- package/lib/api/videos/dashboard/dashboard.js +14 -14
- package/lib/api/videos/dashboard/dashboard.spec.js +138 -138
- package/lib/api/videos/dashboard/index.js +1 -1
- package/lib/api/videos/dashboard/parseResponse.js +45 -45
- package/lib/api/videos/dashboard/parseVideo.js +27 -27
- package/lib/api/videos/details/details.js +14 -14
- package/lib/api/videos/details/details.spec.js +49 -49
- package/lib/api/videos/details/index.js +1 -1
- package/lib/api/videos/details/parseCategory.js +9 -9
- package/lib/api/videos/details/parseModels.js +21 -21
- package/lib/api/videos/details/parseRelated.js +24 -24
- package/lib/api/videos/details/parseResponse.js +43 -43
- package/lib/api/videos/details/parseVideo.js +30 -30
- package/lib/api/videos/fresh/createHasNextFunction.js +10 -10
- package/lib/api/videos/fresh/createHasPreviousFunction.js +10 -10
- package/lib/api/videos/fresh/createNextFunction.js +12 -12
- package/lib/api/videos/fresh/createPreviousFunction.js +12 -12
- package/lib/api/videos/fresh/createRefreshFunction.js +11 -11
- package/lib/api/videos/fresh/fresh.js +14 -14
- package/lib/api/videos/fresh/fresh.spec.js +138 -138
- package/lib/api/videos/fresh/index.js +1 -1
- package/lib/api/videos/fresh/parseResponse.js +45 -45
- package/lib/api/videos/fresh/parseVideo.js +27 -27
- package/lib/api/videos/index.js +9 -9
- package/lib/api/videos/newfresh/createHasNextFunction.js +10 -10
- package/lib/api/videos/newfresh/createHasPreviousFunction.js +10 -10
- package/lib/api/videos/newfresh/createNextFunction.js +12 -12
- package/lib/api/videos/newfresh/createPreviousFunction.js +12 -12
- package/lib/api/videos/newfresh/createRefreshFunction.js +11 -11
- package/lib/api/videos/newfresh/newfresh.js +20 -20
- package/lib/api/videos/newfresh/parseResponse.js +47 -47
- package/lib/api/videos/newfresh/parseVideo.js +45 -45
- package/lib/api/videos/search/createHasNextFunction.js +10 -10
- package/lib/api/videos/search/createHasPreviousFunction.js +10 -10
- package/lib/api/videos/search/createNextFunction.js +12 -12
- package/lib/api/videos/search/createPreviousFunction.js +12 -12
- package/lib/api/videos/search/createRefreshFunction.js +11 -11
- package/lib/api/videos/search/index.js +1 -1
- package/lib/api/videos/search/parseResponse.js +45 -45
- package/lib/api/videos/search/parseVideo.js +27 -27
- package/lib/api/videos/search/search.js +23 -23
- package/lib/api/videos/search/search.spec.js +138 -138
- package/lib/api/videos/verified/createHasNextFunction.js +10 -10
- package/lib/api/videos/verified/createHasPreviousFunction.js +10 -10
- package/lib/api/videos/verified/createNextFunction.js +12 -12
- package/lib/api/videos/verified/createPreviousFunction.js +12 -12
- package/lib/api/videos/verified/createRefreshFunction.js +11 -11
- package/lib/api/videos/verified/index.js +1 -1
- package/lib/api/videos/verified/parseResponse.js +45 -45
- package/lib/api/videos/verified/parseVideo.js +27 -27
- package/lib/api/videos/verified/verified.js +14 -14
- package/lib/api/videos/verified/verified.spec.js +138 -138
- package/lib/index.js +1 -1
- package/lib/xvideos.js +1 -1
- package/lib/xvideos.spec.js +19 -19
- package/package.json +1 -1
@@ -1,49 +1,49 @@
|
|
1
|
-
/* eslint-disable padded-blocks */
|
2
|
-
|
3
|
-
const chai = require('chai');
|
4
|
-
const details = require('./details');
|
5
|
-
const dashboard = require('../dashboard');
|
6
|
-
|
7
|
-
before(() => {
|
8
|
-
chai.should();
|
9
|
-
});
|
10
|
-
|
11
|
-
describe('api/videos/details', () => {
|
12
|
-
|
13
|
-
it('should retrieve video details', async () => {
|
14
|
-
const { videos } = await dashboard();
|
15
|
-
|
16
|
-
const video = await details(videos[0]);
|
17
|
-
|
18
|
-
video.should.be.an('object');
|
19
|
-
video.should.have.ownPropertyDescriptor('duration');
|
20
|
-
video.duration.should.be.a('string');
|
21
|
-
video.should.have.ownPropertyDescriptor('files');
|
22
|
-
video.files.should.be.an('object');
|
23
|
-
video.files.should.have.ownPropertyDescriptor('HLS');
|
24
|
-
video.files.HLS.should.be.a('string');
|
25
|
-
video.files.should.have.ownPropertyDescriptor('high');
|
26
|
-
video.files.high.should.be.a('string');
|
27
|
-
video.files.should.have.ownPropertyDescriptor('low');
|
28
|
-
video.files.low.should.be.a('string');
|
29
|
-
video.files.should.have.ownPropertyDescriptor('thumb');
|
30
|
-
video.files.thumb.should.be.a('string');
|
31
|
-
video.files.should.have.ownPropertyDescriptor('thumb69');
|
32
|
-
video.files.thumb69.should.be.a('string');
|
33
|
-
video.files.should.have.ownPropertyDescriptor('thumbSlide');
|
34
|
-
video.files.thumbSlide.should.be.a('string');
|
35
|
-
video.files.should.have.ownPropertyDescriptor('thumbSlideBig');
|
36
|
-
video.files.thumbSlideBig.should.be.a('string');
|
37
|
-
video.should.have.ownPropertyDescriptor('image');
|
38
|
-
video.image.should.be.a('string');
|
39
|
-
video.should.have.ownPropertyDescriptor('videoHeight');
|
40
|
-
video.videoHeight.should.be.a('string');
|
41
|
-
video.should.have.ownPropertyDescriptor('videoType');
|
42
|
-
video.videoType.should.be.a('string');
|
43
|
-
video.should.have.ownPropertyDescriptor('videoWidth');
|
44
|
-
video.videoWidth.should.be.a('string');
|
45
|
-
video.should.have.ownPropertyDescriptor('views');
|
46
|
-
video.views.should.be.a('string');
|
47
|
-
}).timeout(100000);
|
48
|
-
|
49
|
-
});
|
1
|
+
/* eslint-disable padded-blocks */
|
2
|
+
|
3
|
+
const chai = require('chai');
|
4
|
+
const details = require('./details');
|
5
|
+
const dashboard = require('../dashboard');
|
6
|
+
|
7
|
+
before(() => {
|
8
|
+
chai.should();
|
9
|
+
});
|
10
|
+
|
11
|
+
describe('api/videos/details', () => {
|
12
|
+
|
13
|
+
it('should retrieve video details', async () => {
|
14
|
+
const { videos } = await dashboard();
|
15
|
+
|
16
|
+
const video = await details(videos[0]);
|
17
|
+
|
18
|
+
video.should.be.an('object');
|
19
|
+
video.should.have.ownPropertyDescriptor('duration');
|
20
|
+
video.duration.should.be.a('string');
|
21
|
+
video.should.have.ownPropertyDescriptor('files');
|
22
|
+
video.files.should.be.an('object');
|
23
|
+
video.files.should.have.ownPropertyDescriptor('HLS');
|
24
|
+
video.files.HLS.should.be.a('string');
|
25
|
+
video.files.should.have.ownPropertyDescriptor('high');
|
26
|
+
video.files.high.should.be.a('string');
|
27
|
+
video.files.should.have.ownPropertyDescriptor('low');
|
28
|
+
video.files.low.should.be.a('string');
|
29
|
+
video.files.should.have.ownPropertyDescriptor('thumb');
|
30
|
+
video.files.thumb.should.be.a('string');
|
31
|
+
video.files.should.have.ownPropertyDescriptor('thumb69');
|
32
|
+
video.files.thumb69.should.be.a('string');
|
33
|
+
video.files.should.have.ownPropertyDescriptor('thumbSlide');
|
34
|
+
video.files.thumbSlide.should.be.a('string');
|
35
|
+
video.files.should.have.ownPropertyDescriptor('thumbSlideBig');
|
36
|
+
video.files.thumbSlideBig.should.be.a('string');
|
37
|
+
video.should.have.ownPropertyDescriptor('image');
|
38
|
+
video.image.should.be.a('string');
|
39
|
+
video.should.have.ownPropertyDescriptor('videoHeight');
|
40
|
+
video.videoHeight.should.be.a('string');
|
41
|
+
video.should.have.ownPropertyDescriptor('videoType');
|
42
|
+
video.videoType.should.be.a('string');
|
43
|
+
video.should.have.ownPropertyDescriptor('videoWidth');
|
44
|
+
video.videoWidth.should.be.a('string');
|
45
|
+
video.should.have.ownPropertyDescriptor('views');
|
46
|
+
video.views.should.be.a('string');
|
47
|
+
}).timeout(100000);
|
48
|
+
|
49
|
+
});
|
@@ -1 +1 @@
|
|
1
|
-
module.exports = require('./details');
|
1
|
+
module.exports = require('./details');
|
@@ -1,10 +1,10 @@
|
|
1
|
-
const parseCategory = ($) => {
|
2
|
-
const metadata = $('.video-metadata .is-keyword');
|
3
|
-
const keywordTexts = metadata.map((index, element) => {
|
4
|
-
return $(element).text();
|
5
|
-
}).get();
|
6
|
-
|
7
|
-
return keywordTexts;
|
8
|
-
|
9
|
-
}
|
1
|
+
const parseCategory = ($) => {
|
2
|
+
const metadata = $('.video-metadata .is-keyword');
|
3
|
+
const keywordTexts = metadata.map((index, element) => {
|
4
|
+
return $(element).text();
|
5
|
+
}).get();
|
6
|
+
|
7
|
+
return keywordTexts;
|
8
|
+
|
9
|
+
}
|
10
10
|
module.exports = parseCategory
|
@@ -1,22 +1,22 @@
|
|
1
|
-
const parseModels = ($) => {
|
2
|
-
const $metadata = $('.video-metadata');
|
3
|
-
|
4
|
-
const mainUploader = $metadata.find('li.main-uploader a span.name').text();
|
5
|
-
const mainUploaderCount = $metadata.find('li.main-uploader a span.count').text();
|
6
|
-
|
7
|
-
const models = $metadata.find('li.model a span.name').map((index, element) => $(element).text()).get();
|
8
|
-
const modelsCounts = $metadata.find('li.model a span.count').map((index, element) => $(element).text()).get();
|
9
|
-
|
10
|
-
return {
|
11
|
-
mainUploader: {
|
12
|
-
name: mainUploader,
|
13
|
-
count: mainUploaderCount
|
14
|
-
},
|
15
|
-
models: models.map((name, index) => ({
|
16
|
-
name,
|
17
|
-
count: modelsCounts[index]
|
18
|
-
})),
|
19
|
-
};
|
20
|
-
}
|
21
|
-
|
1
|
+
const parseModels = ($) => {
|
2
|
+
const $metadata = $('.video-metadata');
|
3
|
+
|
4
|
+
const mainUploader = $metadata.find('li.main-uploader a span.name').text();
|
5
|
+
const mainUploaderCount = $metadata.find('li.main-uploader a span.count').text();
|
6
|
+
|
7
|
+
const models = $metadata.find('li.model a span.name').map((index, element) => $(element).text()).get();
|
8
|
+
const modelsCounts = $metadata.find('li.model a span.count').map((index, element) => $(element).text()).get();
|
9
|
+
|
10
|
+
return {
|
11
|
+
mainUploader: {
|
12
|
+
name: mainUploader,
|
13
|
+
count: mainUploaderCount
|
14
|
+
},
|
15
|
+
models: models.map((name, index) => ({
|
16
|
+
name,
|
17
|
+
count: modelsCounts[index]
|
18
|
+
})),
|
19
|
+
};
|
20
|
+
}
|
21
|
+
|
22
22
|
module.exports = parseModels
|
@@ -1,25 +1,25 @@
|
|
1
|
-
const fs = require('fs')
|
2
|
-
|
3
|
-
const parseRelated = ($) =>{
|
4
|
-
const scriptContent = $('#video-player-bg script').html();
|
5
|
-
const startIndex = scriptContent.indexOf('[');
|
6
|
-
const endIndex = scriptContent.lastIndexOf(']');
|
7
|
-
const jsonContent = scriptContent.substring(startIndex, endIndex + 1);
|
8
|
-
|
9
|
-
const videoRelated = JSON.parse(jsonContent);
|
10
|
-
|
11
|
-
return videoRelated.map(video => {
|
12
|
-
return {
|
13
|
-
title: video.tf,
|
14
|
-
short_title: video.t,
|
15
|
-
duration : video.d,
|
16
|
-
channel: video.pn,
|
17
|
-
thumbNail: video.i,
|
18
|
-
poster: video.ip,
|
19
|
-
url: video.u,
|
20
|
-
views: video.n,
|
21
|
-
}
|
22
|
-
})
|
23
|
-
}
|
24
|
-
|
1
|
+
const fs = require('fs')
|
2
|
+
|
3
|
+
const parseRelated = ($) =>{
|
4
|
+
const scriptContent = $('#video-player-bg script').html();
|
5
|
+
const startIndex = scriptContent.indexOf('[');
|
6
|
+
const endIndex = scriptContent.lastIndexOf(']');
|
7
|
+
const jsonContent = scriptContent.substring(startIndex, endIndex + 1);
|
8
|
+
|
9
|
+
const videoRelated = JSON.parse(jsonContent);
|
10
|
+
|
11
|
+
return videoRelated.map(video => {
|
12
|
+
return {
|
13
|
+
title: video.tf,
|
14
|
+
short_title: video.t,
|
15
|
+
duration : video.d,
|
16
|
+
channel: video.pn,
|
17
|
+
thumbNail: video.i,
|
18
|
+
poster: video.ip,
|
19
|
+
url: video.u,
|
20
|
+
views: video.n,
|
21
|
+
}
|
22
|
+
})
|
23
|
+
}
|
24
|
+
|
25
25
|
module.exports = parseRelated
|
@@ -1,44 +1,44 @@
|
|
1
|
-
const cheerio = require('cheerio');
|
2
|
-
const parseVideo = require('./parseVideo');
|
3
|
-
const parseRelated = require('./parseRelated');
|
4
|
-
const parseCategory = require('./parseCategory');
|
5
|
-
const parseModels = require('./parseModels');
|
6
|
-
|
7
|
-
|
8
|
-
const getVideo = ($) =>{
|
9
|
-
return parseVideo($);
|
10
|
-
}
|
11
|
-
const getRelated = ($) => {
|
12
|
-
return parseRelated($);
|
13
|
-
}
|
14
|
-
const getCategories = ($) =>{
|
15
|
-
return parseCategory($);
|
16
|
-
}
|
17
|
-
const getModels = ($) =>{
|
18
|
-
return parseModels($);
|
19
|
-
}
|
20
|
-
const parseResponse = ({ data }) => {
|
21
|
-
const $ = cheerio.load(data);
|
22
|
-
const video = getVideo($);
|
23
|
-
const related = getRelated($);
|
24
|
-
const categories = getCategories($);
|
25
|
-
const models = getModels($);
|
26
|
-
|
27
|
-
|
28
|
-
return{
|
29
|
-
title: video.title,
|
30
|
-
duration: video.duration,
|
31
|
-
image: video.image,
|
32
|
-
categories,
|
33
|
-
channel: models.mainUploader,
|
34
|
-
models: models.models,
|
35
|
-
videoType: video.videoType,
|
36
|
-
videoWidth: video.videoWidth,
|
37
|
-
videoHeight: video.videoHeight,
|
38
|
-
views: video.views,
|
39
|
-
files: video.files,
|
40
|
-
videos: related
|
41
|
-
}
|
42
|
-
}
|
43
|
-
|
1
|
+
const cheerio = require('cheerio');
|
2
|
+
const parseVideo = require('./parseVideo');
|
3
|
+
const parseRelated = require('./parseRelated');
|
4
|
+
const parseCategory = require('./parseCategory');
|
5
|
+
const parseModels = require('./parseModels');
|
6
|
+
|
7
|
+
|
8
|
+
const getVideo = ($) =>{
|
9
|
+
return parseVideo($);
|
10
|
+
}
|
11
|
+
const getRelated = ($) => {
|
12
|
+
return parseRelated($);
|
13
|
+
}
|
14
|
+
const getCategories = ($) =>{
|
15
|
+
return parseCategory($);
|
16
|
+
}
|
17
|
+
const getModels = ($) =>{
|
18
|
+
return parseModels($);
|
19
|
+
}
|
20
|
+
const parseResponse = ({ data }) => {
|
21
|
+
const $ = cheerio.load(data);
|
22
|
+
const video = getVideo($);
|
23
|
+
const related = getRelated($);
|
24
|
+
const categories = getCategories($);
|
25
|
+
const models = getModels($);
|
26
|
+
|
27
|
+
|
28
|
+
return{
|
29
|
+
title: video.title,
|
30
|
+
duration: video.duration,
|
31
|
+
image: video.image,
|
32
|
+
categories,
|
33
|
+
channel: models.mainUploader,
|
34
|
+
models: models.models,
|
35
|
+
videoType: video.videoType,
|
36
|
+
videoWidth: video.videoWidth,
|
37
|
+
videoHeight: video.videoHeight,
|
38
|
+
views: video.views,
|
39
|
+
files: video.files,
|
40
|
+
videos: related
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
44
|
module.exports = parseResponse
|
@@ -1,31 +1,31 @@
|
|
1
|
-
const parseVideo = ($) => {
|
2
|
-
const title = $('meta[property="og:title"]').attr('content');
|
3
|
-
const duration = $('meta[property="og:duration"]').attr('content');
|
4
|
-
const image = $('meta[property="og:image"]').attr('content');
|
5
|
-
const videoType = $('meta[property="og:video:type"]').attr('content');
|
6
|
-
const videoWidth = $('meta[property="og:video:width"]').attr('content');
|
7
|
-
const videoHeight = $('meta[property="og:video:height"]').attr('content');
|
8
|
-
const views = $('.mobile-show-inline:nth-child(3)').text();
|
9
|
-
const videoScript = $('#video-player-bg > script:nth-child(6)').html();
|
10
|
-
const files = {
|
11
|
-
low: (videoScript.match('html5player.setVideoUrlLow\\(\'(.*?)\'\\);') || [])[1],
|
12
|
-
high: videoScript.match('html5player.setVideoUrlHigh\\(\'(.*?)\'\\);' || [])[1],
|
13
|
-
HLS: videoScript.match('html5player.setVideoHLS\\(\'(.*?)\'\\);' || [])[1],
|
14
|
-
thumb: videoScript.match('html5player.setThumbUrl\\(\'(.*?)\'\\);' || [])[1],
|
15
|
-
thumb69: videoScript.match('html5player.setThumbUrl169\\(\'(.*?)\'\\);' || [])[1],
|
16
|
-
thumbSlide: videoScript.match('html5player.setThumbSlide\\(\'(.*?)\'\\);' || [])[1],
|
17
|
-
thumbSlideBig: videoScript.match('html5player.setThumbSlideBig\\(\'(.*?)\'\\);' || [])[1],
|
18
|
-
};
|
19
|
-
return {
|
20
|
-
title,
|
21
|
-
duration,
|
22
|
-
image,
|
23
|
-
videoType,
|
24
|
-
videoWidth,
|
25
|
-
videoHeight,
|
26
|
-
views,
|
27
|
-
files,
|
28
|
-
}
|
29
|
-
}
|
30
|
-
|
1
|
+
const parseVideo = ($) => {
|
2
|
+
const title = $('meta[property="og:title"]').attr('content');
|
3
|
+
const duration = $('meta[property="og:duration"]').attr('content');
|
4
|
+
const image = $('meta[property="og:image"]').attr('content');
|
5
|
+
const videoType = $('meta[property="og:video:type"]').attr('content');
|
6
|
+
const videoWidth = $('meta[property="og:video:width"]').attr('content');
|
7
|
+
const videoHeight = $('meta[property="og:video:height"]').attr('content');
|
8
|
+
const views = $('.mobile-show-inline:nth-child(3)').text();
|
9
|
+
const videoScript = $('#video-player-bg > script:nth-child(6)').html();
|
10
|
+
const files = {
|
11
|
+
low: (videoScript.match('html5player.setVideoUrlLow\\(\'(.*?)\'\\);') || [])[1],
|
12
|
+
high: videoScript.match('html5player.setVideoUrlHigh\\(\'(.*?)\'\\);' || [])[1],
|
13
|
+
HLS: videoScript.match('html5player.setVideoHLS\\(\'(.*?)\'\\);' || [])[1],
|
14
|
+
thumb: videoScript.match('html5player.setThumbUrl\\(\'(.*?)\'\\);' || [])[1],
|
15
|
+
thumb69: videoScript.match('html5player.setThumbUrl169\\(\'(.*?)\'\\);' || [])[1],
|
16
|
+
thumbSlide: videoScript.match('html5player.setThumbSlide\\(\'(.*?)\'\\);' || [])[1],
|
17
|
+
thumbSlideBig: videoScript.match('html5player.setThumbSlideBig\\(\'(.*?)\'\\);' || [])[1],
|
18
|
+
};
|
19
|
+
return {
|
20
|
+
title,
|
21
|
+
duration,
|
22
|
+
image,
|
23
|
+
videoType,
|
24
|
+
videoWidth,
|
25
|
+
videoHeight,
|
26
|
+
views,
|
27
|
+
files,
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
31
|
module.exports = parseVideo
|
@@ -1,10 +1,10 @@
|
|
1
|
-
const hasNextFunction = (currentPage, pages) => () => {
|
2
|
-
return currentPage < Math.max(...pages);
|
3
|
-
};
|
4
|
-
|
5
|
-
const createHasNextFunction = (pagination) => {
|
6
|
-
const { page, pages } = pagination;
|
7
|
-
return hasNextFunction(page, pages);
|
8
|
-
};
|
9
|
-
|
10
|
-
module.exports = createHasNextFunction;
|
1
|
+
const hasNextFunction = (currentPage, pages) => () => {
|
2
|
+
return currentPage < Math.max(...pages);
|
3
|
+
};
|
4
|
+
|
5
|
+
const createHasNextFunction = (pagination) => {
|
6
|
+
const { page, pages } = pagination;
|
7
|
+
return hasNextFunction(page, pages);
|
8
|
+
};
|
9
|
+
|
10
|
+
module.exports = createHasNextFunction;
|
@@ -1,10 +1,10 @@
|
|
1
|
-
const hasPreviousFunction = (currentPage, pages) => () => {
|
2
|
-
return currentPage > Math.min(...pages);
|
3
|
-
};
|
4
|
-
|
5
|
-
const createHasPreviousFunction = (pagination) => {
|
6
|
-
const { page, pages } = pagination;
|
7
|
-
return hasPreviousFunction(page, pages);
|
8
|
-
};
|
9
|
-
|
10
|
-
module.exports = createHasPreviousFunction;
|
1
|
+
const hasPreviousFunction = (currentPage, pages) => () => {
|
2
|
+
return currentPage > Math.min(...pages);
|
3
|
+
};
|
4
|
+
|
5
|
+
const createHasPreviousFunction = (pagination) => {
|
6
|
+
const { page, pages } = pagination;
|
7
|
+
return hasPreviousFunction(page, pages);
|
8
|
+
};
|
9
|
+
|
10
|
+
module.exports = createHasPreviousFunction;
|
@@ -1,12 +1,12 @@
|
|
1
|
-
const nextFunction = (currentPage) => () => {
|
2
|
-
const fresh = require('./fresh');
|
3
|
-
const next = currentPage + 1;
|
4
|
-
return fresh({ page: next });
|
5
|
-
};
|
6
|
-
|
7
|
-
const createNextFunction = (pagination) => {
|
8
|
-
const { page } = pagination;
|
9
|
-
return nextFunction(page);
|
10
|
-
};
|
11
|
-
|
12
|
-
module.exports = createNextFunction;
|
1
|
+
const nextFunction = (currentPage) => () => {
|
2
|
+
const fresh = require('./fresh');
|
3
|
+
const next = currentPage + 1;
|
4
|
+
return fresh({ page: next });
|
5
|
+
};
|
6
|
+
|
7
|
+
const createNextFunction = (pagination) => {
|
8
|
+
const { page } = pagination;
|
9
|
+
return nextFunction(page);
|
10
|
+
};
|
11
|
+
|
12
|
+
module.exports = createNextFunction;
|
@@ -1,12 +1,12 @@
|
|
1
|
-
const previousFunction = (currentPage) => () => {
|
2
|
-
const fresh = require('./fresh');
|
3
|
-
const previous = currentPage - 1;
|
4
|
-
return fresh({ page: previous });
|
5
|
-
};
|
6
|
-
|
7
|
-
const createPreviousFunction = (pagination) => {
|
8
|
-
const { page } = pagination;
|
9
|
-
return previousFunction(page);
|
10
|
-
};
|
11
|
-
|
12
|
-
module.exports = createPreviousFunction;
|
1
|
+
const previousFunction = (currentPage) => () => {
|
2
|
+
const fresh = require('./fresh');
|
3
|
+
const previous = currentPage - 1;
|
4
|
+
return fresh({ page: previous });
|
5
|
+
};
|
6
|
+
|
7
|
+
const createPreviousFunction = (pagination) => {
|
8
|
+
const { page } = pagination;
|
9
|
+
return previousFunction(page);
|
10
|
+
};
|
11
|
+
|
12
|
+
module.exports = createPreviousFunction;
|
@@ -1,11 +1,11 @@
|
|
1
|
-
const refreshFunction = (currentPage) => () => {
|
2
|
-
const fresh = require('./fresh');
|
3
|
-
return fresh(currentPage);
|
4
|
-
};
|
5
|
-
|
6
|
-
const createRefreshFunction = (pagination) => {
|
7
|
-
const { page } = pagination;
|
8
|
-
return refreshFunction(page);
|
9
|
-
};
|
10
|
-
|
11
|
-
module.exports = createRefreshFunction;
|
1
|
+
const refreshFunction = (currentPage) => () => {
|
2
|
+
const fresh = require('./fresh');
|
3
|
+
return fresh(currentPage);
|
4
|
+
};
|
5
|
+
|
6
|
+
const createRefreshFunction = (pagination) => {
|
7
|
+
const { page } = pagination;
|
8
|
+
return refreshFunction(page);
|
9
|
+
};
|
10
|
+
|
11
|
+
module.exports = createRefreshFunction;
|
@@ -1,14 +1,14 @@
|
|
1
|
-
const base = require('../../base');
|
2
|
-
const parseResponse = require('./parseResponse');
|
3
|
-
|
4
|
-
const PATH = '/new';
|
5
|
-
|
6
|
-
const fresh = 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}`));
|
12
|
-
};
|
13
|
-
|
14
|
-
module.exports = fresh;
|
1
|
+
const base = require('../../base');
|
2
|
+
const parseResponse = require('./parseResponse');
|
3
|
+
|
4
|
+
const PATH = '/new';
|
5
|
+
|
6
|
+
const fresh = 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}`));
|
12
|
+
};
|
13
|
+
|
14
|
+
module.exports = fresh;
|