xvideosx 1.5.0 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,5 @@
1
1
  /* eslint-disable linebreak-style */
2
2
  /* eslint-disable no-undef */
3
- const cheerio = require('cheerio');
4
3
  const puppeteer = require('puppeteer');
5
4
 
6
5
  const newFresh = async ({ url, puppeteerConfig } = {}) => {
@@ -15,18 +14,6 @@ const newFresh = async ({ url, puppeteerConfig } = {}) => {
15
14
  const titles = document.querySelectorAll('.title');
16
15
  const data = [];
17
16
  thumbs.forEach((thumb, index) => {
18
- const $ = cheerio.load(thumb);
19
- const videoScript = $('#video-player-bg > script:nth-child(6)').html();
20
- const files = {
21
- low: (videoScript.match('html5player.setVideoUrlLow\\(\'(.*?)\'\\);') || [])[1],
22
- high: videoScript.match('html5player.setVideoUrlHigh\\(\'(.*?)\'\\);' || [])[1],
23
- HLS: videoScript.match('html5player.setVideoHLS\\(\'(.*?)\'\\);' || [])[1],
24
- thumb: videoScript.match('html5player.setThumbUrl\\(\'(.*?)\'\\);' || [])[1],
25
- thumb69: videoScript.match('html5player.setThumbUrl169\\(\'(.*?)\'\\);' || [])[1],
26
- thumbSlide: videoScript.match('html5player.setThumbSlide\\(\'(.*?)\'\\);' || [])[1],
27
- thumbSlideBig: videoScript.match('html5player.setThumbSlideBig\\(\'(.*?)\'\\);' || [])[1],
28
- };
29
-
30
17
  const anchor = thumb.querySelector('a');
31
18
  const img = thumb.querySelector('img');
32
19
  const text = titles[index];
@@ -41,7 +28,7 @@ const newFresh = async ({ url, puppeteerConfig } = {}) => {
41
28
  thumb,
42
29
  title,
43
30
  url,
44
- files,
31
+
45
32
  });
46
33
  }
47
34
  });
@@ -1,48 +1,50 @@
1
+ /* eslint-disable linebreak-style */
2
+ /* eslint-disable indent */
1
3
  /* eslint-disable import/no-unresolved */
2
4
  /* eslint-disable padded-blocks */
3
5
 
4
6
  const chai = require('chai');
5
- const fresh = require('./fresh');
7
+ const fresh = require('./newfresh');
6
8
 
7
9
  before(() => {
8
- chai.should();
10
+ chai.should();
9
11
  });
10
12
 
11
13
  describe('api/videos/newFresh', () => {
12
14
 
13
- it('should list fresh video pages', async () => {
14
- const list = await fresh({ page: 2 });
15
+ it('should list fresh video pages', async () => {
16
+ const list = await fresh({ page: 2 });
15
17
 
16
- list.should.be.an('object');
17
- list.pagination.should.be.an('object');
18
- list.pagination.page.should.be.equals(2);
19
- list.pagination.pages.should.be.an('array');
20
- list.pagination.pages[0].should.be.a('number');
21
- list.hasNext.should.be.a('function');
22
- list.hasNext().should.be.equals(true);
23
- list.hasPrevious.should.be.a('function');
24
- list.hasPrevious().should.be.equals(true);
25
- list.next.should.be.a('function');
26
- list.previous.should.be.a('function');
27
- list.videos.should.be.an('array');
28
- list.videos.forEach((video) => {
29
- video.should.be.an('object');
30
- video.should.have.ownPropertyDescriptor('duration');
31
- video.duration.should.be.a('string');
32
- video.should.have.ownPropertyDescriptor('path');
33
- video.path.should.be.a('string');
34
- video.should.have.ownPropertyDescriptor('profile');
35
- video.profile.should.be.an('object');
36
- video.profile.should.have.ownPropertyDescriptor('name');
37
- video.profile.name.should.be.an('string');
38
- video.profile.should.have.ownPropertyDescriptor('url');
39
- video.profile.url.should.be.an('string');
40
- video.should.have.ownPropertyDescriptor('title');
41
- video.title.should.be.a('string');
42
- video.should.have.ownPropertyDescriptor('url');
43
- video.url.should.be.a('string');
44
- video.should.have.ownPropertyDescriptor('views');
45
- video.views.should.be.a('string');
18
+ list.should.be.an('object');
19
+ list.pagination.should.be.an('object');
20
+ list.pagination.page.should.be.equals(2);
21
+ list.pagination.pages.should.be.an('array');
22
+ list.pagination.pages[0].should.be.a('number');
23
+ list.hasNext.should.be.a('function');
24
+ list.hasNext().should.be.equals(true);
25
+ list.hasPrevious.should.be.a('function');
26
+ list.hasPrevious().should.be.equals(true);
27
+ list.next.should.be.a('function');
28
+ list.previous.should.be.a('function');
29
+ list.videos.should.be.an('array');
30
+ list.videos.forEach((video) => {
31
+ video.should.be.an('object');
32
+ video.should.have.ownPropertyDescriptor('duration');
33
+ video.duration.should.be.a('string');
34
+ video.should.have.ownPropertyDescriptor('path');
35
+ video.path.should.be.a('string');
36
+ video.should.have.ownPropertyDescriptor('profile');
37
+ video.profile.should.be.an('object');
38
+ video.profile.should.have.ownPropertyDescriptor('name');
39
+ video.profile.name.should.be.an('string');
40
+ video.profile.should.have.ownPropertyDescriptor('url');
41
+ video.profile.url.should.be.an('string');
42
+ video.should.have.ownPropertyDescriptor('title');
43
+ video.title.should.be.a('string');
44
+ video.should.have.ownPropertyDescriptor('url');
45
+ video.url.should.be.a('string');
46
+ video.should.have.ownPropertyDescriptor('views');
47
+ video.views.should.be.a('string');
46
48
  });
47
49
 
48
50
  const previous = await list.previous();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "xvideosx",
3
3
  "description": "xvideos.com api implementation.",
4
- "version": "1.5.0",
4
+ "version": "1.5.2",
5
5
  "main": "index.js",
6
6
  "license": "BSD-3-Clause",
7
7
  "repository": {
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "axios": "^0.21.4",
28
- "cheerio": "^1.0.0-rc.10",
28
+ "cheerio": "^1.0.0-rc.12",
29
29
  "puppeteer": "^22.0.0"
30
30
  },
31
31
  "devDependencies": {