Skip to content

Commit

Permalink
Try Fix axios in render
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown committed Aug 12, 2023
1 parent 2754391 commit 1f53a38
Showing 1 changed file with 30 additions and 37 deletions.
67 changes: 30 additions & 37 deletions lib/api/apidl.js
Original file line number Diff line number Diff line change
Expand Up @@ -679,49 +679,42 @@ function pinterest(querry){

function igstory (username) {
return new Promise(async(resolve, reject) => {
const res = await axios.get('https://storydownloader.app/en');
axios.get('https://storydownloader.app/en',{
method: 'GET',
const res = await axios.get('https://storydownloader.app/en',{
headers: {
'cookie': res.headers["set-cookie"],
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36"
}
})
.then(({ data }) => {

const $ = cheerio.load(data)
var token = $('body > main > div.hero.pt-5.pb-5 > div.container.w > div > form > div.input-group.mb-2 > input[type=hidden]:nth-child(2)').attr('value')

axios.request({
url: 'https://storydownloader.app/request',
method: 'post',
data: new URLSearchParams(Object.entries({ 'username': username, '_token': token })),
headers: {
'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36',
'cookie': res.headers["set-cookie"]
}
}).then(respon => {
}).catch(error => resolve())
const $ = cheerio.load(res.data)
var token = $('body > main > div.hero.pt-5.pb-5 > div.container.w > div > form > div.input-group.mb-2 > input[type=hidden]:nth-child(2)').attr('value')
axios.request({
url: 'https://storydownloader.app/request',
method: 'post',
data: new URLSearchParams(Object.entries({ 'username': username, '_token': token })),
headers: {
'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36',
'cookie': res.headers["set-cookie"]
}
}).then(respon => {

if(!respon.data.html) {
return resolve()
}else{
const $ = cheerio.load(respon.data.html)
let hasil = []
$('div.row > div').each(function (a, b) {
hasil.push({
image: $(b).find('img').attr('src'),
url_download: $(b).find('a').attr('href')
})
if(!respon.data.html) {
return resolve()
}else{
const $ = cheerio.load(respon.data.html)
let hasil = []
$('div.row > div').each(function (a, b) {
hasil.push({
image: $(b).find('img').attr('src'),
url_download: $(b).find('a').attr('href')
})
const result = {
username: $('h3.card-title').text(),
profile_picture: $('img.card-avatar').attr('src'),
url: hasil
}
return resolve(result)
})
const result = {
username: $('h3.card-title').text(),
profile_picture: $('img.card-avatar').attr('src'),
url: hasil
}
}).catch(reject)
})
return resolve(result)
}
}).catch(error => resolve())
})
}

Expand Down

0 comments on commit 1f53a38

Please sign in to comment.