Home > other >  Python crawler in json. The decoder. JSONDecodeError: Expecting value: line 1 column 1 0 (char)
Python crawler in json. The decoder. JSONDecodeError: Expecting value: line 1 column 1 0 (char)

Time:09-18


The problem, how to do??? O give advice or comments!!!!!!!!!!!

CodePudding user response:

You can have a try, look line not line, it is better to print and see what type of
 
Result=json. Loads (response. Content. decode (encoding='utf8'))

CodePudding user response:

fishing _ fishing in reference 1 floor response:
you can give it a try, look line not line, it is better to print and see what type of
 
Result=json. Loads (response. Content. decode (encoding='utf8'))

Ah! Okay, I see, first,

CodePudding user response:

fishing _ fishing in reference 1 floor response:
you can give it a try, look line not line, it is better to print and see what type of
 
Result=json. Loads (response. Content. decode (encoding='utf8'))

No way! Saying is wrong name, the name 'json' is not defined

CodePudding user response:

Did you import json

CodePudding user response:

fishing _ fishing in reference 4 floor response:
did you import json

Import, according to print the result, but the error is unexpected utf-8 bom

CodePudding user response:

You change the utf8 to utf-8 sig - try it?

CodePudding user response:

refer to 6th floor is fishing in _ fishing response:
you make utf8 into utf-8 - try a sig?

Error, also became the original json. The decoder. JSONDecodeError: Expecting value: line 1 column 1 0 (char)

CodePudding user response:

The requested url you send me I try

CodePudding user response:

refer to the eighth floor is fishing in _ fishing response:
the requested url you sent to me I try

https://kyfw.12306.cn/otn/leftTicket/queryZ? LeftTicketDTO. Train_date=2020-01-13 & amp; LeftTicketDTO. From_station=BJP& LeftTicketDTO. To_station=SHH& Purpose_codes=ADULT

CodePudding user response:

Do you want to get the page?
Direct
 
Res_html=res. Content. decode (encoding="utf-8")
# or
Res_html - res. Text

Print (res_html)

CodePudding user response:

The
it is reference to the tenth floor fishing _ fishing in reply:
do you want to get the page?
Direct
 
Res_html=res. Content. decode (encoding="utf-8")
# or
Res_html - res. Text

Print (res_html)

Not,, the first two pictures, I am read the book from entry to master pythob video learning, but that person dozen of code, there is no error, I have an error, is also the first figure that code, but run his didn't make a mistake, I have an error

CodePudding user response:

The
it is reference to the tenth floor fishing _ fishing in reply:
do you want to get the page?
Direct
 
Res_html=res. Content. decode (encoding="utf-8")
# or
Res_html - res. Text

Print (res_html)

Not,, the first two pictures, I am read the book from entry to master pythob video learning, but that person dozen of code, there is no error, I have an error, is also the first figure that code, but run his didn't make a mistake, I have an error

CodePudding user response:

The
it is reference to the tenth floor fishing _ fishing in reply:
do you want to get the page?
Direct
 
Res_html=res. Content. decode (encoding="utf-8")
# or
Res_html - res. Text

Print (res_html)

Not, the first two pictures, I am read the book from entry to master pythob video learning, but that person dozen of code, there is no error, I have an error, is also the first figure that code, but run his didn't make a mistake, I have an error

CodePudding user response:

Requested url you have any question, just return an HTML, rather than a json format data


CodePudding user response:

reference 14 floor is fishing in _ fishing reply:
the requested url you have any question, just return an HTML, rather than a json format data



Firefox browser can open! The video explainer is to use firefox

CodePudding user response:

reference 14 floor is fishing in _ fishing reply:
the requested url you have any question, just return an HTML, rather than a json format data



Firefox browser can open! The video is to use firefox

CodePudding user response:

reference 14 floor is fishing in _ fishing reply:
the requested url you have any question, just return an HTML, rather than a json format data



Firefox browser can open! The video is to use firefox

CodePudding user response:

I can't open here
You print directly the response. The text
See if the content of a web

CodePudding user response:

You got a less cookies
 
The import requests, the random
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related