Giter Site home page Giter Site logo

statyhc / koreanewscrawler Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lumyjuwon/koreanewscrawler

0.0 0.0 0.0 929 KB

대량의 뉴스 데이터를 수집하기 위해 만들어진 뉴스 크롤러입니다.

License: Apache License 2.0

Python 100.00%

koreanewscrawler's Introduction

KoreaNewsCrawler

License

이 크롤러는 네이버 포털에 올라오는 언론사 뉴스 기사들을 크롤링 해주는 크롤러입니다.
크롤링 가능한 기사 카테고리는 정치, 경제, 생활문화, IT과학, 사회, 세계, 오피니언입니다.
스포츠 기사같은 경우 야구, 축구, 농구, 배구, 골프, 일반 스포츠, e스포츠입니다.

스포츠 기사는 현재 html 형식이 바껴 사용이 불가능 한 상태입니다. 빠른 시일내로 업데이트 하겠습니다.

스포츠 관련 기사 크롤링 도움을 주실 수 있으신 분을 찾습니다 깃허브에 issue 또는 [email protected]로 이메일 주시면 감사하겠습니다

User Python Installation

  • KoreaNewsCrawler

    pip install KoreaNewsCrawler

Method

  • set_category(category_name)

이 메서드는 수집하려고자 하는 카테고리는 설정하는 메서드입니다.
파라미터에 들어갈 수 있는 카테고리는 '정치', '경제', '사회', '생활문화', 'IT과학', '세계', '오피니언'입니다.
파라미터는 여러 개 들어갈 수 있습니다.
category_name: 정치, 경제, 사회, 생활문화, IT과학, 세계, 오피니언 or politics, economy, society, living_culture, IT_science, world, opinion

  • set_date_range(startyear, startmonth, endyear, endmonth)

이 메서드는 수집하려고자 하는 뉴스의 기간을 의미합니다. 기본적으로 startmonth월부터 endmonth월까지 데이터를 수집합니다.

  • start()

이 메서드는 크롤링 실행 메서드입니다.

Example

from korea_news_crawler.articlecrawler import ArticleCrawler

Crawler = ArticleCrawler()  
Crawler.set_category("정치", "IT과학", "economy")  
Crawler.set_date_range(2017, 1, 2018, 4)  
Crawler.start()

2017년 1월 ~ 2018년 4월까지 정치, IT과학, 경제 카테고리 뉴스를 멀티프로세서를 이용하여 병렬 크롤링을 진행합니다.

Multi Process 안내

intel i5 9600 cpu로 테스트 해본 결과 1개의 카테고리 당 평균 8% 의 cpu 점유율을 보였습니다.
크롤러를 실행하는 컴퓨터 사양에 맞게 카테고리 개수를 맞추시거나 반복문을 이용하시기 바랍니다.

ex_screenshot

Results

ex_screenshot ex_screenshot

Colum A: 기사 날짜
Colum B: 기사 카테고리
Colum C: 언론사
Colum D: 기사 제목
Colum E: 기사 본문
Colum F: 기사 주소

수집한 모든 데이터는 csv 확장자로 저장됩니다.

KoreaNewsCrawler (English version)

License

This crawler crawles news from portal Naver
Crawlable article categories include politics, economy, lifeculture, global, IT/science, society.
In the case of sports articles, that include Baseball, soccer, basketball, volleyball, golf, general sports, e-sports.

In the case of sports articles, you can't use sport article crawler because html form is changed. I will update sport article crawler as soon as possible.

User Python Installation

  • KoreaNewsCrawler

    pip install KoreaNewsCrawler

Method

  • set_category(category_name)

This method is setting categories that you want to crawl.
Categories that can be entered into parameters are politics, economy, society, living_culture, IT_science. Multiple parameters can be entered.

  • set_date_range(startyear, startmonth, endyear, endmonth)

This method represents the duration of the news you want to collect.
Data is collected from startmonth to endmonth.

  • start()

This method is the crawl execution method.

Example

from korea_news_crawler.articlecrawler import ArticleCrawler

Crawler = ArticleCrawler()  
Crawler.set_category("politics", "IT_science", "economy")  
Crawler.set_date_range(2017, 1, 2018, 4)  
Crawler.start()

From January 2017 to April 2018, Parallel crawls will be conducted using multiprocessors for political, IT science, world, and economic category news.

Multi Process Information

Testing with intel i5 9600 cpu showed an average ** 8% ** cpu share per category.
Please adjust the number of categories to match the specifications of the computer running the crawler, or use a loop.

ex_screenshot

Results

ex_screenshot ex_screenshot

Colum A: Article Date
Colum B: Article Category
Colum C: Article Press
Colum D: Article headline
Colum E: Article Content
Colum F: Article URL

All collected data is saved as a csv.

License

Apache License 2.0

koreanewscrawler's People

Contributors

lumyjuwon avatar minyoung347 avatar

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.