Skip to content

Instantly share code, notes, and snippets.

@june9713
Created July 8, 2018 06:31
Show Gist options
  • Save june9713/6bc47cf38cba01793ea9d61cb5ba09e8 to your computer and use it in GitHub Desktop.
Save june9713/6bc47cf38cba01793ea9d61cb5ba09e8 to your computer and use it in GitHub Desktop.
Send Naver note without Selenium
import mechanicalsoup
browser = mechanicalsoup.StatefulBrowser()
headers = {"Connection": "keep-alive",
"Cache-Control": "max-age=0",
"Origin": "https://nid.naver.com",
"Upgrade-Insecure-Requests": "1",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"Referer": "https://nid.naver.com/nidlogin.login?svctype=262144&url=http%3A%2F%2Fm.note.naver.com%2Fmobile%2FmobileSendList.nhn",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "ko,en-US;q=0.9,en;q=0.8,zh-CN;q=0.7,zh;q=0.6,zh-TW;q=0.5,de;q=0.4,de-CH;q=0.3,de-AT;q=0.2,ja;q=0.1"}
data = {'bvsd':None,
'enctp':1 ,
'encpw':None,
'encnm':None,
'svctype':262144,
'svc':None,
'viewtype':0,
'locale':'ko_KR',
'postDataKey':None,
'smart_LEVEL':-1,
'logintp':None,
'url':'http://m.note.naver.com/mobile/mobileSendList.nhn',
'localechange':None,
'ls':None,
'xid':None,
'pre_id':None,
'resp':None,
'ru':None,
'id':'MyId',#MyId
'pw':'MyPass',#MyPass
'nvlong':'on'}
req = browser.post('https://nid.naver.com/nidlogin.login?svctype=262144' ,headers = headers , data = data , verify = False)
headers = {"Connection": "keep-alive",
"charset": "utf-8",
"Origin": "https://note.naver.com",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36",
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
"Accept": "*/*",
"Referer": "https://note.naver.com/",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "ko,en-US;q=0.9,en;q=0.8,zh-CN;q=0.7,zh;q=0.6,zh-TW;q=0.5,de;q=0.4,de-CH;q=0.3,de-AT;q=0.2,ja;q=0.1"}
tocken = 'AnyValuUse'#Any Rnadom Vaues 10bytes
data = {'svcType':'undefined',
'svcId':None,
'svcName':None,
'isReplyNote':0 ,
'content':'23222222222222222222222222222222222222',
'isBackup':1,
'svcCode':3103697744,#Not Sure, But This num for me.
'token':'MTUzMT%sNHp6dW5icm90aGU='%tocken,
'u':'MyId',#Sender Id
'targetUserId':'YourId'}#Reciever Id
req = browser.post('https://note.naver.com/json/write/send/' , headers = headers , data = data,verify=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment