Last active
January 13, 2021 07:59
-
-
Save heartleth/05182b3b1fd1d85b43e71f4c6e9d77b6 to your computer and use it in GitHub Desktop.
디씨 개추 누르기
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = require('axios'); | |
(async()=>{ | |
const no = 1589538; | |
const data = await axios.get(`https://gall.dcinside.com/board/view/?id=programming&no=${no}`) | |
const cookies = data.headers['set-cookie'].map(e=>e.match(/^[^;]+/)[0]).reduce((a, b) => a + b + '; ', ''); | |
const token = cookies.match(/(?<=(ci_c=))[^;]+/)[0]; | |
const gall_id = 'programming'; | |
const vote_mode = 'U'; | |
const code_recommend_id = 'undefined'; | |
const _GALLTYPE_ = 'G'; | |
setTimeout(() => { | |
const params = new URLSearchParams() | |
params.append('ci_t', token); | |
params.append('id', gall_id); | |
params.append('no', no); | |
params.append('mode', vote_mode); | |
params.append('code_recommend', code_recommend_id); | |
params.append('_GALLTYPE_', _GALLTYPE_); | |
params.append('link_id', gall_id); | |
axios.post("https://gall.dcinside.com/board/recommend/vote", params, { | |
headers: { | |
'Accept': '*/*', | |
'Cookie': cookies, | |
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', | |
'Accept-Encoding': 'gzip, deflate, br', | |
'Accept-Language': 'en-AS,en;q=0.9,ko-KR;q=0.8,ko;q=0.7,en-US;q=0.6', | |
'Connection': 'keep-alive', | |
'Origin': 'https://gall.dcinside.com', | |
'Referer': 'https://gall.dcinside.com/board/view/?id=programming&no=1589490&page=1', | |
'sec-ch-ua-mobile': '?0', | |
'Sec-Fetch-Dest': 'empty', | |
'Sec-Fetch-Mode': 'cors', | |
'Sec-Fetch-Site': 'same-origin', | |
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36', | |
'X-Requested-With': 'XMLHttpRequest' | |
} | |
}).then(e=>{ | |
console.log(e) | |
}); | |
}, 1000); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment