fix(DarkReading): official rss endpoint changed (#3967)

This commit is contained in:
Dag 2024-02-09 08:03:04 +01:00 committed by GitHub
parent 8a6798a227
commit 6f731b20a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,7 +9,7 @@ class DarkReadingBridge extends FeedExpander
const PARAMETERS = [ [ const PARAMETERS = [ [
'feed' => [ 'feed' => [
'name' => 'Feed', 'name' => 'Feed (NOT IN USE)',
'type' => 'list', 'type' => 'list',
'values' => [ 'values' => [
'All Dark Reading Stories' => '000_AllArticles', 'All Dark Reading Stories' => '000_AllArticles',
@ -41,17 +41,7 @@ class DarkReadingBridge extends FeedExpander
public function collectData() public function collectData()
{ {
$feed = $this->getInput('feed'); $feed_url = 'https://www.darkreading.com/rss.xml';
$feed_splitted = explode('_', $feed);
$feed_id = $feed_splitted[0];
$feed_name = $feed_splitted[1];
if (empty($feed) || !ctype_digit($feed_id) || !preg_match('/[A-Za-z%20\/]/', $feed_name)) {
returnClientError('Invalid feed, please check the "feed" parameter.');
}
$feed_url = $this->getURI() . 'rss_simple.asp';
if ($feed_id != '000') {
$feed_url .= '?f_n=' . $feed_id . '&f_ln=' . $feed_name;
}
$limit = $this->getInput('limit') ?? 10; $limit = $this->getInput('limit') ?? 10;
$this->collectExpandableDatas($feed_url, $limit); $this->collectExpandableDatas($feed_url, $limit);
} }
@ -71,7 +61,7 @@ class DarkReadingBridge extends FeedExpander
private function extractArticleContent($article) private function extractArticleContent($article)
{ {
$content = $article->find('div.article-content', 0)->innertext; $content = $article->find('div.ContentModule-Wrapper', 0)->innertext;
foreach ( foreach (
[ [