Cara Mendapatkan Data (Crawl) Twitter X - 30 Maret 2024
Summary
TLDRThis video provides an updated tutorial on how to crawl data from Twitter (or X) using the custom-made tool 'Tweet Harvest'. It explains how to set up the tool via Google Colab, acquire Twitter authentication tokens, and gather data based on specific keywords. The creator also addresses common issues with data collection, including rate limits, and gives tips for overcoming these challenges. The tool is intended for research purposes only, and viewers are advised not to use it for commercial activities. The video concludes by guiding viewers on how to save and process the collected data.
Takeaways
- 🔍 To crawl Twitter/X data based on a specific search keyword, the tool Tweet Harvest can be used.
- 🚫 If the previous method for crawling data is not working, updating to the latest version (v2.60) of Tweet Harvest should resolve the issue.
- ⏳ Due to Twitter's rate limits, you can only retrieve about 500 tweets every 10-15 minutes. Over a full day, this could result in collecting around 2,700 tweets, but manual stopping is recommended to avoid account blocking.
- 🔑 To use Tweet Harvest, you need to obtain a Twitter OAuth token, which acts like a password. This can be done by inspecting the Twitter web page's cookies after logging in.
- ⚙️ Tweet Harvest is built using Node.js, and requires certain installations, such as Pandas and Node.js, to work on platforms like Google Colab.
- 📝 The CSV output file will contain detailed tweet data, including timestamps, tweet content, likes, and usernames, which can be accessed and analyzed further in tools like Excel or Google Sheets.
- 📊 While the Tweet Harvest tool can gather data for research purposes, it should not be used for business or monetization purposes.
- 🗂 The keyword, language, and number of tweets to be crawled can be customized, allowing for various types of research (e.g., analyzing tweets related to specific events or people).
- 📅 Data can be filtered by time range, and you can search tweets from specific users with specific content (e.g., tweets mentioning COVID-19 from a particular public figure).
- ⛔ If the crawler hits a rate limit, it will pause for 10 minutes before continuing. Errors are expected, but they do not prevent the tool from working.
Q & A
What is Tweet Harvest, and how does it work?
-Tweet Harvest is a tool created by the speaker for crawling data from Twitter (now X). It collects tweets based on specific search keywords. It uses Node.js for its backend and scrolls through Twitter to gather data such as tweet text, likes, replies, and more. The tool outputs the data into a CSV file for further analysis.
Why can't some users get Tweet Harvest to work?
-Users may experience issues with Tweet Harvest if they're using outdated versions of the tool. The speaker recommends using the latest stable version (260 as of March 30) for optimal performance. Additionally, issues could stem from incorrect setup or limits imposed by Twitter’s API.
What are the rate limits imposed by Twitter for data collection using Tweet Harvest?
-Twitter imposes rate limits that restrict the number of tweets that can be collected within a given time frame. The speaker mentions a limit of about 500 tweets every 10-15 minutes. Users need to wait for these limits to reset before continuing to collect data.
How much data can be collected in a day using Tweet Harvest?
-The speaker states that they have been able to collect around 2,700 tweets in a day, but this number is not fixed. It largely depends on how long the user is willing to wait for rate limits to reset, as well as how long the tool is allowed to run.
How do you set up Tweet Harvest for a new project?
-To set up Tweet Harvest, users need to obtain their Twitter auth token, which serves as a kind of password for accessing their account’s API. After obtaining the token, users input their search keyword, desired tweet language, and other parameters into the tool before running it to collect data.
What are some examples of keywords that can be used in Tweet Harvest?
-Users can input any keyword relevant to their research. For example, the speaker mentions collecting tweets about Indonesian President Jokowi by setting the keyword as 'Jokowi' and setting the language to Indonesian ('lang: id'). Other keywords could include topics like elections, COVID, or political figures.
What kind of data does Tweet Harvest collect?
-Tweet Harvest collects a variety of data from Twitter, including the tweet text, number of likes, replies, retweets, the time of creation, whether an image is attached, the username of the person who tweeted, and the tweet's URL. All this data is stored in a CSV file for further processing.
How does the tool handle rate limits when collecting a large number of tweets?
-Tweet Harvest automatically stops collecting tweets once it hits Twitter’s rate limit (around 500 tweets per 10-15 minutes). After the rate limit is reached, the tool waits for 10 minutes before continuing to scroll and collect more data.
Can the tool be used for purposes other than research?
-The speaker explicitly advises against using Tweet Harvest for commercial purposes or any activities beyond research, such as thesis work or dissertation. The tool was built specifically to aid academic research and should not be used for business or profit-driven activities.
How can users further process the collected Twitter data?
-After collecting the data in a CSV file, users can process it further using tools like Excel, Google Sheets, or even programming languages like Python. They can perform sentiment analysis, social network analysis, or other forms of data analysis based on their needs.
Outlines
🐦 Quick Update on Twitter/X Data Crawling
In this paragraph, the speaker gives a quick update about how to crawl data from Twitter (now known as X). They mention that previous methods may not work anymore and address common questions about the limitations of data retrieval. The speaker shares that using Tweet Harvest, a tool they built, users can gather about 500 pieces of data every 10 to 15 minutes, and up to around 2,700 in a day. This is mainly for academic purposes like research, theses, or dissertations, and not for commercial use. They emphasize that users should not exploit this tool for non-research purposes.
🛠️ Setting Up and Running Tweet Harvest with Google Colab
This section explains how to use Tweet Harvest through Google Colab. It walks the user through the steps to copy the tool, access Twitter’s authentication token, and how to safely share and handle it. The speaker demonstrates how to install necessary packages, such as Pandas and Node.js, and how the Tweet Harvest tool crawls data by scrolling and capturing Twitter posts. Users are guided on how to customize file names and search keywords to save their data in .csv format.
🔧 Detailed Steps for Using Tweet Harvest Tool
The speaker continues to explain the process of using Tweet Harvest, focusing on the installation of Node.js and setting specific search parameters. They use an example of crawling data related to President Jokowi and demonstrate how to filter tweets based on the chosen search keywords. The paragraph details how the tool saves the crawled data, handles Twitter rate limits, and what to expect when running the script multiple times, including how to manage and download CSV files.
📊 Working with the Crawled Twitter Data
This paragraph covers the process of analyzing and working with the data gathered from Twitter. The speaker talks about how the crawled data, which includes information like tweet text, likes, retweets, and usernames, can be exported and accessed through CSV files. They also discuss the rate limit imposed by Twitter, how to work around it by waiting, and potential errors that may arise after collecting around 500–600 tweets. The speaker emphasizes that patience is required to gather more data.
💡 Additional Tips and Advanced Data Crawling
In this final section, the speaker answers some remaining questions about crawling specific types of data, such as tweets within a certain time range, tweets by specific users, or tweets containing minimum likes and replies. They mention that these methods can be found in more detail in their blog and offer additional tools for advanced data analysis, such as sentiment analysis. The speaker concludes by encouraging viewers to check their blog for further guidance and details on preprocessing and using the collected Twitter data.
Mindmap
Keywords
💡Crawling Data
💡Tweet Harvest
💡Search Keyword
💡Rate Limiting
💡Google Colab
💡OAuth Token
💡CSV Output
💡Rate Limit Errors
💡Sentiment Analysis
💡Language Filter (lang: id)
Highlights
Quick update on obtaining Twitter data using Tweet Harvest, addressing recent user issues with prior versions.
Overview of Tweet Harvest functionality, which allows Twitter data crawling based on keywords with token authentication.
Detailed instructions for generating and managing an OAuth token needed to access Twitter data.
Explanation of rate limits on data collection: around 500 tweets every 10–15 minutes, reaching about 2,700 tweets daily.
A reminder that Tweet Harvest is for research purposes only, specifically for theses, dissertations, or academic studies.
Guide to using Google Colab with Tweet Harvest to simplify the data collection process and create editable copies in Google Drive.
Step-by-step tutorial on setting up Google Colab, including essential tools like Pandas and Node.js installation for Tweet Harvest.
How to specify the keyword search criteria and store data in a CSV file with customizable names, e.g., 'jokowi.csv.'
Clarification on the use of the language filter (e.g., 'lang: id') to collect tweets in specific languages such as Indonesian.
Explanation of error handling during crawling due to rate limits; waiting 10 minutes before continuing to collect more data.
Tips for extracting and storing tweet data, including metadata like tweet timestamp, likes, images, username, and location.
Instructions for downloading and using the collected CSV file offline or in programs like Excel and Google Sheets.
Advice on using Tweet Harvest for sentiment analysis or other analyses once data collection is complete.
Brief overview of Twitter API limitations that prevent many researchers from collecting data, with Tweet Harvest as a workaround.
Additional details on specifying search parameters such as exact phrases, minimum likes or replies, and timeframes for targeted data collection.
Transcripts
cara mendapatkan data atau craowl data
dari platform Twitter atau X ini aku mau
quick update aja dari aku kan udah
beberapa video terakhir kan bikin cara
mendapatkan data Twitter terus ya tapi
ini aku quick update aja soalnya banyak
yang nanyain Kenapa pada enggak bisa
jadi di video ini aku cuma mau bahas
tiga pertanyaan ini yaitu ya cara cara
craowl data Twitter berdaskan search
keyword tertentu itu caranya gimana nah
terus kok yang sebelumnya enggak bisa
mas gitu aku udah pakai twet Harvest
yang versi 228 yang versi berapa versi
berapa itu kok enggak bisa terus gimana
gitu sama sebenarnya kita bisa berapa
data sih yang bisa kita dapatin
gitu short tanser-nya ini sebenarnya
kita bisa dapetin Aku enggak tahu sih
dapetin berapa cuman limitasinya itu per
10 menit atau 10 sampai 15 menit itu tuh
kita cuman dapetin bisa 500-an
gitu Jadi per 10 atau 10 sampai 15 menit
itu tuh kita cuman bisa dapetin data
sekitar 500-an bisa 500 400 600 kayak
gitu Jadi per hari bisa dapat
berapa yang sejauh ini aku sudah coba
Itu aku bisa dapatin sekitar
2.700-an gini ini cuman sampai 2.700
karena aku stop ya tahuak enggak mau
kebanyakan juga karena ini aku cuman
buat nyobain dan buat bantuin
teman-teman yang lagi skripsian aja
sejauh ini ini harusnya udah aman untuk
dapatin
data dan quick reminder ini research
proposes only ya teman-teman
Jadi selain untuk riset selain untuk
skripsi tesis disertasi pokoknya untuk
studi Kalian please jangan pakai tweet
Harvest yang aku bikin sendiri ini Jadi
ini aku emang bikin sendiri
dan ya untuk kebutuhan riset dan bantuin
teman-teman aja gitu kalau buat bisnis
buat cari duit
buat apa ya apunlah pokoknya selain
skripsian selain bikin tesis Please
jangan pakai TW Harvest ini gitu ya
Oke Langsung aja nanti aku bakal ngasih
link di description jadi teman-teman
bisa langsung klik klik klik klik
duplicate aja nanti bisa di e buka link
nya itu nanti kita bakal pakai Google
collab buat memudahkan segalanya terus
nanti teman-teman bisa ke file terus
Save A copy in drive gitu ya biar
teman-teman bisa dapatin Google Cab
teman-teman sendiri gitu bisa diedit
bisa di apaa terserah gitu Jadi ini
langsung aja ya kita pertama-tama bakal
butuh Twitter outoken
karena alat yang aku bikin ini tweet
Harvest itu tuh butuh
autocun out Token itu apa itu kayak
password password Twitter kalian jadi
buat dapetin ininya Ini kan nanti
digitnya banyak gini ya Nah itu tuh
Caranya buka Twitter twitter.com login
dulu kalau udah login kan halamannya
bakal kayak gini nih terus ini diklik
kanan terus
inspect Klik Kanan inspect Nah nanti di
bagian sini nanti ada icon yang kayak
gini nih kalau teman-teman pakai
Microsoft Edge Harusnya sama di Chrome
pun harusnya application juga di
application cookies ini di bagian sini
nih nanti ada
twitter.com habis itu ada name-nya out
token gini out token nah value-nya ini
kalian block terus dicopy semua nih copy
gitu nah ini aku display ke kalian
karena ini udah ku edit-edit ya Ini udah
ku edit-edit jadi udah gak valid kalau
teman-teman pakai jadi kalau teman-teman
mau share aken atau Google colab kalian
ke kalian ini diedit dulu ya nanti jadi
udah dicopy kan udah dipaste gini nah
ini nanti dihapus dulu sebelum kalian
share gitu ya Soalnya ini kalian sama
aja kayak share password kalian sendiri
gitu gitu E ini udah dari yang tadi udah
dicopy dipaste ke sini terus ini dihide
aja habis itu ini kita run run run run
aja ini buat instal
Pandas habis itu instal Noe JS karena
Harvest itu dibikin pakai Note JS jadi
aku bikin pakai Note JS ya twet
harvest-nya tweet Harvest itu apa sih
cara kerjanya kayak gimana itu nanti
bakal aku mungkin di di video yang lain
soalnya bakal panjang intinya ini
metodenya tuh craowling data gitu ya
jadi dia tuh kayak
eh scrollsroll sendiri gitu loh Scroll
Scroll Scroll sendiri terus dapetin data
Scroll dapetin data kayak gitu
jadi manual Scroll
aja gitu ya Nah udah instal Noe JS nanti
bakal muncul versi nodejs yang keinstal
yaitu versi sekitar 20-an kalau
teman-teman lakuin ini setelah 30 Maret
minimal versi 20-an ini habis note
js-nya udah keinstal Harusnya kita udah
bisa buat ngelakuin Crawl datanya untuk
pakai tweet Harvest ini diun aja diklik
play Oh ya ini file name-nya ya file
nameennya ditentuin Kalian mau cral
tentang apa misalkan tentang Pak Jokowi
gitu ya Nah ini bisa diedit aja nanti
bakal kesimpan di file name-nya itu
jokowi.csv gitu Nah yang penting tuh
Kalian ngedit search keyword-nya aja
sesuai yang kalian butuhin mau tentang
Jokowi tentang pemilu tentang Pak
Prabowo siapun Apun yang kalian butuhin
untuk reset Ini diganti-ganti aja ini
titik du id untuk dapat bahasa
Indonesia terus Kalian Butuh berapa data
di sini aku 100 aja untuk demo
proposes habis itu Line terakhir ini
untuk jalanin tweet harvestnya Yang aku
pakai yang 260 ya per 30 Maret ini yang
versi terakhir yang paling Stable yang
aku bisa dapatin sampai 2000an data ini
pakai yang
260 disimpan di jokowi.csv sesuai yang
ini terus Search keyword-nya pakai
Jokowi berbahasa Indonesia 100 data
tokennya ambil dari yang atas tadi yang
ada di sini ya
udah habis itu diun harusnya bakal
muncul kayak
gini ya keep your access token
Secret habis ituudah nih total twet save
106 Pok kalau udah
mencapai minimal itu limitnya Soalnya
ini enggak bisa apa ya ya sebenarnya
bisa aja sih buat exactly dapat 100 data
gitu tapi ya karena tadi Scroll Scroll
Scroll itu kan dia tiap kita Scroll tuh
kita gak tahu Dapat berapa tweet kan
dari Twitternya nah ini nambah-nambahnya
tuh Pokoknya terserah Twitternya gitu
Nah limitnya tadi itu batas minimalnya
nah 100 itu n 106 Ini kan udah melebihi
dari batas minimal Jadi udah stop dia
got 106 twets dan scrolling gitu
nah udah kita Run ini Nah itu tuh nanti
dia bakal baca csv file yang udah
kesimpan
di di mana
Sebentar cobat Refresh dulu
ya Nah
harusnya eh bentuk fil-ya kayak gini ya
yang icon files ini kalau teman-teman
klik dan udah ngejalanin croll datanya
dan nanti itu hasilnya bakal kesimpan di
twitch data terus tergantung kalian nama
file name-nya apa tadi misalkan tadi kan
gibran.csv gitu ya Nah itu tuh nanti
bakal kesimpan di
gibran.csv output yang penting
sebenarnya ini Jadi kalian mau jalanin
offline mau jalanin di Google colab mau
jalanin di Jupiter notebook atau di mana
Beb
yang penting ini csv-nya jadi
teman-teman kalau udah selesai di Google
colab ini bisa diclose aja Google
colab-nya tapi sebelum itu di-download
dulu nih
csv gitu ya Nah ini udah di-download
harusnya Udah bisa diakses di Excel di
Google spreadsheet harusnya udah aman
sih gitu nah ini kolomnya udah banyak
ada created dipost Kapan tweetnya berapa
yang nglike
berapa
ada gambarnya atau
enggak usernameennya siapa atau dia
ngerely siapa lokasinya di
mana terus ada tweet urlnya juga ada ada
username yang ngweet juga ya harusnya
udah cukup sih gitu ya jadi teman-teman
bisa download csv-nya atau bisa ngproses
lanjut di bawahnya
lagi dan b Dar sebelnya ak bikinnya
pakai titik koma sekarang udah pakai
koma di mana itu bikin ini fnya k tutup
dulu deh biar lebar Di mana itu bikin di
Google colab tuh visualisasinya lebih
cakep jadi di sini tu Kita
bisaah ini kurun dulu deh
coba nah habis diun kayak gini di kalau
kita horizontal Scroll ke kanan di pojok
kanan gini nah gitu di bagian atas pojok
kanan atas tuh ada kayak gini nih nah
itu kalau diklik tuh nah jadi bisa lebih
rapi kan Nih ada 106 entries gituernya
siapa tweet urlnya apa ini Harusnya ada
gibran-gibrannya Nih nah ini ada Gibran
tweet Gibran tweet di Gibran tweet
e bahkan Gibran
gitu ini kenapa ada
gibrannya nah yang ini jujur ak gak tahu
kenapa kenapa bisa muncul terus sini ada
Gibran ya poknya gitu ya pokoknya ada
gibran-gibrannya Harusnya nah ini Gibran
gitu dan udah ada 106 harusnya udah oke
udah
aman harusnya ini ya Jadi nanti tadi
yang sesuai ku jelasin
waktu data itu setiap udah nyampai 500an
dia itu harus nunggu dulu jadi karena
ada rate limit dari
Twitter yang 10 15 menitan tadi cuman
bisa dapetin 500-an data Nah itu tuh
nunggu 10 menit dan ini bakal auto Crow
lagi habis nunggu 10 menit itu
gitu ya kayak giniilah kurang lebih jadi
Eh ini aku udah percobaan
sebelumnya nah ini udah 300 400 500 nah
di 600-an dia tuh kayak gini nih ada
error n nah pokoknya kalau muncul kayak
gini error kayak gini jangan kaget
karena itu emang expected bakal muncul
setiap teman-teman udah dapetin 600-an
atau 500-an data ini nunggu 10 menitan
habis 10 menitan nah ini bakal KW lagi
gitu tuh udah 600an
lagi kena rate limit lagi 10 menit
berikutnya lanjut lagi dan gitu
seterusnya
gitu ya Nah terus ini limitasi dari
Google aku ngakelimitasi Google clab-nya
cuman buat dapatin data aja ya jadi
setelah datanya udah dapat kalian mau
apain Mau proses data mau sentimen
analisis mau ngapain Terserah yang
penting ini masalah hampir semua
researcher di Indonesia atau di dunia
sebenarnya itu gak bisaroll data karena
api-nya kelimit kan jadi ya ini aku
pengin Bantu teman-teman aja buat
dapatin
datanya gitu Jadi terserah nanti datanya
habis itu kalian bisa lanjut di sini
pakai data frame yang ini atau bisa
download csv yang ada di folder twitch
data ini diklik terus bisa di-download
gitu terus bisa kalian pakai di mana
aja itu harusnya ini udah menjawab Dua
pertanyaan ya cara Craw data Twitter
atau X berdasarkan search keyword
tertentu terus kok cara sebelumnya itu
gak bisa kenapa
e Jujur aku engak
tahu gak tahu sebenarnya ini kan dipakai
di
video-video content Creator yang lain ya
di YouTube juga ada ada yang habis bikin
konten e di beberapa bulan lalu juga ada
yang bikin terus gak bisa juga dan
harusnya semoga video ini bisa menjawab
Gimana cara yang benarnya Karena aku
udah update jadi jawaban nya pakai
latest version aja yaitu
260 dan sebenarnya sebenarnya bisa
berapa data sih yang kita
dapatin jujur enggak tahu dan Harusnya
bisa banyak asalkan kalian sabar nunggu
aja Soalnya aku nunggu Aku gak tahu
nunggu berapa lama itu itu aja udah
dapetin
2.700 dan ini 2700 ini e aku stop manual
gitu jadi kan ini habis kalau kita Run
gitu kan B ada ion stop gitu ya itu aku
stop sendiri
soalnya takut ke keblokir juga nih
twitterku karena Scroll terlalu lama
gitu ya jadi disesuaikan kebutuhan
kalian aja harusnya 10.000 gitu harusnya
bisa sih Pokoknya ditunggu aja ya gitu
ya harusnya main objektif 3 video ini
udah selesai karenaudah menjawab topik
ini mungk berikutnya Kalau tem-an ada
pertanyaan yangin semoga aku bisa Jawab
please drop the question di komentar di
video
ini tapi mungkin ini aku short answer
aja TF itu apa tadi aku udah jelasin dia
tool buat collnya cara kerjanya mungkin
nanti aku bakal bikin di video sebelah
kalau ada yang
butuh nah ini cukup menarik bisa buat
social network analisis atau enggak
jawabannya bisa di video terakhir eh di
versi yang terakhir ini bisa nanti bakal
aku bahas kalau mau cral data pakai
bahasa Indonesia aja bisa enggak
keyword-nya di langang ti2 ID Jadi kalau
kalian mau cari tentang Presiden gitu ya
berbahasa Indonesia Tinggal Kasih Lang
ID
gitu kalau dapatin data dari rentang
waktu atau bisa atau enggak bisa
presiden misalnya Jokowi gitu ya tentang
Pak
Jokowi terus pakai
Sin tahun berapa bulan apa tanggal
berapa until Kapan 2024
01 bulan 1 tanggal 30 misalkan gitu
kalau dapatin data komentar bisa atau
enggak bisa cek videoku yang
sebelumnya Harusnya sama tinggal kalian
Ganti versi ke 260 aja guu dapatin twet
username Tertentu bisa atau enggak bisa
Misalkan
ee bahas tentang laut
atau virus lah atau covid covid tapi
dari dari Twitternya Pak Jokowi gitu nah
keyword-nya jadi kayak gini jadi ditaruh
di bagian search keyword
nih
gitu Nah kayak gini nih jadi ini bakal
kita bakal nyari tweet yang ada
kata-kata covidnya yang diweet sama Pak
Jokowi
gitu
kalau dapatin data dengan minimum Lik
atau reply gimana senya kalau
teman-teman cek di blogku
ya kalau mau Lebih detail
lagi di mana ya Nah di sini nih yang
blog yang data Twitter dengan python dan
SN sebennya ini udah lama sih
tapi
akuwiteryudah lengkap banget kalau
kalian mau cari tweet dari pengguna
tertentu ini bisa pakai ini
Hash terus nah yang menyebutkan pengguna
tertentu terus pakai or Nah tadi yang
since until ada di sini juga dipost di
kota mana Within berapa kilomer ini bisa
juga terus pakai
net yang mengandung frasa tepat ini
pakai petik
minimum repes minimum likes ada juga nih
jadi jawabannya ini ya minimum repes
titik2 10 berarti minimal yang reply 10
yang minimal like 100 Berarti kayak gini
terus minimum retweets kayak gini gitu
ya teman-teman bisa cek di blokku yang
itu Cara preprocessing datanya kayak
gimana Next Video
aja ya gitu ya teman-teman semoga
menjawab
Twitter thank you
تصفح المزيد من مقاطع الفيديو ذات الصلة
Twitter OSiNT (Ethical Hacking)
Angular Login and Signup Page | Local-Storage | angular tutorial | angular tutorial for beginners
How To Extract All Business Data And Emails From Google Maps
Big Data with Mapbox | Handling Zoom Levels, Mapbox Tiling Service (MTS), Large File Uploads
Get the data Nominatim Open Street Maps
LinkedIn Data Scraping Tutorial | 1-Click To Save to Sheets
5.0 / 5 (0 votes)