All Projects → nghuyong → Weibospider

nghuyong / Weibospider

Licence: mit
This is a sina weibo spider built by scrapy [微博爬虫/持续维护]

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Weibospider

Weibospider
⚡ A distributed crawler for weibo, building with celery and requests.
Stars: ✭ 4,670 (+93.94%)
Mutual labels:  sina, weibo, weibospider
Awesome crawl
腾讯新闻、知乎话题、微博粉丝,Tumblr爬虫、斗鱼弹幕、妹子图爬虫、分布式设计等
Stars: ✭ 246 (-89.78%)
Mutual labels:  scrapy, redis, weibo
Jadedock
使用 Docker 快速部署简易的 Ngixn + PHP + MySQL + Redis 环境(可开发、可线上运行)
Stars: ✭ 109 (-95.47%)
Mutual labels:  redis, docker-compose
User.api
集成网关、身份认证、Token授权、微服务、.netcore等的基于CQRS的微服务开发框架示例
Stars: ✭ 109 (-95.47%)
Mutual labels:  redis, docker-compose
Sinaweibo Emotion Classification
新浪微博情感分析应用
Stars: ✭ 118 (-95.1%)
Mutual labels:  sina, weibo
Sci Pype
A Machine Learning API with native redis caching and export + import using S3. Analyze entire datasets using an API for building, training, testing, analyzing, extracting, importing, and archiving. This repository can run from a docker container or from the repository.
Stars: ✭ 90 (-96.26%)
Mutual labels:  redis, docker-compose
Docker Laravel
🐳 Docker Images for Laravel development
Stars: ✭ 101 (-95.81%)
Mutual labels:  redis, docker-compose
Weibo hot search
微博爬虫:每天定时爬取微博热搜榜的内容,留下互联网人的记忆。
Stars: ✭ 113 (-95.31%)
Mutual labels:  scrapy, weibo
Capturer
capture pictures from website like sina, lofter, huaban and so on
Stars: ✭ 76 (-96.84%)
Mutual labels:  sina, scrapy
Express Mongodb Rest Api Boilerplate
A boilerplate for Node.js apps / Rest API / Authentication from scratch - express, mongodb (mongoose).
Stars: ✭ 153 (-93.65%)
Mutual labels:  redis, docker-compose
Datamining And Social Sentiment Analysis Based On Weibo
基于微博的数据挖掘与社交舆情分析
Stars: ✭ 149 (-93.81%)
Mutual labels:  scrapy, redis
Fastapi Celery
Minimal example utilizing fastapi and celery with RabbitMQ for task queue, Redis for celery backend and flower for monitoring the celery tasks.
Stars: ✭ 154 (-93.6%)
Mutual labels:  redis, docker-compose
Docker Django Example
A production ready example Django app that's using Docker and Docker Compose.
Stars: ✭ 86 (-96.43%)
Mutual labels:  redis, docker-compose
Mechanist
[Docker] - The Mechanist is a collection of Dockerfiles and Composefiles for various tools and purposes.
Stars: ✭ 86 (-96.43%)
Mutual labels:  redis, docker-compose
Wecase
The Linux Sina Weibo Client
Stars: ✭ 108 (-95.51%)
Mutual labels:  sina, weibo
Docker Superset
Repository for Docker Image of Apache-Superset. [Docker Image: https://hub.docker.com/r/abhioncbr/docker-superset]
Stars: ✭ 86 (-96.43%)
Mutual labels:  redis, docker-compose
Netpro
🌈An enhanced version of asp.netcore,Support for netcore3.1
Stars: ✭ 112 (-95.35%)
Mutual labels:  redis, docker-compose
Docker Flask Celery Redis
Docker-Compose template for orchestrating a Flask app with a Celery queue using Redis
Stars: ✭ 165 (-93.15%)
Mutual labels:  redis, docker-compose
Django Channels React Multiplayer
turn based strategy game using django channels, redux, and react hooks
Stars: ✭ 52 (-97.84%)
Mutual labels:  redis, docker-compose
Docker Magento Mutagen
Mage2click Docker-based development environment for Magento with mutagen.io sync for files on macOS
Stars: ✭ 64 (-97.34%)
Mutual labels:  redis, docker-compose

中文说明 | English

WeiboSpider

GitHub stars GitHub issues GitHub license

持续维护的新浪微博爬虫🚀🚀🚀

UPDATE: weibo.cn的关键词搜索接口已失效(2021.6.6)

项目说明

版本说明

该项目分为2个分支,以满足不同的需要

分支 特点 抓取量
master 单账号,单IP,单机器 十万级
senior 账号池,IP池,Docker分布式 数亿级(理论无上限)

支持爬虫

  • 用户信息抓取
  • 用户微博抓取(全量/指定时间段)
  • 用户社交关系抓取(粉丝/关注)
  • 微博评论抓取
  • 基于关键词和时间段(粒度到小时)的微博抓取
  • 微博转发抓取

字段说明

项目基于weibo.cn站点抓取,抓取的字段非常丰富。具体请移步:数据字段说明

如何使用

拉取项目 && 安装依赖

本项目Python版本为Python3.6

git clone [email protected]:nghuyong/WeiboSpider.git --depth 1 --no-single-branch
cd WeiboSpider
pip install -r requirements.txt

除此之外,还需要安装mongodb.

替换Cookie

访问https://weibo.cn/

登陆账号,打开浏览器的开发者模式,再次刷新

复制weibo.cn这个数据包,network中的cookie值

weibospider/settings.py中:

DEFAULT_REQUEST_HEADERS = {
    'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:61.0) Gecko/20100101 Firefox/61.0',
    'Cookie':'SCF=AlvwCT3ltiVc36wsKpuvTV8uWF4V1tZ17ms9t-bZCAuiVJKpCsgvvmSdylNE6_4GbqwA_MWvxNgoc0Ks-qbZStc.; OUTFOX_SEARCH_USER_ID_NCOO=1258151803.428431; SUB=_2A25zjTjHDeRhGeBN6VUX9SvEzT-IHXVQjliPrDV6PUJbkdANLUvskW1NRJ24IEPNKfRaplNknl957NryzKEwBmhJ; SUHB=0ftpSdul-YZaMk; _T_WM=76982927613'
}

Cookie字段替换成你自己的Cookie

如果爬虫运行出现403/302,说明账号被封/cookie失效,请重新替换cookie

添加代理IP(可选)

重写fetch_proxy方法,该方法需要返回一个代理ip

运行程序

可根据自己实际需要重写./weibospider/spiders/*中的start_requests函数

抓取用户信息

cd weibospider
python run_spider.py user

抓取用户粉丝列表

python run_spider.py fan

抓取用户关注列表

python run_spider.py follow

抓取微博评论

python run_spider.py comment

抓取用户的微博(全量)

./weibospider/spiders/tweet.pystart_requests,urls选择init_url_by_user_id()

python run_spider.py tweet

抓取用户的微博(指定时间段)

./weibospider/spiders/tweet.pystart_requests,urls选择init_url_by_user_id_and_date()

python run_spider.py tweet

抓取包含关键词的微博(已失效)

./weibospider/spiders/tweet.pystart_requests,urls选择init_url_by_keywords_and_date()

python run_spider.py tweet

抓取微博转发

python run_spider.py repost

写在最后

基于该项目已经构建千万级别的微博活跃用户数据集,以及海量的微博舆情数据集,现已公开weibo-public-opinion-datasets

如果您在使用该项目中有任何问题,均可以开issue进行讨论

如果您在社交媒体计算/舆情分析等领域上有好的idea,欢迎一起交流合作: [email protected]

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].