Spaces:
Paused
Paused
Update index.js
Browse files
index.js
CHANGED
|
@@ -162,6 +162,15 @@ app.all('/dood', async (req, res) => {
|
|
| 162 |
});
|
| 163 |
});
|
| 164 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
|
| 166 |
app.all('/stablediff/illusion', async (req, res) => {
|
| 167 |
if (!['GET', 'POST'].includes(req.method)) return res.status(405).json({ success: false, message: 'Method Not Allowed' })
|
|
@@ -390,4 +399,33 @@ async function enhanceImage(url) {
|
|
| 390 |
|
| 391 |
await browser.close()
|
| 392 |
return json
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 393 |
}
|
|
|
|
| 162 |
});
|
| 163 |
});
|
| 164 |
|
| 165 |
+
app.get('/igstalk', async (req, res) => {
|
| 166 |
+
try {
|
| 167 |
+
if (!req.query.user) return res.json({ message: 'Required an username' })
|
| 168 |
+
let result = await igStalk(req.query.user)
|
| 169 |
+
res.json({ result })
|
| 170 |
+
} catch (e) {
|
| 171 |
+
res.send(e)
|
| 172 |
+
}
|
| 173 |
+
})
|
| 174 |
|
| 175 |
app.all('/stablediff/illusion', async (req, res) => {
|
| 176 |
if (!['GET', 'POST'].includes(req.method)) return res.status(405).json({ success: false, message: 'Method Not Allowed' })
|
|
|
|
| 399 |
|
| 400 |
await browser.close()
|
| 401 |
return json
|
| 402 |
+
}
|
| 403 |
+
|
| 404 |
+
|
| 405 |
+
async function igStalk(user) {
|
| 406 |
+
const getDetailPost = async url => {
|
| 407 |
+
let html = (await axios.get(url, { headers: { 'Referer': 'https://www.picuki.com/', 'User-Agent': fakeua.mobile() }})).data
|
| 408 |
+
let $ = cheerio.load(html), obj = {}
|
| 409 |
+
obj.caption = $('title').text().trim().split(' Instagram post ')[1].split(' - Picuki.com')[0]
|
| 410 |
+
obj.ago = $('div.single-photo-info').find('div.single-photo-time').text()
|
| 411 |
+
obj.likes = $('div.info-bottom').find('span.icon-thumbs-up-alt').text()
|
| 412 |
+
obj.comments = $('div.info-bottom').find('span.icon-chat').text()
|
| 413 |
+
obj.url = $('div.single-photo.owl-carousel.owl-theme > div.item').get().map((x) => $(x).find('img').attr('src') || $(x).find('video').attr('src'))
|
| 414 |
+
if (!obj.url.length) obj.url = [$('div.single-photo').find('img').attr('src') || $('div.single-photo').find('video').attr('src')]
|
| 415 |
+
return obj
|
| 416 |
+
}
|
| 417 |
+
let html = (await axios.get('https://www.picuki.com/profile/' + user, { headers: { 'Referer': 'https://www.picuki.com/', 'User-Agent': fakeua.mobile() }})).data
|
| 418 |
+
let $ = cheerio.load(html), obj = {}, arr = []
|
| 419 |
+
let urlPost = $('div.content > ul > li').get().map((x) => $(x).find('a').attr('href'))
|
| 420 |
+
for (let x of urlPost) {
|
| 421 |
+
if (x) arr.push(await getDetailPost(x))
|
| 422 |
+
}
|
| 423 |
+
obj.avatar = $('div.profile-avatar').find('a').attr('href')
|
| 424 |
+
obj.username = $('div.profile-name > h1').text()
|
| 425 |
+
obj.fullname = $('div.profile-name > h2').text()
|
| 426 |
+
obj.description = $('div.profile-description').text().trim()
|
| 427 |
+
obj.followers = $('div.content-title').find('span.followed_by').text()
|
| 428 |
+
obj.following = $('div.content-title').find('span.follows').text()
|
| 429 |
+
obj.post = arr
|
| 430 |
+
return obj
|
| 431 |
}
|