+75
@@ -0,0 +1,75 @@
|
||||
import requests
|
||||
import json
|
||||
print("begin")
|
||||
|
||||
|
||||
|
||||
f1=open("database/switch_1688043588.json",'r',encoding='utf8')
|
||||
j_ima=json.loads(f1.read())
|
||||
|
||||
f=open("NS_temp1.json",'r',encoding='utf8')
|
||||
jsdata=json.loads(f.read())
|
||||
items=[]
|
||||
for i in range(259):
|
||||
jstemp={}
|
||||
jstemp['platform']=jsdata[str(i)]['type']
|
||||
jstemp['SUK']=jsdata[str(i)]['SUK']
|
||||
jstemp['salestart']=jsdata[str(i)]['salestart']
|
||||
|
||||
jstemp['mainphoto']="images/"+j_ima['item_list'][i]['main_photo']
|
||||
|
||||
|
||||
i_name=[]
|
||||
i_name_temp={}
|
||||
if jsdata[str(i)]['ZH'] != " ":
|
||||
i_name_temp['region']="ZH"
|
||||
i_name_temp['name']=jsdata[str(i)]['ZH']
|
||||
i_name.append(i_name_temp)
|
||||
i_name_temp={}
|
||||
if jsdata[str(i)]['EN'] != " ":
|
||||
i_name_temp['region']="EN"
|
||||
i_name_temp['name']=jsdata[str(i)]['EN']
|
||||
i_name.append(i_name_temp)
|
||||
i_name_temp={}
|
||||
if jsdata[str(i)]['JP'] != " ":
|
||||
i_name_temp['region']="JP"
|
||||
i_name_temp['name']=jsdata[str(i)]['JP']
|
||||
i_name.append(i_name_temp)
|
||||
i_name_temp={}
|
||||
if "HK" in jsdata[str(i)]:
|
||||
i_name_temp['region']="HK"
|
||||
i_name_temp['name']=jsdata[str(i)]['HK']
|
||||
i_name.append(i_name_temp)
|
||||
|
||||
bb=0
|
||||
cc={}
|
||||
for aa in i_name:
|
||||
cc[str(bb)]=aa
|
||||
bb+=1
|
||||
jstemp['names']=json.dumps(i_name,ensure_ascii=False,)
|
||||
|
||||
|
||||
i_tag=[]
|
||||
if jsdata[str(i)]['TAG1'] != " ":
|
||||
i_tag.append(jsdata[str(i)]['TAG1'])
|
||||
if jsdata[str(i)]['TAG2'] != " ":
|
||||
i_tag.append(jsdata[str(i)]['TAG2'])
|
||||
if jsdata[str(i)]['TAG3'] != " ":
|
||||
i_tag.append(jsdata[str(i)]['TAG3'])
|
||||
|
||||
jstemp['tags']=json.dumps(i_tag,ensure_ascii=False)
|
||||
items.append(jstemp)
|
||||
|
||||
#print(items[0])
|
||||
|
||||
url='http://beta.lmve.net/index.php?app=pricetrend&ac=do&ts=add_item'
|
||||
|
||||
|
||||
for i in items:
|
||||
file={
|
||||
"mainphoto":open(i['mainphoto'],'rb')
|
||||
}
|
||||
r=requests.post(url,i,files=file)
|
||||
if(r.status_code==200):
|
||||
htmlx=r.text
|
||||
print(htmlx)
|
||||
Reference in New Issue
Block a user