From 9f4f70b370a92a259e5694a68758283ac69ba44b Mon Sep 17 00:00:00 2001 From: Muhun Kim Date: Thu, 15 Aug 2019 12:35:30 +0900 Subject: [PATCH] =?UTF-8?q?JTBC=20=EB=AA=A8=EB=B0=94=EC=9D=BC=20=EC=82=AC?= =?UTF-8?q?=EC=9D=B4=ED=8A=B8=20=EC=A7=80=EC=9B=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...C-\353\252\250\353\260\224\354\235\274.ts" | 31 +++++++++++++++++++ src/sites.ts | 3 +- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 "src/impl/JTBC-\353\252\250\353\260\224\354\235\274.ts" diff --git "a/src/impl/JTBC-\353\252\250\353\260\224\354\235\274.ts" "b/src/impl/JTBC-\353\252\250\353\260\224\354\235\274.ts" new file mode 100644 index 00000000..fc50e5e2 --- /dev/null +++ "b/src/impl/JTBC-\353\252\250\353\260\224\354\235\274.ts" @@ -0,0 +1,31 @@ +import * as $ from 'jquery'; +import * as moment from 'moment'; + +import { + Article, + ReadyToParse, +} from '..'; +import { + clearStyles, + parseTimestamp, +} from '../util'; + + +export const readyToParse: ReadyToParse = wait => wait('.sns_area'); + +// 사이드바 후처리 +export const cleanup = () => $('#sidr').remove(); + +export function parse(): Article { + const articleBodyElement = $('#article_content_area')[0].cloneNode(true) as HTMLElement; + return { + title: $('.artical_hd > h3').text(), + content: (() => { + { // 광고 + $('[id^=mobonDivBanner_]', articleBodyElement).remove(); + } + return clearStyles(articleBodyElement).innerHTML; + })(), + timestamp: parseTimestamp($('.author').text()) + }; +} diff --git a/src/sites.ts b/src/sites.ts index 5ead311e..6be89244 100644 --- a/src/sites.ts +++ b/src/sites.ts @@ -2,7 +2,8 @@ export default { // i 'ITWORLD': ['www.itworld.co.kr/news/*'], // j - 'JTBC': ['news.jtbc.joins.com/article/*', 'news.jtbc.joins.com/html/*'], + 'JTBC': ['news.jtbc.joins.com/article/*', 'news.jtbc.joins.com/html/*'], + 'JTBC-모바일': ['mnews.jtbc.joins.com/News/Article.aspx?*'], // k 'KBS': ['news.kbs.co.kr/news/view.do?*'], 'KBS World': ['world.kbs.co.kr/*/news/news_*_detail.htm*'],