Add (rss post): add blacklist keywords

This commit is contained in:
2023-11-25 16:48:01 +08:00
parent 68cb6415e4
commit 6f93d5cc60
2 changed files with 15 additions and 0 deletions

View File

@@ -27,6 +27,7 @@ public static function handleMulti($hours = 3)
public static function handleSingle($rss_url, $hours = 3)
{
$blacklist_rss_post_domain = config('platform.global.blacklist_rss_post_domain');
$blacklist_rss_post_keywords = config('platform.global.blacklist_rss_post_keywords');
$f = FeedReader::read($rss_url);
@@ -48,6 +49,16 @@ public static function handleSingle($rss_url, $hours = 3)
continue;
}
foreach ($blacklist_rss_post_keywords as $blacklist_keyword)
{
if (str_contains(strtolower($title), $blacklist_keyword))
{
continue 2;
}
}
$raw_posts[] = (object) [
'source' => $f->get_title(),
'source_url' => $rss_url,