randydev commited on
Commit
93eb3b9
·
verified ·
1 Parent(s): b976227

Update scrapper.js

Browse files
Files changed (1) hide show
  1. scrapper.js +47 -1
scrapper.js CHANGED
@@ -63,7 +63,53 @@ async function tebakgambar() {
63
  }
64
  }
65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  module.exports = {
67
  OpenaiRes,
68
- tebakgambar
 
69
  };
 
63
  }
64
  }
65
 
66
+ async function AnimeHentai() {
67
+ try {
68
+ const page = Math.floor(Math.random() * 1153) + 1;
69
+ const url = `https://sfmcompile.club/page/${page}`;
70
+ const response = await axios.get(url);
71
+ const $ = cheerio.load(response.data);
72
+
73
+ const hasil = [];
74
+ const articles = $('#primary > div > div > ul > li > article');
75
+
76
+ articles.each((index, article) => {
77
+ const title = $(article).find('header > h2').text();
78
+ const link = $(article).find('header > h2 > a').attr('href');
79
+ const category = $(article)
80
+ .find('header > div.entry-before-title > span > span')
81
+ .text()
82
+ .replace('in ', '');
83
+ const share_count = $(article).find('header > div.entry-after-title > p > span.entry-shares').text();
84
+ const views_count = $(article).find('header > div.entry-after-title > p > span.entry-views').text();
85
+ const type = $(article).find('source').attr('type') || 'image/jpeg';
86
+ const video_1 = $(article).find('source').attr('src') || $(article).find('img').attr('data-src');
87
+ const video_2 = $(article).find('video > a').attr('href') || '';
88
+ hasil.push({
89
+ title,
90
+ link,
91
+ category,
92
+ share_count,
93
+ views_count,
94
+ type,
95
+ video_1,
96
+ video_2,
97
+ });
98
+ });
99
+
100
+ if (hasil.length === 0) {
101
+ return { developer: '@xtdevs', error: 'no result found' };
102
+ }
103
+
104
+ return hasil;
105
+ } catch (error) {
106
+ console.error('Error:', error);
107
+ return null;
108
+ }
109
+ }
110
+
111
  module.exports = {
112
  OpenaiRes,
113
+ tebakgambar,
114
+ AnimeHentai
115
  };