Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import hmac
- import hashlib
- import urllib
- import urllib2
- AppKey = 'xxfvFQcOzpTBvwuwPMwwzLZxiCSaGb'
- HMKey = 'DgQ3aNpoluV1cl3GFJAqitBg5xKiXZ'
- def authenticate():
- CT = '1234567890'
- message = AppKey + CT
- HB = hmac.new(HMKey, message, hashlib.sha256).hexdigest()
- url = 'https://api.2ch.net/v1/auth/'
- values = {'ID' : '', 'PW' : '', 'KY' : AppKey, 'CT' : CT, 'HB' : HB }
- headers = { 'User-Agent' : '', 'X-2ch-UA': 'JaneStyle/3.80'}
- data = urllib.urlencode(values)
- req = urllib2.Request(url, data, headers)
- response = urllib2.urlopen(req)
- sid = response.read()
- sid = sid.split(':')[1]
- return sid
- def getDAT(serverName, boardName, threadId, sid):
- message = "/v1/" + serverName + "/" + boardName + "/" + threadId + sid + AppKey
- hobo = hmac.new(HMKey, message, hashlib.sha256).hexdigest()
- url = 'https://api.2ch.net/v1/' + serverName + "/" + boardName + "/" + threadId
- values = { 'sid' : sid, 'hobo' : hobo, 'appkey': AppKey }
- headers = { 'User-Agent' : 'Mozilla/3.0 (compatible; JaneStyle/3.80..)'}
- data = urllib.urlencode(values)
- req = urllib2.Request(url, data, headers)
- response = urllib2.urlopen(req)
- return response.read()
- sid = authenticate()
- dat = getDAT('anago', 'software', '1424327586', sid)
- print dat
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement