Home > other >  I use requests module crawl douban top250 garbled words
I use requests module crawl douban top250 garbled words

Time:10-06

I use requests module crawl douban top250 garbled words I see page encoding is utf-8 I set is utf-8 why will the code I use requests module crawl douban top250 garbled words I see page encoding is utf-8 I set is utf-8 why would stil




CodePudding user response:

Is the code to see your source code files, web page source file, the response set, if the print output console are unified coding

CodePudding user response:

Response. Apparent_encoding # to check the web page code
You question which should be their terminal code set is a Linux terminal?

CodePudding user response:

Windows PCS GBK

CodePudding user response:

Why didn't I have the code
 import requests 

Url="https://movie.douban.com/top250? Start=0 & amp; The filter='
Headers={' the user-agent ':' Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Safari 537.36/Core/1.70.3756.400 QQBrowser/10.5.4039.400 '}
The response=requests. Get (url=url, headers=headers)
Print (response. The text)

Results:

CodePudding user response:

Your output utf-8?

CodePudding user response:

I have been to this problem, I keep only in the request header "the user-agent" : "Mozilla/5.0 (Windows NT 10.0; Win64. X64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36 "this one, the output is normal,
  • Related