Skip to content

Instantly share code, notes, and snippets.

@linzino7
Created May 27, 2017 07:33
Show Gist options
  • Save linzino7/918ee208c8956debc8b28840aa253a2a to your computer and use it in GitHub Desktop.
Save linzino7/918ee208c8956debc8b28840aa253a2a to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 13 17:13:17 2017
@author: goingcosme20
"""
import sys
import json
import requests
import time
import urllib
urll='【現貨火速寄出】白色戀人系列12入白巧-18入白巧-18入黑巧-24入綜合-24入白巧-薯條三兄弟-薯塊三姐妹-i.6907444.62367023'
my_headers = {'User-Agent' : 'googlebot',
'x-csrftoken': 'UENMnuj4tIa72LuwlO7D7PLzn6MlxhAP',# 必要
'Referer': 'https://shopee.tw/'+urllib.quote(urll),# 必要
'Cookie': '_ga=GA1.2.1247197043.1489384648; _gat=1; csrftoken=UENMnuj4tIa72LuwlO7D7PLzn6MlxhAP'# 必要
}
url = 'https://shopee.tw/api/v1/shops/'
payload = {"shop_ids":[6907444]}
r = requests.post(url, data=json.dumps(payload), headers = my_headers)
#r.encoding = 'utf-8'
#print(r.text)
#sys.exit()
st= r.text.replace("\\n","^n")
st=st.replace("\\t","^t")
print st.decode('unicode_escape')
#print r.status_code
#print r.headers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment