xvideosx 1.6.3 → 1.6.4
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/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,47 +1,47 @@
|
|
1
|
-
const cheerio = require('cheerio');
|
2
|
-
const parseVideo = require('./parseVideo');
|
3
|
-
const createRefreshFunction = require('./createRefreshFunction');
|
4
|
-
const createHasNextFunction = require('./createHasNextFunction');
|
5
|
-
const createNextFunction = require('./createNextFunction');
|
6
|
-
const createHasPreviousFunction = require('./createHasPreviousFunction');
|
7
|
-
const createPreviousFunction = require('./createPreviousFunction');
|
8
|
-
|
9
|
-
const getVideos = ($) => {
|
10
|
-
return $('.thumb-block')
|
11
|
-
.map((i, video) => {
|
12
|
-
return parseVideo($, video);
|
13
|
-
})
|
14
|
-
.get();
|
15
|
-
};
|
16
|
-
|
17
|
-
const getPages = ($) => {
|
18
|
-
return $('.pagination > ul > li > a')
|
19
|
-
.map((i, page) => $(page)
|
20
|
-
.text())
|
21
|
-
.filter((i, page) => !isNaN(page))
|
22
|
-
.map((i, page) => Number(page) - 1)
|
23
|
-
.get();
|
24
|
-
};
|
25
|
-
|
26
|
-
const parseResponse = (page, { data }) => {
|
27
|
-
const $ = cheerio.load(data);
|
28
|
-
|
29
|
-
const videos = getVideos($);
|
30
|
-
|
31
|
-
const pagination = {
|
32
|
-
page,
|
33
|
-
pages: getPages($),
|
34
|
-
};
|
35
|
-
|
36
|
-
return {
|
37
|
-
videos,
|
38
|
-
pagination,
|
39
|
-
refresh: createRefreshFunction(pagination),
|
40
|
-
hasNext: createHasNextFunction(pagination),
|
41
|
-
next: createNextFunction(pagination),
|
42
|
-
hasPrevious: createHasPreviousFunction(pagination),
|
43
|
-
previous: createPreviousFunction(pagination),
|
44
|
-
};
|
45
|
-
};
|
46
|
-
|
47
|
-
module.exports = parseResponse;
|
1
|
+
const cheerio = require('cheerio');
|
2
|
+
const parseVideo = require('./parseVideo');
|
3
|
+
const createRefreshFunction = require('./createRefreshFunction');
|
4
|
+
const createHasNextFunction = require('./createHasNextFunction');
|
5
|
+
const createNextFunction = require('./createNextFunction');
|
6
|
+
const createHasPreviousFunction = require('./createHasPreviousFunction');
|
7
|
+
const createPreviousFunction = require('./createPreviousFunction');
|
8
|
+
|
9
|
+
const getVideos = ($) => {
|
10
|
+
return $('.thumb-block')
|
11
|
+
.map((i, video) => {
|
12
|
+
return parseVideo($, video);
|
13
|
+
})
|
14
|
+
.get();
|
15
|
+
};
|
16
|
+
|
17
|
+
const getPages = ($) => {
|
18
|
+
return $('.pagination > ul > li > a')
|
19
|
+
.map((i, page) => $(page)
|
20
|
+
.text())
|
21
|
+
.filter((i, page) => !isNaN(page))
|
22
|
+
.map((i, page) => Number(page) - 1)
|
23
|
+
.get();
|
24
|
+
};
|
25
|
+
|
26
|
+
const parseResponse = (page, { data }) => {
|
27
|
+
const $ = cheerio.load(data);
|
28
|
+
|
29
|
+
const videos = getVideos($);
|
30
|
+
|
31
|
+
const pagination = {
|
32
|
+
page,
|
33
|
+
pages: getPages($),
|
34
|
+
};
|
35
|
+
|
36
|
+
return {
|
37
|
+
videos,
|
38
|
+
pagination,
|
39
|
+
refresh: createRefreshFunction(pagination),
|
40
|
+
hasNext: createHasNextFunction(pagination),
|
41
|
+
next: createNextFunction(pagination),
|
42
|
+
hasPrevious: createHasPreviousFunction(pagination),
|
43
|
+
previous: createPreviousFunction(pagination),
|
44
|
+
};
|
45
|
+
};
|
46
|
+
|
47
|
+
module.exports = parseResponse;
|
@@ -1,45 +1,45 @@
|
|
1
|
-
const base = require('../../base');
|
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
|
-
const viewsExtractor = (views) => {
|
13
|
-
const regex = /(\d+(?:[,.]\d+)?[MK])/i;
|
14
|
-
const match = views.match(regex);
|
15
|
-
if (match && match[1]) {
|
16
|
-
const views = match[1];
|
17
|
-
return views;
|
18
|
-
} return null;
|
19
|
-
};
|
20
|
-
|
21
|
-
const parseVideo = ($, video) => {
|
22
|
-
const $video = $(video);
|
23
|
-
const title = $video.find('.title a').attr('title');
|
24
|
-
const path = $video.find('.thumb > a').attr('href');
|
25
|
-
const url = `${base.BASE_URL}${path}`;
|
26
|
-
const thumbNail = $video.find('div.thumb img').attr('data-src');
|
27
|
-
const preview = extractorUrl(thumbNail);
|
28
|
-
const duration = $video.find('p.metadata > span.bg > span.duration').text();
|
29
|
-
const channel = $video.find('.metadata .name').text();
|
30
|
-
const viewsData = $video.find('p.metadata > span.bg > span:nth-child(2)').text().trim();
|
31
|
-
const views = viewsExtractor(viewsData);
|
32
|
-
|
33
|
-
return {
|
34
|
-
title,
|
35
|
-
url,
|
36
|
-
thumbNail,
|
37
|
-
preview,
|
38
|
-
path,
|
39
|
-
duration,
|
40
|
-
channel,
|
41
|
-
views,
|
42
|
-
};
|
43
|
-
};
|
44
|
-
|
45
|
-
module.exports = parseVideo;
|
1
|
+
const base = require('../../base');
|
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
|
+
const viewsExtractor = (views) => {
|
13
|
+
const regex = /(\d+(?:[,.]\d+)?[MK])/i;
|
14
|
+
const match = views.match(regex);
|
15
|
+
if (match && match[1]) {
|
16
|
+
const views = match[1];
|
17
|
+
return views;
|
18
|
+
} return null;
|
19
|
+
};
|
20
|
+
|
21
|
+
const parseVideo = ($, video) => {
|
22
|
+
const $video = $(video);
|
23
|
+
const title = $video.find('.title a').attr('title');
|
24
|
+
const path = $video.find('.thumb > a').attr('href');
|
25
|
+
const url = `${base.BASE_URL}${path}`;
|
26
|
+
const thumbNail = $video.find('div.thumb img').attr('data-src');
|
27
|
+
const preview = extractorUrl(thumbNail);
|
28
|
+
const duration = $video.find('p.metadata > span.bg > span.duration').text();
|
29
|
+
const channel = $video.find('.metadata .name').text();
|
30
|
+
const viewsData = $video.find('p.metadata > span.bg > span:nth-child(2)').text().trim();
|
31
|
+
const views = viewsExtractor(viewsData);
|
32
|
+
|
33
|
+
return {
|
34
|
+
title,
|
35
|
+
url,
|
36
|
+
thumbNail,
|
37
|
+
preview,
|
38
|
+
path,
|
39
|
+
duration,
|
40
|
+
channel,
|
41
|
+
views,
|
42
|
+
};
|
43
|
+
};
|
44
|
+
|
45
|
+
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 search = require('./search');
|
3
|
-
const next = currentPage + 1;
|
4
|
-
return search({ 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 search = require('./search');
|
3
|
+
const next = currentPage + 1;
|
4
|
+
return search({ 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 search = require('./search');
|
3
|
-
const previous = currentPage - 1;
|
4
|
-
return search({ 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 search = require('./search');
|
3
|
+
const previous = currentPage - 1;
|
4
|
+
return search({ 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 search = require('./search');
|
3
|
-
return search(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 search = require('./search');
|
3
|
+
return search(currentPage);
|
4
|
+
};
|
5
|
+
|
6
|
+
const createRefreshFunction = (pagination) => {
|
7
|
+
const { page } = pagination;
|
8
|
+
return refreshFunction(page);
|
9
|
+
};
|
10
|
+
|
11
|
+
module.exports = createRefreshFunction;
|
@@ -1 +1 @@
|
|
1
|
-
module.exports = require('./search');
|
1
|
+
module.exports = require('./search');
|
@@ -1,45 +1,45 @@
|
|
1
|
-
const cheerio = require('cheerio');
|
2
|
-
const parseVideo = require('./parseVideo');
|
3
|
-
const createRefreshFunction = require('./createRefreshFunction');
|
4
|
-
const createHasNextFunction = require('./createHasNextFunction');
|
5
|
-
const createNextFunction = require('./createNextFunction');
|
6
|
-
const createHasPreviousFunction = require('./createHasPreviousFunction');
|
7
|
-
const createPreviousFunction = require('./createPreviousFunction');
|
8
|
-
|
9
|
-
const getVideos = ($) => {
|
10
|
-
return $('#content > .mozaique > .thumb-block')
|
11
|
-
.map((i, video) => parseVideo($, video))
|
12
|
-
.get();
|
13
|
-
};
|
14
|
-
|
15
|
-
const getPages = ($) => {
|
16
|
-
return $('.pagination > ul > li > a')
|
17
|
-
.map((i, page) => $(page)
|
18
|
-
.text())
|
19
|
-
.filter((i, page) => !isNaN(page))
|
20
|
-
.map((i, page) => Number(page))
|
21
|
-
.get();
|
22
|
-
};
|
23
|
-
|
24
|
-
const parseResponse = (page, { data }) => {
|
25
|
-
const $ = cheerio.load(data);
|
26
|
-
|
27
|
-
const videos = getVideos($);
|
28
|
-
|
29
|
-
const pagination = {
|
30
|
-
page,
|
31
|
-
pages: getPages($),
|
32
|
-
};
|
33
|
-
|
34
|
-
return {
|
35
|
-
videos,
|
36
|
-
pagination,
|
37
|
-
refresh: createRefreshFunction(pagination),
|
38
|
-
hasNext: createHasNextFunction(pagination),
|
39
|
-
next: createNextFunction(pagination),
|
40
|
-
hasPrevious: createHasPreviousFunction(pagination),
|
41
|
-
previous: createPreviousFunction(pagination),
|
42
|
-
};
|
43
|
-
};
|
44
|
-
|
45
|
-
module.exports = parseResponse;
|
1
|
+
const cheerio = require('cheerio');
|
2
|
+
const parseVideo = require('./parseVideo');
|
3
|
+
const createRefreshFunction = require('./createRefreshFunction');
|
4
|
+
const createHasNextFunction = require('./createHasNextFunction');
|
5
|
+
const createNextFunction = require('./createNextFunction');
|
6
|
+
const createHasPreviousFunction = require('./createHasPreviousFunction');
|
7
|
+
const createPreviousFunction = require('./createPreviousFunction');
|
8
|
+
|
9
|
+
const getVideos = ($) => {
|
10
|
+
return $('#content > .mozaique > .thumb-block')
|
11
|
+
.map((i, video) => parseVideo($, video))
|
12
|
+
.get();
|
13
|
+
};
|
14
|
+
|
15
|
+
const getPages = ($) => {
|
16
|
+
return $('.pagination > ul > li > a')
|
17
|
+
.map((i, page) => $(page)
|
18
|
+
.text())
|
19
|
+
.filter((i, page) => !isNaN(page))
|
20
|
+
.map((i, page) => Number(page))
|
21
|
+
.get();
|
22
|
+
};
|
23
|
+
|
24
|
+
const parseResponse = (page, { data }) => {
|
25
|
+
const $ = cheerio.load(data);
|
26
|
+
|
27
|
+
const videos = getVideos($);
|
28
|
+
|
29
|
+
const pagination = {
|
30
|
+
page,
|
31
|
+
pages: getPages($),
|
32
|
+
};
|
33
|
+
|
34
|
+
return {
|
35
|
+
videos,
|
36
|
+
pagination,
|
37
|
+
refresh: createRefreshFunction(pagination),
|
38
|
+
hasNext: createHasNextFunction(pagination),
|
39
|
+
next: createNextFunction(pagination),
|
40
|
+
hasPrevious: createHasPreviousFunction(pagination),
|
41
|
+
previous: createPreviousFunction(pagination),
|
42
|
+
};
|
43
|
+
};
|
44
|
+
|
45
|
+
module.exports = parseResponse;
|
@@ -1,27 +1,27 @@
|
|
1
|
-
const base = require('../../base');
|
2
|
-
|
3
|
-
const parseVideo = ($, video) => {
|
4
|
-
const $video = $(video);
|
5
|
-
|
6
|
-
const title = $video.find('p:not(.metadata) a').attr('title');
|
7
|
-
const path = $video.find('.thumb > a').attr('href');
|
8
|
-
const url = `${base.BASE_URL}${path}`;
|
9
|
-
const views = $video.find('p.metadata > span > span:not(.duration)').text();
|
10
|
-
const duration = $video.find('p.metadata > span.bg > span.duration').text();
|
11
|
-
const profileElement = $video.find('p.metadata > span > a');
|
12
|
-
const profile = {
|
13
|
-
name: profileElement.text(),
|
14
|
-
url: `${base.BASE_URL}${profileElement.attr('href')}`,
|
15
|
-
};
|
16
|
-
|
17
|
-
return {
|
18
|
-
url,
|
19
|
-
path,
|
20
|
-
title,
|
21
|
-
duration,
|
22
|
-
profile,
|
23
|
-
views,
|
24
|
-
};
|
25
|
-
};
|
26
|
-
|
27
|
-
module.exports = parseVideo;
|
1
|
+
const base = require('../../base');
|
2
|
+
|
3
|
+
const parseVideo = ($, video) => {
|
4
|
+
const $video = $(video);
|
5
|
+
|
6
|
+
const title = $video.find('p:not(.metadata) a').attr('title');
|
7
|
+
const path = $video.find('.thumb > a').attr('href');
|
8
|
+
const url = `${base.BASE_URL}${path}`;
|
9
|
+
const views = $video.find('p.metadata > span > span:not(.duration)').text();
|
10
|
+
const duration = $video.find('p.metadata > span.bg > span.duration').text();
|
11
|
+
const profileElement = $video.find('p.metadata > span > a');
|
12
|
+
const profile = {
|
13
|
+
name: profileElement.text(),
|
14
|
+
url: `${base.BASE_URL}${profileElement.attr('href')}`,
|
15
|
+
};
|
16
|
+
|
17
|
+
return {
|
18
|
+
url,
|
19
|
+
path,
|
20
|
+
title,
|
21
|
+
duration,
|
22
|
+
profile,
|
23
|
+
views,
|
24
|
+
};
|
25
|
+
};
|
26
|
+
|
27
|
+
module.exports = parseVideo;
|
@@ -1,23 +1,23 @@
|
|
1
|
-
const base = require('../../base');
|
2
|
-
const parseResponse = require('./parseResponse');
|
3
|
-
|
4
|
-
const search = async ({ page = 1, k = '' } = {}) => {
|
5
|
-
if (page < 1 || page > Number.MAX_SAFE_INTEGER) {
|
6
|
-
throw new Error(`Invalid page: ${page}`);
|
7
|
-
}
|
8
|
-
const request = base.createRequest();
|
9
|
-
|
10
|
-
let query = '?';
|
11
|
-
|
12
|
-
if (page !== 0) {
|
13
|
-
query += `p=${page}&`;
|
14
|
-
}
|
15
|
-
|
16
|
-
if (k !== '') {
|
17
|
-
query += `k=${k}`;
|
18
|
-
}
|
19
|
-
|
20
|
-
return parseResponse(page, await request.get(query));
|
21
|
-
};
|
22
|
-
|
23
|
-
module.exports = search;
|
1
|
+
const base = require('../../base');
|
2
|
+
const parseResponse = require('./parseResponse');
|
3
|
+
|
4
|
+
const search = async ({ page = 1, k = '' } = {}) => {
|
5
|
+
if (page < 1 || page > Number.MAX_SAFE_INTEGER) {
|
6
|
+
throw new Error(`Invalid page: ${page}`);
|
7
|
+
}
|
8
|
+
const request = base.createRequest();
|
9
|
+
|
10
|
+
let query = '?';
|
11
|
+
|
12
|
+
if (page !== 0) {
|
13
|
+
query += `p=${page}&`;
|
14
|
+
}
|
15
|
+
|
16
|
+
if (k !== '') {
|
17
|
+
query += `k=${k}`;
|
18
|
+
}
|
19
|
+
|
20
|
+
return parseResponse(page, await request.get(query));
|
21
|
+
};
|
22
|
+
|
23
|
+
module.exports = search;
|