Skip to content

Twitter Scrape is a Python bot designed for scraping Twitter data based on specified keywords. It collects information such as tweet links, text, engagement metrics, and more. The bot stores the data in MongoDB, with functionality to export it to CSV. Setup involves cloning the repository, installing dependencies, configuring credentials, and run

License

Notifications You must be signed in to change notification settings

SukunDev/twitter-scrape

Repository files navigation

Twitter Scrape

Bot untuk scraping data dari Twitter.

Installasi

Persiapan

Sebelum memulai, pastikan Anda telah menginstal dan menambahkan ke dalam environment variable:

Cloning Repository

git clone https://github.com/SukunDev/twitter-scrape.git
cd twitter-scrape

Instalasi di Command Prompt (CMD)

python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt

Instalasi di Git Bash

python -m venv .venv
source .venv/Scripts/activate
pip install -r requirements.txt

Migrasi Database

Import Database

mongorestore ./database_backup/bot_scrape --db bot_scrape

Export Database

mongodump -d bot_scrape -o database_backup

Export ke CSV

mongoexport --host localhost --db bot_scrape --collection tweet --type=csv \
--out film_horor_collection.csv --fields tweet_link,full_text,bookmark_count, \
favorite_count,quote_count,reply_count,retweet_count,lang,user,entities, \
extended_entities,created_at

Menjalankan Program

Sebelum menjalankan program, edit terlebih dahulu file main.py:

from scrape import Scrape

if __name__ == "__main__":
    # Ganti dengan username dan password Twitter Anda
    scrape = Scrape(username="<username_twitter>", password="<password_twitter>", keywords="film horor")
    scrape.run()

Setelah itu, jalankan program dengan perintah:

python main.py

Kontribusi

Kami menerima kontribusi dari siapa saja! Jika Anda ingin berkontribusi, ikuti langkah berikut:

  1. Fork repository ini.
  2. Buat branch baru untuk fitur atau perbaikan Anda.
  3. Commit perubahan Anda dengan deskripsi yang jelas.
  4. Push ke repository Anda dan buat pull request ke repository utama.

Lisensi

Proyek ini dilisensikan di bawah MIT License.

About

Twitter Scrape is a Python bot designed for scraping Twitter data based on specified keywords. It collects information such as tweet links, text, engagement metrics, and more. The bot stores the data in MongoDB, with functionality to export it to CSV. Setup involves cloning the repository, installing dependencies, configuring credentials, and run

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages