Skip to content

Instantly share code, notes, and snippets.

@zxmLoveLife
Created January 29, 2014 02:13
Show Gist options
  • Save zxmLoveLife/8680596 to your computer and use it in GitHub Desktop.
Save zxmLoveLife/8680596 to your computer and use it in GitHub Desktop.
import requests,os,re,string,json
from pyquery import PyQuery as pq
base_dir = os.getcwd()
url = 'http://www.share-byte.net/8LQZ84'
ses = requests.Session()
req = ses.get(url)
d = pq(req.text)
script = d('#downloadFile').prev('script').text()
t0 = re.findall(r"t\[0\] = \"(\w*)\"",script)
t1 = re.findall(r"t\[1\] = \"(\w*)\"",script)
params = {'s' : t1[0], 'k' : t0[0]}
headers = req.headers
headers['content-type'] = 'application/x-www-form-urlencoded'
r = ses.post('http://cdn.share-byte.net/d.php',data=json.dumps(params),cookies = req.cookies,headers=headers)
fp = open(base_dir+'/tmp.rar','w')
fp.write(r.content)
fp.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment