Skip to main content

一个先进的 Twitter 抓取和 OSINT 工具。

项目描述

TWINT - Twitter 情报工具

2 3

派皮 构建状态 Python 3.6|3.7|3.8 GitHub 许可证 下载 下载 帕特伦

没有认证。没有 API。无限。

Twint 是一个用 Python 编写的高级 Twitter 抓取工具,它允许在使用 Twitter 的 API 的情况下从 Twitter 个人资料中抓取推文。

Twint 利用 Twitter 的搜索运算符让您从特定用户那里抓取推文,抓取与某些主题、主题标签和趋势相关的推文,或者从推文中整理出敏感信息,例如电子邮件和电话号码。我觉得这很有用,你也可以用它来发挥创意。

Twint 还对 Twitter 进行特殊查询,允许您在没有任何身份验证、API、Selenium 或浏览器仿真的情况下抓取 Twitter 用户的关注者、用户喜欢的推文以及他们关注的人。

tl;博士的好处

使用 Twint 与 Twitter API 的一些好处:

  • 可以获取几乎所有推文(Twitter API 限制为最后 3200 条推文);
  • 快速初始设置;
  • 可以匿名使用,无需注册 Twitter;
  • 没有速率限制

Twitter 施加的限制

Twitter 在浏览用户时间轴时限制滚动。这意味着与您一起.Profile或与.Favorites您一起将能够获得约 3200 条推文。

要求

  • 蟒蛇3.6;
  • aiohttp;
  • 碘酒;
  • 美丽的汤4;
  • 查德;
  • 弹性搜索;
  • 毒袜;
  • 熊猫(>=0.23.0);
  • aiohttp_socks;
  • 日程;
  • 地质学;
  • 假用户代理;
  • py-googletransx。

安装

吉特:

git clone https://github.com/twintproject/twint.git
cd twint
pip3 install . -r requirements.txt

点:

pip3 install twint

或者

pip3 install --user --upgrade -e git+https://github.com/twintproject/twint.git@origin/master#egg=twint

管道

pipenv install -e git+https://github.com/twintproject/twint.git#egg=twint

CLI 基本示例和组合

几个简单的例子可以帮助你理解基础知识:

  • twint -u username- 从用户的时间线上刮掉所有推文。
  • twint -u username -s pineapple- 从包含菠萝的用户时间线中删除所有推文。
  • twint -s pineapple- 从每个人的推文中收集每条包含菠萝的推文。
  • twint -u username --year 2014- 收集2014 年之前发布的推文。
  • twint -u username --since "2015-12-20 20:30:15"- 收集自 2015-12-20 20:30:15 以来发布的推文。
  • twint -u username --since 2015-12-20- 收集自 2015-12-20 00:00:00 以来发布的推文。
  • twint -u username -o file.txt- 抓取推文并保存到 file.txt。
  • twint -u username -o file.csv --csv- 抓取推文并保存为 csv 文件。
  • twint -u username --email --phone- 显示可能包含电话号码或电子邮件地址的推文。
  • twint -s "Donald Trump" --verified- 显示已验证用户发布的关于唐纳德特朗普的推文。
  • twint -g="48.880048,2.385939,1km" -o file.csv --csv- 从巴黎某个地方周围 1 公里的半径范围内抓取推文并将其导出到 csv 文件。
  • twint -u username -es localhost:9200- 将推文输出到 Elasticsearch
  • twint -u username -o file.json --json- 抓取推文并保存为 json 文件。
  • twint -u username --database tweets.db- 将推文保存到 SQLite 数据库。
  • twint -u username --followers- 抓取 Twitter 用户的关注者。
  • twint -u username --following- 抓取 Twitter 用户关注的人。
  • twint -u username --favorites- 收集用户收藏的所有推文(收集约 3200 条推文)。
  • twint -u username --following --user-full- 收集一个人关注的完整用户信息
  • twint -u username --profile-full- 使用缓慢但有效的方法从用户的个人资料中收集推文(收集约 3200 条推文,包括转推)。
  • twint -u username --retweets- 使用快速方法从用户的个人资料中收集最后 900 条推文(包括转发)。
  • twint -u username --resume resume_file.txt- 从上次保存的滚动 ID 开始继续搜索。

有关命令和选项的更多详细信息位于wiki

模块示例

Twint 现在可以用作模块并支持自定义格式。更多细节位于wiki

import twint

# Configure
c = twint.Config()
c.Username = "now"
c.Search = "fruit"

# Run
twint.run.Search(c)

输出

955511208597184512 2018-01-22 18:43:19 GMT <now> pineapples are the best fruit

import twint

c = twint.Config()

c.Username = "noneprivacy"
c.Custom["tweet"] = ["id"]
c.Custom["user"] = ["bio"]
c.Limit = 10
c.Store_csv = True
c.Output = "none"

twint.run.Search(c)

存储选项

  • 写入文件;
  • CSV;
  • JSON;
  • SQLite;
  • 弹性搜索。

弹性搜索设置

使用 Twint 设置 Elasticsearch 的详细信息位于wiki中。

图形可视化

图形

图表详细信息也位于wiki中。

我们正在开发一个 Twint 桌面应用程序。

4

常问问题

我尝试从用户那里抓取推文,我知道它们存在但我没有得到它们

Twitter 可以屏蔽帐户,这意味着他们的推文将无法通过搜索获得。要解决这个问题,--profile-full如果您通过 CLI 使用 Twint,请通过,或者,如果使用 Twint 作为模块,请添加config.Profile_full = True. 请注意,此过程将非常缓慢。

更多示例

追随者/追随者

仅获取关注者用户名/关注用户名

twint -u username --followers

twint -u username --following

获取关注者/关注用户的用户信息

twint -u username --followers --user-full

twint -u username --following --user-full

用户列表

仅获取用户的用户信息

twint -u username --user-full

从用户列表中获取用户的用户信息

twint --userlist inputlist --user-full

推文翻译(实验性)

获取 100 条英文推文并将其翻译成意大利语

twint -u noneprivacy --csv --output none.csv --lang en --translate --translate-dest it --limit 100

或者

import twint

c = twint.Config()
c.Username = "noneprivacy"
c.Limit = 100
c.Store_csv = True
c.Output = "none.csv"
c.Lang = "en"
c.Translate = True
c.TranslateDest = "it"
twint.run.Search(c)

笔记:

精选博文:

接触

如果您有任何问题、想加入讨论或需要额外帮助,欢迎您加入我们在OSINT 团队的 Twint 专注频道

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

twint_cn-2.1.15.1.tar.gz (31.0 kB 查看哈希

已上传 source