Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MR414N-ID
GitHub Repository: MR414N-ID/botku2
Path: blob/master/lib/scraper.js
1126 views
1
/**
2
* Create By Dika Ardnt.
3
* Contact Me on wa.me/6288292024190
4
* Follow https://github.com/DikaArdnt
5
*/
6
7
const axios = require('axios')
8
const cheerio = require('cheerio')
9
10
11
function pinterest(querry){
12
return new Promise(async(resolve,reject) => {
13
axios.get('https://id.pinterest.com/search/pins/?autologin=true&q=' + querry, {
14
headers: {
15
"cookie" : "_auth=1; _b=\"AVna7S1p7l1C5I9u0+nR3YzijpvXOPc6d09SyCzO+DcwpersQH36SmGiYfymBKhZcGg=\"; _pinterest_sess=TWc9PSZHamJOZ0JobUFiSEpSN3Z4a2NsMk9wZ3gxL1NSc2k2NkFLaUw5bVY5cXR5alZHR0gxY2h2MVZDZlNQalNpUUJFRVR5L3NlYy9JZkthekp3bHo5bXFuaFZzVHJFMnkrR3lTbm56U3YvQXBBTW96VUgzVUhuK1Z4VURGKzczUi9hNHdDeTJ5Y2pBTmxhc2owZ2hkSGlDemtUSnYvVXh5dDNkaDN3TjZCTk8ycTdHRHVsOFg2b2NQWCtpOWxqeDNjNkk3cS85MkhhSklSb0hwTnZvZVFyZmJEUllwbG9UVnpCYVNTRzZxOXNJcmduOVc4aURtM3NtRFo3STlmWjJvSjlWTU5ITzg0VUg1NGhOTEZzME9SNFNhVWJRWjRJK3pGMFA4Q3UvcHBnWHdaYXZpa2FUNkx6Z3RNQjEzTFJEOHZoaHRvazc1c1UrYlRuUmdKcDg3ZEY4cjNtZlBLRTRBZjNYK0lPTXZJTzQ5dU8ybDdVS015bWJKT0tjTWYyRlBzclpiamdsNmtpeUZnRjlwVGJXUmdOMXdTUkFHRWloVjBMR0JlTE5YcmhxVHdoNzFHbDZ0YmFHZ1VLQXU1QnpkM1FqUTNMTnhYb3VKeDVGbnhNSkdkNXFSMXQybjRGL3pyZXRLR0ZTc0xHZ0JvbTJCNnAzQzE0cW1WTndIK0trY05HV1gxS09NRktadnFCSDR2YzBoWmRiUGZiWXFQNjcwWmZhaDZQRm1UbzNxc21pV1p5WDlabm1UWGQzanc1SGlrZXB1bDVDWXQvUis3elN2SVFDbm1DSVE5Z0d4YW1sa2hsSkZJb1h0MTFpck5BdDR0d0lZOW1Pa2RDVzNySWpXWmUwOUFhQmFSVUpaOFQ3WlhOQldNMkExeDIvMjZHeXdnNjdMYWdiQUhUSEFBUlhUVTdBMThRRmh1ekJMYWZ2YTJkNlg0cmFCdnU2WEpwcXlPOVZYcGNhNkZDd051S3lGZmo0eHV0ZE42NW8xRm5aRWpoQnNKNnNlSGFad1MzOHNkdWtER0xQTFN5Z3lmRERsZnZWWE5CZEJneVRlMDd2VmNPMjloK0g5eCswZUVJTS9CRkFweHc5RUh6K1JocGN6clc1JmZtL3JhRE1sc0NMTFlpMVErRGtPcllvTGdldz0=; _ir=0"
16
}
17
}).then(({ data }) => {
18
const $ = cheerio.load(data)
19
const result = [];
20
const hasil = [];
21
$('div > a').get().map(b => {
22
const link = $(b).find('img').attr('src')
23
result.push(link)
24
});
25
result.forEach(v => {
26
if(v == undefined) return
27
hasil.push(v.replace(/236/g,'736'))
28
})
29
hasil.shift();
30
resolve(hasil)
31
})
32
})
33
}
34
35
function wallpaper(title, page = '1') {
36
return new Promise((resolve, reject) => {
37
axios.get(`https://www.besthdwallpaper.com/search?CurrentPage=${page}&q=${title}`)
38
.then(({ data }) => {
39
let $ = cheerio.load(data)
40
let hasil = []
41
$('div.grid-item').each(function (a, b) {
42
hasil.push({
43
title: $(b).find('div.info > a > h3').text(),
44
type: $(b).find('div.info > a:nth-child(2)').text(),
45
source: 'https://www.besthdwallpaper.com/'+$(b).find('div > a:nth-child(3)').attr('href'),
46
image: [$(b).find('picture > img').attr('data-src') || $(b).find('picture > img').attr('src'), $(b).find('picture > source:nth-child(1)').attr('srcset'), $(b).find('picture > source:nth-child(2)').attr('srcset')]
47
})
48
})
49
resolve(hasil)
50
})
51
})
52
}
53
54
function wikimedia(title) {
55
return new Promise((resolve, reject) => {
56
axios.get(`https://commons.wikimedia.org/w/index.php?search=${title}&title=Special:MediaSearch&go=Go&type=image`)
57
.then((res) => {
58
let $ = cheerio.load(res.data)
59
let hasil = []
60
$('.sdms-search-results__list-wrapper > div > a').each(function (a, b) {
61
hasil.push({
62
title: $(b).find('img').attr('alt'),
63
source: $(b).attr('href'),
64
image: $(b).find('img').attr('data-src') || $(b).find('img').attr('src')
65
})
66
})
67
resolve(hasil)
68
})
69
})
70
}
71
72
function quotesAnime() {
73
return new Promise((resolve, reject) => {
74
const page = Math.floor(Math.random() * 184)
75
axios.get('https://otakotaku.com/quote/feed/'+page)
76
.then(({ data }) => {
77
const $ = cheerio.load(data)
78
const hasil = []
79
$('div.kotodama-list').each(function(l, h) {
80
hasil.push({
81
link: $(h).find('a').attr('href'),
82
gambar: $(h).find('img').attr('data-src'),
83
karakter: $(h).find('div.char-name').text().trim(),
84
anime: $(h).find('div.anime-title').text().trim(),
85
episode: $(h).find('div.meta').text(),
86
up_at: $(h).find('small.meta').text(),
87
quotes: $(h).find('div.quote').text().trim()
88
})
89
})
90
resolve(hasil)
91
}).catch(reject)
92
})
93
}
94
95
function aiovideodl(link) {
96
return new Promise((resolve, reject) => {
97
axios({
98
url: 'https://aiovideodl.ml/',
99
method: 'GET',
100
headers: {
101
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
102
"cookie": "PHPSESSID=69ce1f8034b1567b99297eee2396c308; _ga=GA1.2.1360894709.1632723147; _gid=GA1.2.1782417082.1635161653"
103
}
104
}).then((src) => {
105
let a = cheerio.load(src.data)
106
let token = a('#token').attr('value')
107
axios({
108
url: 'https://aiovideodl.ml/wp-json/aio-dl/video-data/',
109
method: 'POST',
110
headers: {
111
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
112
"cookie": "PHPSESSID=69ce1f8034b1567b99297eee2396c308; _ga=GA1.2.1360894709.1632723147; _gid=GA1.2.1782417082.1635161653"
113
},
114
data: new URLSearchParams(Object.entries({ 'url': link, 'token': token }))
115
}).then(({ data }) => {
116
resolve(data)
117
})
118
})
119
})
120
}
121
122
function umma(url) {
123
return new Promise((resolve, reject) => {
124
axios.get(url)
125
.then((res) => {
126
let $ = cheerio.load(res.data)
127
let image = []
128
$('#article-content > div').find('img').each(function (a, b) {
129
image.push($(b).attr('src'))
130
})
131
let hasil = {
132
title: $('#wrap > div.content-container.font-6-16 > h1').text().trim(),
133
author: {
134
name: $('#wrap > div.content-container.font-6-16 > div.content-top > div > div.user-ame.font-6-16.fw').text().trim(),
135
profilePic: $('#wrap > div.content-container.font-6-16 > div.content-top > div > div.profile-photo > img.photo').attr('src')
136
},
137
caption: $('#article-content > div > p').text().trim(),
138
media: $('#article-content > div > iframe').attr('src') ? [$('#article-content > div > iframe').attr('src')] : image,
139
type: $('#article-content > div > iframe').attr('src') ? 'video' : 'image',
140
like: $('#wrap > div.bottom-btns > div > button:nth-child(1) > div.text.font-6-12').text(),
141
}
142
resolve(hasil)
143
})
144
})
145
}
146
147
function ringtone(title) {
148
return new Promise((resolve, reject) => {
149
axios.get('https://meloboom.com/en/search/'+title)
150
.then((get) => {
151
let $ = cheerio.load(get.data)
152
let hasil = []
153
$('#__next > main > section > div.jsx-2244708474.container > div > div > div > div:nth-child(4) > div > div > div > ul > li').each(function (a, b) {
154
hasil.push({ title: $(b).find('h4').text(), source: 'https://meloboom.com/'+$(b).find('a').attr('href'), audio: $(b).find('audio').attr('src') })
155
})
156
resolve(hasil)
157
})
158
})
159
}
160
161
function styletext(teks) {
162
return new Promise((resolve, reject) => {
163
axios.get('http://qaz.wtf/u/convert.cgi?text='+teks)
164
.then(({ data }) => {
165
let $ = cheerio.load(data)
166
let hasil = []
167
$('table > tbody > tr').each(function (a, b) {
168
hasil.push({ name: $(b).find('td:nth-child(1) > span').text(), result: $(b).find('td:nth-child(2)').text().trim() })
169
})
170
resolve(hasil)
171
})
172
})
173
}
174
175
module.exports = { pinterest, wallpaper, wikimedia, quotesAnime, aiovideodl, umma, ringtone, styletext }
176
177