search

Home  >  Q&A  >  body text

如何利用python爬虫提交json数据

如题,目标是不需要POST的站点,已经按照抓包的结果伪装成了浏览器,似乎还少了点什么,抓包数据里面有发现JSON数据,感觉是因为这个原因,但是我不明白要如何正确提交,所以收到的是乱码字符或者是不完整的页面源码。我用浏览器获取了网页源代码做了比较确实不完整,爬虫只拿到了头部和尾部。不用管AJAX,因为就连摘取到的第一页的内容都是不完整的。

PHPzPHPz2888 days ago499

reply all(3)I'll reply

  • 黄舟

    黄舟2017-04-17 17:34:51

    Go to the json request and just grab the data of that request

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 17:34:51

    You provided too little information. . .

    1. What on earth do you want to do? Are you submitting a GET request? (You are talking about a site without POST)

    2. Which library are you using? urllib.request?

    3. Under what circumstances do you receive garbled characters? What kind of garbled code? When do you receive incomplete source code? How do you know the source code is incomplete?

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-17 17:34:51

    Is the content you want to crawl loaded through AJAX? From your description, it seems that what you want is not in html, but you found it in json.

    reply
    0
  • Cancelreply