Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

json.decoder.JSONDecodeError json解析出错 #165

Closed
sugdove opened this issue Dec 25, 2020 · 2 comments
Closed

json.decoder.JSONDecodeError json解析出错 #165

sugdove opened this issue Dec 25, 2020 · 2 comments

Comments

@sugdove
Copy link

sugdove commented Dec 25, 2020

\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)。
目测是京东接口变了?json解析失败了,有朋友解决了吗

@sugdove sugdove closed this as completed Dec 25, 2020
@sugdove sugdove reopened this Dec 25, 2020
@sugdove sugdove closed this as completed Dec 25, 2020
@postunit
Copy link

呵呵呵,接近一年前的源码都拿去抢茅台?京东的接口不说一年变多少次,一个月都变N次。别人技术人员又不是吃白饭的,羊毛党也是需要成长的。

@cuge1995
Copy link

simple code to solve this

url = 'https://a.jd.com//ajax/queryServerData.html'
ret = requests.get(url).text
filename = 'timm.txt'
with open(filename, "w") as file:
    file.write(ret)

with open(filename, "r") as file:
    for line in file:
        if "serverTime" in line:
            print(line)
            date_str = line[43:62]

date_format = "%Y/%m/%d %H:%M:%S"
datetime_obj = datetime.datetime.strptime(date_str, date_format)

timestamp = int(datetime_obj.timestamp() * 1000)
print(timestamp)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants