Skip to content

Instantly share code, notes, and snippets.

@74l35rUnn3r
Last active April 8, 2024 12:02
Show Gist options
  • Save 74l35rUnn3r/d1f28eb8af9cb0e2551df8b0e7ec1f21 to your computer and use it in GitHub Desktop.
Save 74l35rUnn3r/d1f28eb8af9cb0e2551df8b0e7ec1f21 to your computer and use it in GitHub Desktop.
def vote(gall_id: str, no: str, mode: str, proxy: str = '') -> str:
result = ''
s = requests.session()
s.headers.update({ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36' })
if proxy:
s.proxies = {'http': 'http://' + proxy }
r1 = s.get('http://gall.dcinside.com/board/view/?id=' + gall_id, timeout=5)
#r1 = s.get('http://gall.dcinside.com/board/view/?id=' + gall_id + '&no=' + no, timeout=5)
s.headers.update({
'Host': 'gall.dcinside.com',
'Origin': 'http://gall.dcinside.com',
'Referer': 'http://gall.dcinside.com/board/view/?id=' + gall_id + '&no=' + no,
'X-Requested-With': 'XMLHttpRequest'
})
data = {
'ci_t': s.cookies['ci_c'],
'id': gall_id,
'no': no,
'mode': mode,
'code_recommend': 'undefined',
'_GALLTYPE_': 'G',
'link_id': gall_id,
}
if mode == 'U':
s.cookies.update({gall_id + no + '_Firstcheck': 'Y'})
else:
s.cookies.update({gall_id + no + '_Firstcheck_down': 'Y'})
r2 = s.post('http://gall.dcinside.com/board/recommend/vote', data=data, timeout=5)
result = r2.content.decode('utf-8').replace('<script>window.location="https://gall.dcinside.com/board/recommend/vote"</script>', ''""'')
if len(result) > 64:
return 'err'
# print(result)
return result
@heartleth
Copy link

개쩐다

@toothlessdev
Copy link

개추...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment