I get translated text when I do a GET request (in Python). How to get English content?

后端 未结 1 1898
北海茫月
北海茫月 2021-01-23 02:39

I\'m trying to web scrape this page for fun.

The script is working fine, but the names of some movies are translated into Romanian (for example, \"B

相关标签:
1条回答
  • 2021-01-23 03:29

    I guess this site is serving pages based on browser language. Try to set it on requests:

    import requests
    
    url = r"http://www.imdb.com/search/title?release_date=2017&page=1&ref_=adv_nxt"
    headers = {"Accept-Language": "en-US,en;q=0.5"}
    r = requests.get(url, headers=headers)
    

    By the way. Check imdb web scrape's policy.

    0 讨论(0)
提交回复
热议问题