Skip to content

Commit

Permalink
Revert "[WikipediaBridge] Update elements (RSS-Bridge#2167)"
Browse files Browse the repository at this point in the history
This reverts commit 5598fef.
  • Loading branch information
NikNikYkt authored Jun 24, 2021
1 parent 5598fef commit d818089
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions bridges/WikipediaBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,12 @@ private function addTodaysFeaturedArticleGeneric($element,
$anchorText = '...',
$anchorFallbackIndex = 0){
// Clean the bottom of the featured article
if ($element->find('ul', -1))
$element->find('ul', -1)->outertext = '';
elseif ($element->find('div', -1)) {
if ($element->find('div', -1))
$element->find('div', -1)->outertext = '';
}

// The title and URI of the article can be found in an anchor containing
// the string '...' in most wikis ('full article ...')
$target = $element->find('p a', $anchorFallbackIndex);
$target = $element->find('p/a', $anchorFallbackIndex);
foreach($element->find('//a') as $anchor) {
if(strpos($anchor->innertext, $anchorText) !== false) {
$target = $anchor;
Expand Down Expand Up @@ -219,11 +216,11 @@ private function loadFullArticle($uri){
private function getContentsDe($html, $subject, $fullArticle){
switch($subject) {
case WIKIPEDIA_SUBJECT_TFA:
$element = $html->find('div[id=artikel] div.hauptseite-box-content', 0);
$element = $html->find('div[id=mf-tfa]', 0);
$this->addTodaysFeaturedArticleGeneric($element, $fullArticle);
break;
case WIKIPEDIA_SUBJECT_DYK:
$element = $html->find('div[id=wissenswertes]', 0);
$element = $html->find('div[id=mf-dyk]', 0);
$this->addDidYouKnowGeneric($element, $fullArticle);
break;
default:
Expand Down Expand Up @@ -256,7 +253,7 @@ private function getContentsEn($html, $subject, $fullArticle){
switch($subject) {
case WIKIPEDIA_SUBJECT_TFA:
$element = $html->find('div[id=mp-tfa]', 0);
$this->addTodaysFeaturedArticleGeneric($element, $fullArticle, -1);
$this->addTodaysFeaturedArticleGeneric($element, $fullArticle);
break;
case WIKIPEDIA_SUBJECT_DYK:
$element = $html->find('div[id=mp-dyk]', 0);
Expand All @@ -273,12 +270,11 @@ private function getContentsEn($html, $subject, $fullArticle){
private function getContentsEo($html, $subject, $fullArticle){
switch($subject) {
case WIKIPEDIA_SUBJECT_TFA:
$element = $html->find('div[id=mf-artikolo-de-la-monato]', 0);
$element->find('div', -2)->outertext = '';
$element = $html->find('div[id=mf-artikolo-de-la-semajno]', 0);
$this->addTodaysFeaturedArticleGeneric($element, $fullArticle);
break;
case WIKIPEDIA_SUBJECT_DYK:
$element = $html->find('div.hp', 1)->find('table', 4)->find('td', -1);
$element = $html->find('div[id=mw-content-text]', 0)->find('table', 4)->find('td', 4);
$this->addDidYouKnowGeneric($element, $fullArticle);
break;
default:
Expand All @@ -292,12 +288,11 @@ private function getContentsEo($html, $subject, $fullArticle){
private function getContentsNl($html, $subject, $fullArticle){
switch($subject) {
case WIKIPEDIA_SUBJECT_TFA:
$element = $html->find('td[id=segment-Uitgelicht] div', 0);
$element->find('p', 1)->outertext = '';
$this->addTodaysFeaturedArticleGeneric($element, $fullArticle, 'Lees verder');
$element = $html->find('div[id=mf-uitgelicht]', 0);
$this->addTodaysFeaturedArticleGeneric($element, $fullArticle, 'Lees meer');
break;
case WIKIPEDIA_SUBJECT_DYK:
$element = $html->find('td[id=segment-Wist_je_dat] div', 0);
$element = $html->find('div[id=mw-content-text]', 0)->find('table', 4)->find('td', 2);
$this->addDidYouKnowGeneric($element, $fullArticle);
break;
default:
Expand Down

0 comments on commit d818089

Please sign in to comment.