KoreaNewsCrawler
์ด ํฌ๋กค๋ฌ๋ ๋ค์ด๋ฒ ํฌํธ์ ์ฌ๋ผ์ค๋ ์ธ๋ก ์ฌ ๋ด์ค ๊ธฐ์ฌ๋ค์ ํฌ๋กค๋ง ํด์ฃผ๋ ํฌ๋กค๋ฌ์
๋๋ค.
ํฌ๋กค๋ง ๊ฐ๋ฅํ ๊ธฐ์ฌ ์นดํ
๊ณ ๋ฆฌ๋ ์ ์น, ๊ฒฝ์ , ์ํ๋ฌธํ, IT๊ณผํ, ์ฌํ, ์ธ๊ณ, ์คํผ๋์ธ์
๋๋ค.
์คํฌ์ธ ๊ธฐ์ฌ๊ฐ์ ๊ฒฝ์ฐ ํด์ธ์ผ๊ตฌ, ํด์ธ์ถ๊ตฌ, ํ๊ตญ์ผ๊ตฌ, ํ๊ตญ์ถ๊ตฌ, ๋๊ตฌ, ๋ฐฐ๊ตฌ, ๊ณจํ, ์ผ๋ฐ ์คํฌ์ธ , e์คํฌ์ธ ์
๋๋ค.
How to install
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()
์ด ๋ฉ์๋๋ ํฌ๋กค๋ง ์คํ ๋ฉ์๋์ ๋๋ค.
Article News Crawler Example
from korea_news_crawler.articlecrawler import ArticleCrawler
Crawler = ArticleCrawler()
Crawler.set_category("์ ์น", "IT๊ณผํ", "economy")
Crawler.set_date_range("2017-01", "2018-04-20")
Crawler.start()
2017๋ 1์ ~ 2018๋ 4์ 20์ผ๊น์ง ์ ์น, IT๊ณผํ, ๊ฒฝ์ ์นดํ ๊ณ ๋ฆฌ ๋ด์ค๋ฅผ ๋ฉํฐํ๋ก์ธ์๋ฅผ ์ด์ฉํ์ฌ ๋ณ๋ ฌ ํฌ๋กค๋ง์ ์งํํฉ๋๋ค.
Sports News Crawler Example
Method๋ ArticleCrawler()์ ์ ์ฌํฉ๋๋ค.
from korea_news_crawler.sportcrawler import SportCrawler
Spt_crawler = SportCrawler()
Spt_crawler.set_category('ํ๊ตญ์ผ๊ตฌ','ํ๊ตญ์ถ๊ตฌ')
Spt_crawler.set_date_range("2017-01", "2018-04-20")
Spt_crawler.start()
2017๋ 1์ ~ 2018๋ 4์ 20์ผ๊น์ง ํ๊ตญ์ผ๊ตฌ, ํ๊ตญ์ถ๊ตฌ ๋ด์ค๋ฅผ ๋ฉํฐํ๋ก์ธ์๋ฅผ ์ด์ฉํ์ฌ ๋ณ๋ ฌ ํฌ๋กค๋ง์ ์งํํฉ๋๋ค.
Results
Colum A: ๊ธฐ์ฌ ๋ ์ง & ์๊ฐ
Colum B: ๊ธฐ์ฌ ์นดํ
๊ณ ๋ฆฌ
Colum C: ์ธ๋ก ์ฌ
Colum D: ๊ธฐ์ฌ ์ ๋ชฉ
Colum E: ๊ธฐ์ฌ ๋ณธ๋ฌธ
Colum F: ๊ธฐ์ฌ ์ฃผ์
์์งํ ๋ชจ๋ ๋ฐ์ดํฐ๋ csv ํ์ฅ์๋ก ์ ์ฅ๋ฉ๋๋ค.
KoreaNewsCrawler (English version)
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 korea baseball, korea soccer, world baseball, world 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.
How to install
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.
Article News Crawler Example
from korea_news_crawler.articlecrawler import ArticleCrawler
Crawler = ArticleCrawler()
Crawler.set_category("politics", "IT_science", "economy")
Crawler.set_date_range("2017-01", "2018-04-20")
Crawler.start()
From January 2017 to April 20 2018, Parallel crawls will be conducted using multiprocessors for political, IT science, world, and economic category news.
Sports News Crawler Example
Method is similar to ArticleCrawler().
from korea_news_crawler.sportcrawler import SportCrawler
Spt_crawler = SportCrawler()
Spt_crawler.set_category('korea baseball','korea soccer')
Spt_crawler.set_date_range("2017-01", "2018-04-20")
Spt_crawler.start()
From January 2017 to April 20 2018, Parallel crawls will be conducted using multiprocessors for korea baseball, and korea soccer category news.
Results
Colum A: Article Date & Time
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.