Ger2EX
V2EX  ›  Bash

# [求助] 用 curl 抓取一个网站,网站有很多分页,但不论怎么指 page=[2-100],抓取的都只是 page=1 的内容...

  •  
  •   Ger2EX · Aug 10, 2018 · 6434 views
    This topic created in 2832 days ago, the information mentioned may be changed or developed.

    本人用 curl 抓取http://www.gmkfreefonts.com/index.php?letter=a&page=3&res=12内容; 但返回的始终是http://www.gmkfreefonts.com/index.php?letter=a&page=1&res=12的内容;

    浏览器 http://www.gmkfreefonts.com/index.php?letter=a&page=3&res=12 可以直接跳转到 page3

    curl -s http://www.gmkfreefonts.com/index.php?letter=a&page=3&res=12
    

    小白整了一晚也没整明白,请高手指点 1-2,谢谢!

    5 replies    2018-08-10 10:56:15 +08:00
    zhu
        1
    zhu  
       Aug 10, 2018
    & 在命令行是特殊字符。

    你需要修改为:
    curl -s "http://www.gmkfreefonts.com/index.php?letter=a&page=3&res=12"
    beaconfire
        2
    beaconfire  
       Aug 10, 2018
    引号了解一下?
    iwishing
        3
    iwishing  
       Aug 10, 2018
    内容都在 index.php 里面了呀
    比方 aajaxsurrealfreak 字体,在第一页的第一个
    你在第三页的源文件里也能搜到
    presoul
        4
    presoul  
       Aug 10, 2018 via Android
    可以直接 f12 里面 copy as bash url
    Ger2EX
        5
    Ger2EX  
    OP
       Aug 10, 2018
    谢谢各位! OK
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1199 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 23:23 · PVG 07:23 · LAX 16:23 · JFK 19:23
    ♥ Do have faith in what you're doing.