Commit 81eda10f authored by Gyeongho Park's avatar Gyeongho Park

[Improve] 쿠키 처리 개선

parent 2ab6f4a4
......@@ -38,7 +38,7 @@ app.use(function(err, req, res, next) {
// render the error page
// res.status(err.status || 500);
// res.render('error');
res.status(errorcode.c001.status).json(errorcode.c001)
res.status(err.status || 500).json(err)
});
......
......@@ -7,9 +7,7 @@ const origin = 'https://' + host
const referer = host + '/lms/plugin/player/ecom_player.php'
const contentType = 'application/x-www-form-urlencoded; charset=UTF-8'
const updateUrl = origin + '/lms/plugin/player/ecom_player_update.php'
const cookie = 'bg_id=25056279-3354-44c8-b767-55ffafb425f8; _gcl_au=1.1.1028567537.1701416329; _fbp=fb.1.1701416329030.1182959737; PHPSESSID=w4~rnl3tff3uurck4m00nkfl99e22; 2a0d2363701f23f8a75028924a3af643=NTkuMjEuMzQuMjE1; _fwb=179n2hi7H5zEnDJJXuDwvAw.1702016217827; _gid=GA1.2.520838398.1702016219; popup_3=done; f33d2ed86bd82d4c22123c9da444d8ab=MTcwMjAxNjI3NQ%3D%3D; 96b28b766b7e0699aa91c9ff3d890663=aHR0cHM6Ly9uaWNlLmNoZWNrcGx1cy5jby5rci8%3D; bg_scrollY=7688; play_head=%7B%22wr_id%22%3A%221999977%22%2C%22p_id%22%3A%224dae5685c329240daa96f1e6dba733a6%22%2C%22s_id%22%3A%22ujed%22%2C%22wr_order%22%3A%221%22%7D; save_id=vaz55; wcs_bt=s_53d0704a39a1:1702016802; _ga=GA1.2.1111176735.1701416329; _ga_YTEBTSNC3S=GS1.1.1702016218.2.1.1702016803.56.0.0; _ga_3LZR51WJST=GS1.1.1702016218.2.1.1702016803.0.0.0; play=%7B%22wr_id%22%3A%221999977%22%2C%22p_id%22%3A%224dae5685c329240daa96f1e6dba733a6%22%2C%22s_id%22%3A%22ujed%22%2C%22wr_order%22%3A%221%22%2C%22sample_mode%22%3Afalse%7D; move_prev=false; page_time=%7B%22key%22%3A%226572b9f331b08%22%2C%22time%22%3A'
/* GET home page. */
router.get('/', function(req, res, next) {
res.render('index', { title: 'Vazil Eduline Skipper' });
});
......@@ -17,7 +15,7 @@ router.get('/', function(req, res, next) {
router.post('/skip', async (req, res, next) => {
try {
const { p_id, s_id, wr_id} = req.body
const { PHPSESSID, key, p_id, s_id, wr_id} = req.body
let responses = []
......@@ -27,19 +25,28 @@ router.post('/skip', async (req, res, next) => {
end: false
}
const formData = new FormData()
formData.append('p_id', p_id)
formData.append('s_id', s_id)
formData.append('wr_order', 22)
formData.append('wr_page', (i+1))
formData.append('wr_id', wr_id)
let rand = parseInt((Math.random() * 10000) + 1000000)
let add = parseInt(Math.random() * 100000)
let startTimestamp = ((parseInt(Date.now()) - rand) + '').substring(0, 10)
let endTimestamp = ((parseInt(Date.now()) - (rand - add)) + '').substring(0, 10)
console.log(i + ' 번째 요청 ', startTimestamp, endTimestamp)
console.log(i + ' 번째 요청 ', startTimestamp)
const playCookie = encodeURIComponent(JSON.stringify({
wr_id: wr_id,
p_id: p_id,
s_id: s_id,
wr_order: 22,
sample_mode: false
}));
const pageTimeCookie = encodeURIComponent(JSON.stringify({
key: key ? key : '66592ddb19920',
time: startTimestamp
}));
let cookie = ''
cookie += 'PHPSESSID=' + (PHPSESSID ? PHPSESSID : 'w6~gaf4ngqb42nslt97tuqbcegph1') + ';'
cookie += 'play=' + playCookie + ';'
cookie += 'page_time=' + pageTimeCookie
const config = {
headers: {
......@@ -50,7 +57,14 @@ router.post('/skip', async (req, res, next) => {
}
}
config.headers['Cookie'] = cookie + startTimestamp + '%7D'
config.headers['Cookie'] = cookie
const formData = new FormData()
formData.append('p_id', p_id)
formData.append('s_id', s_id)
formData.append('wr_order', 22)
formData.append('wr_page', (i+1))
formData.append('wr_id', wr_id)
await axios.post(updateUrl, formData, config)
.then(res=>{
console.log('start clear', res.data)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment