Add (rss post): add blacklist keywords
This commit is contained in:
@@ -27,6 +27,7 @@ public static function handleMulti($hours = 3)
|
|||||||
public static function handleSingle($rss_url, $hours = 3)
|
public static function handleSingle($rss_url, $hours = 3)
|
||||||
{
|
{
|
||||||
$blacklist_rss_post_domain = config('platform.global.blacklist_rss_post_domain');
|
$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);
|
$f = FeedReader::read($rss_url);
|
||||||
|
|
||||||
@@ -48,6 +49,16 @@ public static function handleSingle($rss_url, $hours = 3)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($blacklist_rss_post_keywords as $blacklist_keyword)
|
||||||
|
{
|
||||||
|
if (str_contains(strtolower($title), $blacklist_keyword))
|
||||||
|
{
|
||||||
|
continue 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$raw_posts[] = (object) [
|
$raw_posts[] = (object) [
|
||||||
'source' => $f->get_title(),
|
'source' => $f->get_title(),
|
||||||
'source_url' => $rss_url,
|
'source_url' => $rss_url,
|
||||||
|
|||||||
@@ -17,6 +17,10 @@
|
|||||||
'www.youtube.com',
|
'www.youtube.com',
|
||||||
],
|
],
|
||||||
|
|
||||||
|
'blacklist_rss_post_keywords' => [
|
||||||
|
'deal'
|
||||||
|
],
|
||||||
|
|
||||||
'rss' => [
|
'rss' => [
|
||||||
'http://news.ycombinator.com/rss',
|
'http://news.ycombinator.com/rss',
|
||||||
// 'http://blog.samaltman.com/posts.atom',
|
// 'http://blog.samaltman.com/posts.atom',
|
||||||
|
|||||||
Reference in New Issue
Block a user