V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
zhengfan2016
V2EX  ›  Python

有大神研究过 36kr 的视频栏目接口吗?

  •  
  •   zhengfan2016 · 2020-05-02 12:40:07 +08:00 · 3161 次点击
    这是一个创建于 1456 天前的主题,其中的信息可能已经有所发展或是发生改变。

    这个接口也是没找到和 page 有关的参数,我大概猜和 pagecallback 有关 JvpCqS.png 于是我从 36kr 的 html 里抓出 pagecallback 的值,加进 post 请求,header 只加了 ua JvpIij.png 然后,接口提示我没加 contenttype,我大喜,离成功仅一步之遥,把 contenttype 加上,却没有返回我想要的东西, 然后,我把 header 能加的都加了,还是不行,就返回一个 tomcat 的网页 JvpjwF.png 求大神指点一二

    7 条回复    2020-10-29 09:36:57 +08:00
    hlwjia
        1
    hlwjia  
       2020-05-02 12:59:55 +08:00
    你这是要爬遍中文科技媒体

    pingwest, ifanr 下周预告
    zhengfan2016
        2
    zhengfan2016  
    OP
       2020-05-02 13:03:03 +08:00
    @hlwjia 😂我只是想做一个它们的 kodi 插件,方便在电视上用遥控器看视频
    V2tizen
        3
    V2tizen  
       2020-05-02 16:07:33 +08:00   ❤️ 1
    data = json.dumps(d) 试试
    zhengfan2016
        4
    zhengfan2016  
    OP
       2020-05-02 16:38:22 +08:00
    @V2tizen 卧槽,成功了,谢谢大神!
    ClericPy
        5
    ClericPy  
       2020-05-02 18:28:23 +08:00   ❤️ 1
    pageCallback 是个 base64, 解码就明白什么规则了, 总体不是太复杂吧, 翻页就是通过这参数搞的

    {"firstId":2918165,"lastId":2916690,"firstCreateTime":1588221046000,"lastCreateTime":1588136451000}

    {"firstId":2919576,"lastId":2918231,"firstCreateTime":1588413629000,"lastCreateTime":1588224626000}

    怎么抓一个问一个... 如果不擅长 js 什么的, 不如考虑直接 Headless chrome 算了......
    mousenonng
        6
    mousenonng  
       2020-05-03 01:02:52 +08:00   ❤️ 1
    请求类型是 application/json 的你要将 dict 转换为 json 对象在去请求,更方便的是 json=d 。如果是表单格式的就直接用 data=d,
    GeorzGO
        7
    GeorzGO  
       2020-10-29 09:36:57 +08:00
    博主解决这个问题了吗?我想爬它的资讯信息,但最近也是卡这一步不知道翻页参数在哪里看,pagecallback 解码了之后是有一些字段信息,但看不懂,不知道用了什么黑科技。博主要是解决了一定 ballball 我啊😭
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1248 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 23:44 · PVG 07:44 · LAX 16:44 · JFK 19:44
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.