推荐学习书目
› 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
fan2006
V2EX  ›  Python

这个产品图片怎么爬下来?

  •  
  •   fan2006 · Dec 26, 2018 · 5911 views
    This topic created in 2871 days ago, the information mentioned may be changed or developed.
    如: https://mall.icbc.com.cn/products/pd_0001381554.jhtml 这个产品左边的 5 个大图。得到图片的链接用浏览器试总会跳转到主页去了。不知道怎么处理?希望能指点一下。
    25 replies  •  2018-12-26 17:03:23 +08:00
    python8215
    python8215
    Dec 26, 2018
    1
    https://image5.mall.icbc.com.cn/oaasImage/10023640/3/1542861223648_3.jpg 测试这个链接是可以直接用浏览器访问的,没有发生跳转的情况
    fan2006
    fan2006
    OP
    Dec 26, 2018
    2
    如得到
    @python8215 这个你在网页源代码那里点击可以打开。但是你得到单独的图片地址就不行了。会发生跳转。
    1daydayde
    1daydayde
    Dec 26, 2018 via iPhone
    3
    加 referer
    bruce00
    bruce00
    Dec 26, 2018
    5
    @bruce00 额。。好像真的会跳转
    glaucus
    glaucus
    Dec 26, 2018
    7
    把你发出来的这个链接当作 Referer 请求就可以了
    MuscleOf2016
    MuscleOf2016
    Dec 26, 2018
    8
    @fan2006 没看明白这句话,图片的链接不是.jpg 的吗
    masker
    masker
    Dec 26, 2018 via Android
    9
    看请求头
    fan2006
    fan2006
    OP
    Dec 26, 2018
    10
    @bruce00 没发出链接。只发了主地址。。好了,我被 360 浏览器坑了。。用 google 测试下能打开了。。
    fan2006
    fan2006
    OP
    Dec 26, 2018
    11
    @MrUser 多谢老兄。我知道了。非常感谢
    fan2006
    fan2006
    OP
    Dec 26, 2018
    12
    @bruce00 别用 360 浏览器测试,我被坑了
    a226679594
    a226679594
    Dec 26, 2018
    13
    我怀疑你在发广告 手动滑稽
    fan2006
    fan2006
    OP
    Dec 26, 2018
    14
    @a226679594 真没有。现在是年底,忙着搞数据呢?卖的多也是累死我们这些汇总产品的吧。
    tutustream
    tutustream
    Dec 26, 2018
    15
    chrome 没跳转
    winterx
    winterx
    Dec 26, 2018
    16
    我的 Chrome 跳转了
    inwl
    inwl
    Dec 26, 2018
    17
    @winterx 我的 chrome 也跳转了
    inwl
    inwl
    Dec 26, 2018
    18
    @fan2006
    @tutustream
    图片链接跳转,感觉是后台做了权限控制吧,不跳转的我猜登陆了?
    fan2006
    fan2006
    OP
    Dec 26, 2018
    19
    @inwl 可能你版本比较老。360 用 63 的内核是跳转的。。
    run2
    run2
    Dec 26, 2018
    20
    #3 楼那位就给你们正确答案了 不知道你们还在瞎猜啥
    celeron533
    celeron533
    Dec 26, 2018
    21
    https://image5.mall.icbc.com.cn/image/10023640/4/1524359627669_3.jpg

    直接 F12,禁用缓存,抓取网络请求。重新刷新页面就能得到地址。
    fan2006
    fan2006
    OP
    Dec 26, 2018
    22
    @celeron533 正解。这个是对的。感谢大佬
    lanqing
    lanqing
    Dec 26, 2018
    23
    加 referer 就可以了
    qooder
    qooder
    Dec 26, 2018
    24
    想知道为什么会跳转。。。
    15399905591
    15399905591
    Dec 26, 2018
    25
    应该是加了防盗链限制,只允许来源 mall.icbc.com.cn 域名的地址访问,你把在 header 中添加一个 referer 属性,标识来源的是该域名就可以了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1272 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 46ms · UTC 20:31 · PVG 04:31 · LAX 12:31 · JFK 15:31
    ♥ Do have faith in what you're doing.