This repository was archived by the owner on Dec 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
43 lines (38 loc) · 1.19 KB
/
index.js
File metadata and controls
43 lines (38 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
const axios = require('axios');
const cheerio = require('cheerio');
async function scrapSite(page) {
/***
* @page is what page you want to scrap, select any page except 0
*/
try {
const response = await axios.get(page ? `https://seegore.com/gore/page/${page}` : 'https://seegore.com/gore');
const $ = cheerio.load(response.data);
const links = [];
$('img.attachment-boombox_image360x270').each((index, element) => {
const image = $(element).attr('src');
const data = { image };
const parent = $(element).closest('.post-item');
const link = parent.find('a[rel="bookmark"]').attr('href');
const title = parent.find('a[rel="bookmark"]').text();
links.push({ title, link, ...data });
});
return links
} catch (err) {
throw err;
}
}
async function getStreamLink(link) {
try {
if (!link) {
throw new Error("No Page Link Provided")
}
const { data: html } = await axios.get(link);
const $ = cheerio.load(html);
const videoSrc = $('video.wp-video-shortcode source').attr('src');
return videoSrc;
} catch (err) {
throw err
}
}
scrapSite().then(res => console.log(res));
// getStreamLink('link').then(x => console.log(x))