scraping tutorial
Find a file
2025-08-27 19:34:59 +07:00
__pycache__ refactor: refactor whole project 2025-08-27 19:34:59 +07:00
README.md refactor: refactor whole project 2025-08-27 19:34:59 +07:00
scrape_drama_cast_crew.py refactor: refactor whole project 2025-08-27 19:34:59 +07:00
scrape_drama_details.py refactor: refactor whole project 2025-08-27 19:34:59 +07:00
scrape_drama_recommendations.py refactor: refactor whole project 2025-08-27 19:34:59 +07:00
scrape_drama_reviews.py refactor: refactor whole project 2025-08-27 19:34:59 +07:00
scrape_drama_top_or_polular.py refactor: refactor whole project 2025-08-27 19:34:59 +07:00
scrape_track_user_by_year.py refactor: refactor whole project 2025-08-27 19:34:59 +07:00
scrape_user_drama_list.py refactor: refactor whole project 2025-08-27 19:34:59 +07:00
scrape_user_information.py refactor: refactor whole project 2025-08-27 19:34:59 +07:00
ultil.py refactor: refactor whole project 2025-08-27 19:34:59 +07:00

PythonScraper - MyDramaList Scraping Toolkit

Giới thiệu

Bộ công cụ Python tự động thu thập thông tin phim, diễn viên, review, user... từ MyDramaList. Dữ liệu được lưu ra file .txt để dễ dàng tra cứu và phân tích.

Yêu cầu hệ thống

  • Python 3.8 trở lên
  • Hệ điều hành: Windows (khuyến nghị)
  • Kết nối Internet

Cài đặt thư viện

Mở terminal tại thư mục dự án và chạy:

pip install cloudscraper beautifulsoup4 lxml

Cấu trúc thư mục

pythonscraper/
│
├── scrape_drama_top_or_polular.py      # Lấy danh sách phim top/popular
├── scrape_drama_cast_crew.py           # Lấy thông tin diễn viên, đạo diễn
├── scrape_drama_reviews.py             # Lấy review của phim
├── scrape_drama_recommendations.py     # Lấy phim được recommend
├── scrape_user_information.py          # Lấy thông tin user MyDramaList
├── scrape_user_drama_list.py           # Lấy danh sách phim của user (theo trạng thái)
├── scrape_track_user_by_year.py        # Lấy thống kê user theo năm
├── ultil.py                           # Hàm tiện ích (load link, tạo scraper)
├── data/                              # Thư mục lưu dữ liệu
└── ...

Hướng dẫn sử dụng

Tạo file danh sách phim:

python scrape_drama_top_or_polular.py --type top
python scrape_drama_top_or_polular.py --type popular

File sẽ lưu tại ./data/list/top_dramas.txt hoặc popular_dramas.txt.

2. Lấy thông tin chi tiết phim

python scrape_drama_cast_crew.py --movie "Tên phim"

Tên phim phải khớp với tên trong top_dramas.txt (không phân biệt hoa thường).

3. Lấy review của phim

python scrape_drama_reviews.py --movie "Tên phim"

4. Lấy phim được recommend

python scrape_drama_recommendations.py --name "Tên phim"

5. Lấy thông tin user

python scrape_user_information.py --link "https://mydramalist.com/profile/tenUser/"

6. Lấy danh sách phim của user (theo trạng thái)

python scrape_user_drama_list.py --link "https://mydramalist.com/profile/tenUser/" --status all
python scrape_user_drama_list.py --link "https://mydramalist.com/profile/tenUser/" --status completed

Các trạng thái gồm: all, watching, completed, on_hold, dropped, plan_to_watch, undecided, not_interested.

7. Lấy thống kê user theo năm

python scrape_track_user_by_year.py --link "https://mydramalist.com/profile/tenUser/stats" --year 2023

Nếu không truyền --year, chương trình sẽ hiển thị danh sách các năm có thể lấy.

Lưu ý

  • Nếu gặp lỗi không tìm thấy link phim, hãy chắc chắn đã chạy scrape_drama_top_or_polular.py để tạo file top_dramas.txt.
  • Một số chức năng có thể cần chỉnh sửa nhỏ tùy giao diện MyDramaList thay đổi.
  • Dữ liệu sẽ được lưu vào các thư mục như data/drama_cast_crew/, data/drama_reviews/, data/recommendations/, data/users/, data/list/.