沒有認證。沒有 API。沒有限制。
Twint 是一種用 Python 編寫的高級 Twitter 抓取工具,允許從 Twitter 個人資料中抓取推文,而無需使用 Twitter 的 API。
Twint 利用 Twitter 的搜尋運算符讓您抓取特定用戶的推文,抓取與某些主題、主題標籤和趨勢相關的推文,或從推文中篩選出敏感訊息,例如電子郵件和電話號碼。我發現這非常有用,你也可以利用它來發揮真正的創意。
Twint 也對 Twitter 進行特殊查詢,讓您可以抓取 Twitter 用戶的追蹤者、用戶喜歡的推文以及他們關注的人,而無需任何身份驗證、API、Selenium 或瀏覽器模擬。
使用 Twint 與 Twitter API 的一些好處:
可以取得幾乎所有推文(Twitter API 僅限於最後 3200 則推文);
快速初始設定;
可匿名使用,無需註冊 Twitter;
無速率限制。
Twitter 限制瀏覽用戶時間軸時的捲動。這意味著透過.Profile
或.Favorites
您將能夠獲得約 3200 條推文。
Python 3.6;
aiohttp;
aiodns;
美麗湯4;
查德特;
資料類
彈性搜尋;
運動襪;
熊貓(>=0.23.0);
aiohttp_socks;
日程;
地質學;
假用戶代理;
py-googletransx。
git:
git克隆--深度= 1 https://github.com/twintproject/twint.gitcd twint pip3 安裝 . -r 要求.txt
點:
pip3 安裝 twint
或者
pip3 install --user --upgrade git+https://github.com/twintproject/twint.git@origin/master#egg=twint
管道夫:
Pipenv 安裝 git+https://github.com/twintproject/twint.git#egg=twint
新增:Dockerfile
注意到很多人在安裝時遇到問題(包括我)。當我研究它們時,請暫時使用 Dockerfile。
一些簡單的例子可以幫助您理解基礎知識:
twint -u username
- 抓取使用者的所有推文(不包括轉發,但包括回應)。
twint -u username -s pineapple
- 從使用者時間軸中抓取所有包含pineapple 的推文。
twint -s pineapple
- 從每個人的推文中收集包含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
- 顯示經過驗證的用戶發布的關於 Donald Trump 的推文。
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 --timeline
- 使用有效的方法從使用者的個人資料中收集推文(收集約 3200 條推文,包括轉發和回應)。
twint -u username --retweets
- 使用快速方法從使用者的個人資料中收集最後 900 條推文(包括轉發)。
twint -u username --resume resume_file.txt
- 從上次儲存的滾動 ID 開始恢復搜尋。
有關命令和選項的更多詳細信息,請參閱 wiki
Twint 現在可以用作模組並支援自訂格式。更多詳細資訊可以在 wiki 中找到
import twint#Configurec = twint.Config()c.Username = "realDonaldTrump"c.Search = "great"# Runtwint.run.Search(c)
輸出
955511208597184512 2018-01-22 18:43:19 GMT <now> pineapples are the best fruit
導入 twintc = twint.Config()c.Username = "noneprivacy"c.Custom["tweet"] = ["id"]c.Custom["user"] = ["bio"]c.Limit = 10c.Store_csv = Truec.Output = "無"twint.run.Search(c)
寫入文件;
CSV;
JSON;
SQLite;
彈性搜尋。
有關使用 Twint 設定 Elasticsearch 的詳細信息,請參閱 wiki。
圖表詳細資訊也可以在 wiki 中找到。
我們正在開發 Twint 桌面應用程式。
我嘗試從用戶那裡抓取推文,我知道它們存在,但我沒有得到它們
Twitter 可以封鎖帳戶,這意味著他們的推文將無法透過搜尋取得。若要解決此問題,如果您透過 CLI 使用 Twint,請傳遞--profile-full
,或如果使用 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
或者
導入 twintc = twint.Config()c.Username = "noneprivacy"c.Limit = 100c.Store_csv = Truec.Output = "none.csv"c.Lang = "en"c.Translate = Truec.TranslateDest = "it" twint.run.Search(c)
筆記:
谷歌翻譯有一些配額
如何使用 Twint 作為 OSINT 工具
Null Byte 製作的基礎教學
使用 Spark、Optimus 和 Twint 在幾分鐘內透過 NLP 分析推文
將推文載入到 Kafka 和 Neo4j 中
如果您有任何疑問、想要參與討論或需要額外協助,歡迎您加入 OSINT 團隊的 Twint 重點頻道