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
freedom16
V2EX  ›  Python

Python 新人求助 爬虫 b 站 offset 偏移量有什么规律

  •  1
     
  •   freedom16 · 2022-05-30 10:50:42 +08:00 · 3167 次点击
    这是一个创建于 706 天前的主题,其中的信息可能已经有所发展或是发生改变。
    我想爬取 bilibili 的主页中的动态页,但是他的偏移量肯定是有规律的,但是才疏学浅没看出规律来
    有没有大佬知道的,求解
    [![rbecGJ.png]( https://i.im.ge/2022/05/30/rbecGJ.png)]( https://im.ge/i/rbecGJ)
    610915518
        1
    610915518  
       2022-05-30 11:13:06 +08:00
    图裂了。一个 response data 里面包含是否有下个请求 has_more 和下一个请求的 offset
    learningman
        2
    learningman  
       2022-05-30 11:14:40 +08:00
    学一下常见的分页实现就明白了
    Eiden
        3
    Eiden  
       2022-05-30 11:19:56 +08:00
    上一次返回的
    Eiden
        4
    Eiden  
       2022-05-30 11:20:49 +08:00
    mekingname
        5
    mekingname  
       2022-05-30 11:58:35 +08:00
    第二个请求的 offset 来自于第一个请求返回的数据。第三次请求的 offset 来自于第二个请求返回的数据。
    freedom16
        6
    freedom16  
    OP
       2022-05-30 12:16:04 +08:00
    @Eiden 谢谢
    freedom16
        7
    freedom16  
    OP
       2022-05-30 12:17:32 +08:00
    @learningman 野路子,没接触过哈哈🤞
    freedom16
        8
    freedom16  
    OP
       2022-05-30 12:17:55 +08:00
    @mekingname 谢谢
    freedom16
        9
    freedom16  
    OP
       2022-05-30 12:18:10 +08:00
    @610915518 谢谢
    filwaline
        10
    filwaline  
       2022-05-31 13:51:34 +08:00 via Android
    这种分页叫 cursor pagination
    剩下的你去 Google 一下就都有了
    b 站不知道怎么给命名作 offset 了,可能是为了兼容?
    freedom16
        11
    freedom16  
    OP
       2022-05-31 15:34:45 +08:00
    @filwaline 我去看看,谢谢
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2468 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 15:38 · PVG 23:38 · LAX 08:38 · JFK 11:38
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.