xvideosx 1.5.8 → 1.5.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,18 +1,19 @@
1
1
  /* eslint-disable linebreak-style */
2
+ /* eslint-disable no-unused-vars */
2
3
  /* eslint-disable no-undef */
3
4
  const puppeteer = require('puppeteer');
4
5
  const cheerio = require('cheerio');
5
6
 
6
7
  const newFresh = async ({ url, puppeteerConfig } = {}) => {
7
8
  let browser;
9
+
8
10
  try {
9
11
  browser = await puppeteer.launch(puppeteerConfig);
10
12
  const page = await browser.newPage();
11
- await page.goto(url, { waitUntil: 'networkidle2' });
13
+ await page.goto('https://www.xvideos.com/');
12
14
  const html = await page.content();
13
15
  const $ = cheerio.load(html);
14
- const data = $('div[class=mozaique]').html();
15
- const $getVideos = cheerio.load(data);
16
+ const $getVideos = cheerio.load($.html());
16
17
  const mozaique = $getVideos('.thumb-block');
17
18
  const videos = mozaique.map((index, element) => {
18
19
  const $element = $getVideos(element);
@@ -20,18 +21,19 @@ const newFresh = async ({ url, puppeteerConfig } = {}) => {
20
21
  const url = `https://www.xvideos.com${$element.find('.title a').attr('href')}`;
21
22
  const thumbNail = $element.find('.thumb img').attr('src');
22
23
  const duration = $element.find('.duration').text();
23
- const name = $element.find('.metadata .name').text();
24
+ const channel = $element.find('.metadata .name').text();
24
25
 
25
26
  return {
26
-
27
27
  title,
28
28
  url,
29
29
  thumbNail,
30
30
  duration,
31
- name,
31
+ channel,
32
32
  };
33
33
  }).get();
34
34
  return videos;
35
+ } catch (e) {
36
+ console.log(e);
35
37
  } finally {
36
38
  if (browser) await browser.close();
37
39
  }
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.8",
4
+ "version": "1.5.9",
5
5
  "main": "index.js",
6
6
  "license": "BSD-3-Clause",
7
7
  "repository": {