Add getting comments
This commit is contained in:
8 files changed
+340
-5
No files matched your search
@@ -0,0 +1,71 @@
|
||||
import axios from 'axios'
|
||||
import { jsonResponse, parseResponse, splitGd } from '../../../lib/util'
|
||||
import { Context } from 'elysia'
|
||||
|
||||
export const handler = async (handler: Context) => {
|
||||
const id = handler.query.id
|
||||
const page = handler.query.page
|
||||
const mode = handler.query.mode
|
||||
|
||||
const request = await axios.post(
|
||||
'https://www.boomlings.com/database/getGJComments21.php',
|
||||
new URLSearchParams({
|
||||
gameVersion: '22',
|
||||
binaryVersion: '45',
|
||||
udid: 'BEA53432-326F-4D39-91D7-2B51B849825E',
|
||||
uuid: '241138636',
|
||||
accountID: '28945106',
|
||||
gjp2: '836845372d7a726b35f627bcc491d4e122782c17',
|
||||
page: page ?? '0',
|
||||
total: '0',
|
||||
secret: 'Wmfd2893gb7',
|
||||
mode,
|
||||
levelID: id
|
||||
}),
|
||||
{
|
||||
headers: {
|
||||
'User-Agent': ' ',
|
||||
Cookie: 'gd=1'
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
const responseText = request.data as string
|
||||
const responseSplit = responseText
|
||||
.split('|')
|
||||
.map(x => x.split(':'))
|
||||
.map(x => x.map(x => parseResponse(x, '~')))
|
||||
|
||||
return jsonResponse(
|
||||
responseSplit.map(item => {
|
||||
const commentInfo = item[0]
|
||||
const accountInfo = item[1]
|
||||
|
||||
return {
|
||||
id: +commentInfo['6'],
|
||||
content: atob(commentInfo['2']),
|
||||
likes: +commentInfo['4'],
|
||||
date: commentInfo['9'] + ' ago',
|
||||
commentColor: commentInfo['12']
|
||||
? JSON.parse('[' + commentInfo['12'] + ']')
|
||||
: [255, 255, 255],
|
||||
account: {
|
||||
username: accountInfo['1'],
|
||||
moderator: +accountInfo['15'],
|
||||
playerId: +accountInfo['11'],
|
||||
accountId: +accountInfo['16'],
|
||||
icon: {
|
||||
form: ['icon', 'ship', 'ball', 'ufo', 'wave', 'robot', 'spider'][
|
||||
+accountInfo['14']
|
||||
],
|
||||
icon: +accountInfo['9'],
|
||||
col1: +accountInfo['10'],
|
||||
col2: +accountInfo['11'],
|
||||
colG: +accountInfo['51'],
|
||||
glow: +accountInfo['15'] > 1
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user