V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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
LeCent
V2EX  ›  Python

像这样的文章要怎么爬取?

  •  
  •   LeCent · Jul 4, 2018 · 2741 views
    This topic created in 2859 days ago, the information mentioned may be changed or developed.

    Snipaste_2018-07-04_20-46-21.png

    右上选择月份,显示该月份的最后一篇,然后往前翻

    http://www.sandeechan.com/blog/?m=200707

    3 replies    2018-07-05 10:37:28 +08:00
    DrSpencerReid
        1
    DrSpencerReid  
       Jul 5, 2018
    看 url 也能看出来怎么抓了。。。。。。http://www.sandeechan.com/blog/?m=200707&paged=3
    liuguichao
        2
    liuguichao  
       Jul 5, 2018
    定位 html 标记,使用 xpath 提取 option value。

    <select id="archives-dropdown-2" name="archive-dropdown" onchange="document.location.href=this.options[this.selectedIndex].value;">

    <option value="">選擇月份</option>
    <option value="http://www.sandeechan.com/blog/?m=201103"> 2011 年 三月 &nbsp;(31)</option>
    <option value="http://www.sandeechan.com/blog/?m=201102"> 2011 年 二月 &nbsp;(28)</option>
    <option value="http://www.sandeechan.com/blog/?m=201101"> 2011 年 一月 &nbsp;(31)</option>
    <option value="http://www.sandeechan.com/blog/?m=201012"> 2010 年 十二月 &nbsp;(31)</option>

    </select>
    RicardoScofileld
        3
    RicardoScofileld  
       Jul 5, 2018
    直接从页面固定位置获取下一页的 url 不就好了吗,然后接着请求下一页
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   854 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 48ms · UTC 22:56 · PVG 06:56 · LAX 15:56 · JFK 18:56
    ♥ Do have faith in what you're doing.