Skip to content

Commit

Permalink
[IGNBridge] Removed Ugly Nonworking Widgets (RSS-Bridge#1413)
Browse files Browse the repository at this point in the history
  • Loading branch information
IceWreck authored Feb 4, 2020
1 parent 5c2fcab commit b83736d
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions bridges/IGNBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,27 @@ protected function parseItem($newsItem){
// $articlePage gets the entire page's contents
$articlePage = getSimpleHTMLDOM($newsItem->link);

// List of BS elements
$uselessElements = array(
'.wiki-page-tools',
'.feedback-container',
'.paging-container',
'.dropdown-wrapper',
'.mw-editsection',
'.jsx-4115608983',
'.jsx-4213937408',
'.commerce-container',
'.widget-container',
'.newsletter-signup-button'
);

// Remove useless elements
foreach($uselessElements as $uslElement) {
foreach($articlePage->find($uslElement) as $jsWidget) {
$jsWidget->remove();
}
}

/*
* NOTE: Though articles and wiki/howtos have seperate styles of pages, there is no mechanism
* for handling them seperately as it just ignores the DOM querys which it does not find.
Expand All @@ -33,19 +54,8 @@ protected function parseItem($newsItem){
}

// For Wikis and HowTos
$uselessWikiElements = array(
'.wiki-page-tools',
'.feedback-container',
'.paging-container'
);
foreach($articlePage->find('.wiki-page') as $wikiContents) {
$copy = clone $wikiContents;
// Remove useless elements present in IGN wiki/howtos
foreach($uselessWikiElements as $uslElement) {
$toRemove = $wikiContents->find($uslElement, 0);
$copy = str_replace($toRemove, '', $copy);
}
$article = $article . $copy;
$article = $article . $wikiContents;
}

// Add content to feed
Expand Down

0 comments on commit b83736d

Please sign in to comment.