请不要说硒。 这应该是一个简单的步骤。谢谢!
#usr/bin/python 3.6 on win10x64
from datetime import datetime
import json
import requests
current_time = datetime.datetime.now(datetime.timezone.utc)
url = 'https://api.nicehash.com/livePubJSON?l=0&a=07callback=superagentCallback'+str(round(int(current_time.timestamp()), 2)).replace('.','')
js_file = requests.get(url).json() #this is not correct, and also it will always send the 'livePubJSON.js' file
with open(r'C\Users\[myusername]\Downloads\livePubJson.js') as json_data: # being API file.js i would like to be replaced
d = json.load(json_data)
print(d)
请帮助我将其设为循环,因为它是一个API
节省时间: 响应是200,但我认为我需要标头HTTP错误403所以这里是我从youtube抓取的一些复制粘贴: 标题[' User-Agent'] =' Mozilla / 5.0(X11; Linux i868)AppleWebKit / 537.17(KHTML,与Gecko一样)Chrome / 24.0.1312.27 Safari / 537.17'
接下来是livePubJSON.js输出(来自浏览器UI)并且必须将其解析为JSON: superagentCallback1518811920564({" eu":{"有效":真,"更新":1518811927, " totalSpeed":6.6999,"命令":[[720747,1,1,2.3261,0.01,29,0.0105],...