Code Monkey home page Code Monkey logo

news_crawler's Introduction

news_crawler

News crawler là một công cụ giúp bạn có crawl dữ liệu các website tin tức

Tác giả:

Chức năng

  • Crawl theo website được tích hợp
  • Crawl theo chủ đề
  • Crawl tất cả chủ đề
  • Có thể giới hạn số trang

Trang web được tích hợp vào để crawl

Chủ đề

  • Giáo dục
  • Y tế
  • Khoa học
  • Công nghệ
  • Giải trí
  • Thể thao
  • Sức khoẻ
  • Đời sống
  • Du lịch
Web/Chủ đề Giáo dục Y tế Khoa học Công nghệ Giải trí hể thao Sức khoẻ Đời sống Du lịch
VNEXPRESS OK OK OK OK OK OK OK OK OK
BÁO MỚI OK OK OK OK OK OK OK OK OK

Hướng đẫn

Cài đặt scrapy trước khi chạy

pip install Scrapy

Sau khi cài đặt xong bạn cần kiểm tra bằng lệnh sau

scrapy --version

Clone repository này về nhé, tiếp theo rõ và chạy command line scrapy list để hiện thị danh sách website để crawl

git clone https://github.com/nploi/news_crawler.git
cd news_crawler
scrapy list

Output sẽ là

baomoi
vnexpress

Chọn vnexpress hoặc baomoi nhé :))

scrapy crawl vnexpress -a category=the-thao -a limit=2

Chúc mừng bạn đã chạy thành công, hy vọng là vậy =]], vào thư mục vnexpress/Thể thao/ và xem thành quả của mình nào :v

Bạn cũng có thể chạy lệnh như sao để xuất tất cả dữ liệu vào một file .json

scrapy crawl vnexpress -a category=the-thao -a limit=2 -o vnexpress.json

Giải thích các tham số:

  • category: Chủ đề để crawl, có thể bỏ trống. Các chủ đề
    • giao-duc
    • suc-khoe
    • khoa-hoc
    • giai-tri
    • the-thao
    • doi-song
    • du-lich
  • limit: Giới hạn số trang để crawl, tốt nhất là nên có tham số này để k phải đợi lâu, có thể bỏ trống.

news_crawler's People

Contributors

nploi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

news_crawler's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.