1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | #-*- coding: utf-8 -* import requests url = "http://gall.dcinside.com/forms/comment_submit" r = requests.get("http://gall.dcinside.com/board/view/?id=watch&no=1620468&page=1") s = r.text #print(s) idx = s.find("ci_t\" value=\"") if(idx == -1): print("쿠키 파싱 실패!") #exit() idx += len("ci_t\" value=\"") ci_t = s[idx : idx + 32] idx = s.find("id=\'check_6\' value=\'") if(idx == -1): print("쿠키 파싱 실패! 1") idx += len("id=\'check_6\' value=\'") check_6 = s[idx : s.find("\'", idx)] idx = s.find("id=\'check_7\' value=\'") if(idx == -1): print("쿠키 파싱 실패! 2") idx += len("id=\'check_7\' value=\'") check_7 = s[idx : s.find("\'", idx)] idx = s.find("id=\'check_8\' value=\'") if(idx == -1): print("쿠키 파싱 실패 3!") idx += len("id=\'check_8\' value=\'") check_8 = s[idx : s.find("\'", idx)] print(ci_t, ":", len(ci_t)) print(check_6, ":", len(check_6)) print(check_7, ":", len(check_7)) print(check_8, ":", len(check_8)) num = "1212" headers = {"Referer" : "http://gall.dcinside.com/board/view/?id="</span> <span style="color:#0086b3">+ "watch" + "&no="</span> <span style="color:#0086b3">+ num + "&page=1", "Content-Type" : "application/x-www-form-urlencoded; charset=UTF-8", "User-Agent" : "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.93 Safari/537.36", "X-Requested-With" : "XMLHttpRequest"} data = {"check_6" : check_6, "check_7" : check_7, "check_8" : check_8, "ci_t" : ci_t, "name" : "test", "password" : "1234", "memo" : "hello test", "id" : "watch", "no" : num, "best_orgin" : "", "campus" : 0, "recommend" : 0} r2 = requests.post(url, headers = headers, data = data) print(r2.text) | cs |
<p>The action you have requested is not allowed.</p>
이런 에러 뜨는데 어디가 문제일까요?
헤더랑 post할때 보내는 데이타 다 맞춰줬는데
혹시 만들어보신분 있으시면 도움좀 주시면 감사하겠슴니다..
세션은 ?
으.....극혐로봇만들고있네 ...제일시러!!!!!!!!
시크//그게 뭔가요?... 구글링해서 예제들보고 따라하는 중이에요
복잡하게하내 ㅋㅋ
ss