xvideosx 1.6.0 → 1.6.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,6 +9,14 @@ const extractorUrl = (imageUrl) => {
9
9
  return newUrl;
10
10
  } return null;
11
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
+ };
12
20
 
13
21
  const parseVideo = ($, video) => {
14
22
  const $video = $(video);
@@ -19,7 +27,8 @@ const parseVideo = ($, video) => {
19
27
  const preview = extractorUrl(thumbNail);
20
28
  const duration = $video.find('p.metadata > span.bg > span.duration').text();
21
29
  const channel = $video.find('.metadata .name').text();
22
- const views = $video.find('.metadata > span > span:not(.duration) > span:not(.sprluous) ').text();
30
+ const viewsData = $video.find('p.metadata > span.bg > span:nth-child(2)').text().trim();
31
+ const views = viewsExtractor(viewsData);
23
32
 
24
33
  return {
25
34
  title,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "xvideosx",
3
3
  "description": "xvideos.com api implementation.",
4
- "version": "1.6.0",
4
+ "version": "1.6.1",
5
5
  "main": "index.js",
6
6
  "license": "BSD-3-Clause",
7
7
  "repository": {