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

python 微博爬虫

  •  
  •   armorsmith · 2016-12-04 17:09:00 +08:00 · 3751 次点击
    这是一个创建于 2693 天前的主题,其中的信息可能已经有所发展或是发生改变。

    初学 python

    在试着写微博的爬虫,然后发现网页版贼难爬,就打算对手机版下手。
    因为我是百度链接跳进去的,所以我想问问大佬们有没有什么办法可以直接返回跳转后 url 里的参数啊
    那个 id 正好就能构造手机版的 url
    
    17 条回复    2016-12-26 13:03:03 +08:00
    armorsmith
        1
    armorsmith  
    OP
       2016-12-04 17:29:35 +08:00
    嗯,在 js 脚本里找到了 id 了,但是登陆还是得登陆。。。我去想想怎么构造 headers
    xiandao7997
        2
    xiandao7997  
       2016-12-04 17:39:35 +08:00 via Android
    用 API 不好吗
    armorsmith
        3
    armorsmith  
    OP
       2016-12-04 18:00:38 +08:00
    因为是想做一个定向社工的工具,先调用搜索引擎,再进各个 SNS 爬记录,爬虫会很小,就没考虑 api
    mazyi
        4
    mazyi  
       2016-12-04 19:57:16 +08:00
    登陆的密码那里有坑,小心
    scola
        5
    scola  
       2016-12-05 08:10:01 +08:00
    我爬过, 用 pyspider 直接爬网页版, 不用登录
    holajamc
        6
    holajamc  
       2016-12-06 09:16:41 +08:00
    一些 app 的 ua 可以少很多验证
    zhifubao
    armorsmith
        7
    armorsmith  
    OP
       2016-12-06 20:23:52 +08:00
    @mazyi 正在尝试模拟登陆...很好奇为啥 cookie 解决不了,还是我太菜了...
    armorsmith
        8
    armorsmith  
    OP
       2016-12-06 20:24:39 +08:00
    @scola 因为是练手项目所以打算慢慢撸
    armorsmith
        9
    armorsmith  
    OP
       2016-12-06 20:39:31 +08:00
    @holajamc zhifubao 啊 spider 啊这样的还是会被新浪拦住的


    urllib2.HTTPError: HTTP Error 403: Forbidden
    holajamc
        10
    holajamc  
       2016-12-07 00:28:42 +08:00 via iPhone
    @armorsmith 这个是可以的,可以看看其他和新浪有合作的公司。。。不能说太多了。。。一个朋友告诉我的
    jelinet
        11
    jelinet  
       2016-12-07 16:34:00 +08:00
    刚刚做了微博的模拟登录。 lz 有啥问题可以直接抛出来。
    jelinet
        12
    jelinet  
       2016-12-07 16:35:41 +08:00
    @holajamc 还是想知道。。。其实就是要走商业合作这条路?
    armorsmith
        13
    armorsmith  
    OP
       2016-12-07 20:09:55 +08:00
    @holajamc 那我多试试别的 uaQAQ
    armorsmith
        14
    armorsmith  
    OP
       2016-12-07 20:15:41 +08:00
    @jelinet 膜拜大佬,我用谷歌浏览器开隐私模式就会发现微博可以不登陆就看嘛,就是先会被定位到 sina visitor system 然后再回首页。但是我就是总被拦在 sina visitor system 里, headers 设置了很多次了还是出不去。求教正确进入姿势....
    holajamc
        15
    holajamc  
       2016-12-08 09:52:40 +08:00
    @jelinet 是啊,商业合作的,这个是确认的
    scriptkid
        16
    scriptkid  
       2016-12-16 10:17:25 +08:00
    前段时间无聊撸了个帐号密码登录(暂不支持登录验证码)加上天气 API ,每天自动发送天气预报微博。
    脚本登录的话还是比较简单的,后面想着再加上微博各种基本功能(转发、回复、关注什么的),不过懒而且没什么时间一直拖着。。。欢迎交流
    armorsmith
        17
    armorsmith  
    OP
       2016-12-26 13:03:03 +08:00
    微博卡住没动,撸了个贴吧的,输入 qq 手机或者类似信息,返回疑似用户,选择是否爬取该用户所有发言。期末渡劫,寒假再继续,占个坑。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2713 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 02:02 · PVG 10:02 · LAX 19:02 · JFK 22:02
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.