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

Scrapy抓取网页时,内容出现截断,求解

  •  
  •   best1a · 2013-05-06 02:06:29 +08:00 · 3825 次点击
    这是一个创建于 4026 天前的主题,其中的信息可能已经有所发展或是发生改变。
    在抓取京东的评论的时候,会经常出现截断
    比如http://club.jd.com/review/851542-0-2-0.html

    用scrapy shell "http://club.jd.com/review/851542-0-2-0.html"
    查看response.body时发现被奇怪地截断了,而用wget网页下来是没问题的,应该不会是被反爬虫了
    在此,求解。。。。
    4 条回复    1970-01-01 08:00:00 +08:00
    best1a
        1
    best1a  
    OP
       2013-05-06 02:10:11 +08:00 via Android
    。。。。找了一个多小时找不到解决方案,各种蛋疼
    gamexg
        2
    gamexg  
       2013-05-06 08:18:09 +08:00   ❤️ 1
    抓包
    gamexg
        3
    gamexg  
       2013-05-06 08:20:17 +08:00   ❤️ 1
    对了,设http头伪装成浏览器试一下。
    best1a
        4
    best1a  
    OP
       2013-05-06 09:17:51 +08:00
    @gamexg 因为wget没问题,我直接排除了这种可能,不过还是试了一下,发现还是不行

    抓包发现scrapy发出的http请求是1.0的,改成了1.1就好了,不明所以...没时间找原因了,- -赶快做毕设去。。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3627 人在线   最高记录 6547   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 00:05 · PVG 08:05 · LAX 17:05 · JFK 20:05
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.