Fix pour /crack
This commit is contained in:
@@ -6,5 +6,4 @@
|
||||
**/docker-compose*
|
||||
**/Dockerfile*
|
||||
**/node_modules
|
||||
**/cracks
|
||||
README.md
|
||||
@@ -31,6 +31,7 @@ async function search(query, headers) {
|
||||
.then(response => response.arrayBuffer())
|
||||
.then(arrayBuffer => { return iconv.decode(Buffer.from(arrayBuffer), 'win1251') })
|
||||
.catch(error => console.error(error))
|
||||
try {
|
||||
let matches = body.split('</div>')[1].split('<span class="seperator fastfullsearch">')[0].split('</a>')
|
||||
let games = []
|
||||
matches.pop()
|
||||
@@ -40,6 +41,10 @@ async function search(query, headers) {
|
||||
games.push({ name, link })
|
||||
})
|
||||
return games
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
await interaction.followUp({ content: `Y'a eu une erreur !\n${error.toString()}` })
|
||||
}
|
||||
}
|
||||
|
||||
async function repo(game, headers) {
|
||||
@@ -47,22 +52,33 @@ async function repo(game, headers) {
|
||||
.then(response => response.arrayBuffer())
|
||||
.then(arrayBuffer => { return iconv.decode(Buffer.from(arrayBuffer), 'win1251') })
|
||||
.catch(error => console.error(error))
|
||||
try {
|
||||
let name = body.split('https://uploads.online-fix.me:2053/torrents/')[1].split('"')[0]
|
||||
let url = `https://uploads.online-fix.me:2053/torrents/${name}`
|
||||
return url
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
await interaction.followUp({ content: `Y'a eu une erreur !\n${error.toString()}` })
|
||||
}
|
||||
}
|
||||
|
||||
async function torrent(url, headers) {
|
||||
let response = await fetch(url, { headers, body: null, method: "GET" })
|
||||
.catch(error => console.error(error))
|
||||
try {
|
||||
let body = await response.text()
|
||||
let file = body.split('<a href="')[2].split('">')[0]
|
||||
return file
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
await interaction.followUp({ content: `Y'a eu une erreur !\n${error.toString()}` })
|
||||
}
|
||||
}
|
||||
|
||||
async function download(url, file, headers) {
|
||||
let path = `./cracks/${file}`
|
||||
let writer = fs.createWriteStream(path)
|
||||
try {
|
||||
await axios({ url: url + file, method: 'GET', responseType: 'stream', headers }).then(response => {
|
||||
return new Promise((resolve, reject) => {
|
||||
response.data.pipe(writer)
|
||||
@@ -76,6 +92,10 @@ async function download(url, file, headers) {
|
||||
})
|
||||
}).catch(error => console.error(error))
|
||||
return path
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
await interaction.followUp({ content: `Y'a eu une erreur !\n${error.toString()}` })
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
Reference in New Issue
Block a user