From 3b46217ffe62b743426785c8840177da66b6c040 Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Tue, 2 Jun 2020 10:53:42 +0900 Subject: [PATCH] sensitive flag (#133) --- src/general.ts | 5 ++++- src/summary.ts | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/general.ts b/src/general.ts index bc0ddc4..b4e03de 100644 --- a/src/general.ts +++ b/src/general.ts @@ -99,6 +99,8 @@ export default async (url: URL.Url, lang: string = null): Promise => { $('link[rel="icon"]').attr('href') || '/favicon.ico'; + const sensitive = $('.tweet').attr('data-possibly-sensitive') === 'true' + const find = (path: string) => new Promise(done => { const target = URL.resolve(url.href, path); request.head(target, (err, res) => { @@ -148,6 +150,7 @@ export default async (url: URL.Url, lang: string = null): Promise => { width: playerWidth || null, height: playerHeight || null }, - sitename: siteName || null + sitename: siteName || null, + sensitive, }; }; diff --git a/src/summary.ts b/src/summary.ts index 0eec20e..831396a 100644 --- a/src/summary.ts +++ b/src/summary.ts @@ -28,6 +28,11 @@ type Summary = { * The title of that web page */ title: string; + + /** + * Possibly sensitive + */ + sensitive?: boolean; }; export default Summary;