Skip to content

Commit

Permalink
[PepperBridgeAbstract,DealabsBridge,HotUKDealsBridge,MydealsBridge] F…
Browse files Browse the repository at this point in the history
…ix search URL, No results handling fixed, Thread title and Message URL handling (RSS-Bridge#4053)

* [PepperBridgeAbstract,DealabsBridge,HotUKDealsBridge,MydealsBridge] Fix search URL, No results handling fixed, Thread title and Message URL handling

Search URL has been updated according to the website.

If a search doesn't return any results, the HTML won't contain any
specific text now : the HTML structure is slightly different, so the
bridge has been updated.

The unnneded 'no-results' text is now removed from the specific bridges.

The board thread title has been removed from the content, so now we use
the page <title> element.

In case a board message is empty, there was an exception during the
filtering of message without URL.

* [PepperBridgeAbstract,DealabsBridge,HotUKDealsBridge,MydealsBridge] Fix search URL, No results handling fixed, Thread title and Message URL handling

Coding policy fixes
  • Loading branch information
sysadminstory authored Apr 4, 2024
1 parent 94292af commit 82606a4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
1 change: 0 additions & 1 deletion bridges/DealabsBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -1913,7 +1913,6 @@ class DealabsBridge extends PepperBridgeAbstract
'uri-merchant' => 'search/bons-plans?merchant-id=',
'request-error' => 'Impossible de joindre Dealabs',
'thread-error' => 'Impossible de déterminer l\'ID de la discussion. Vérifiez l\'URL que vous avez entré',
'no-results' => 'Aucun résultat',
'currency' => '',
'price' => 'Prix',
'shipping' => 'Livraison',
Expand Down
1 change: 0 additions & 1 deletion bridges/HotUKDealsBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -3277,7 +3277,6 @@ class HotUKDealsBridge extends PepperBridgeAbstract
'uri-merchant' => 'search/deals?merchant-id=',
'request-error' => 'Could not request HotUKDeals',
'thread-error' => 'Unable to determine the thread ID. Check the URL you entered',
'no-results' => 'no results',
'currency' => '£',
'price' => 'Price',
'shipping' => 'Shipping',
Expand Down
1 change: 0 additions & 1 deletion bridges/MydealsBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -2024,7 +2024,6 @@ class MydealsBridge extends PepperBridgeAbstract
'uri-merchant' => 'search/gutscheine?merchant-id=',
'request-error' => 'Could not request mydeals',
'thread-error' => 'Die ID der Diskussion kann nicht ermittelt werden. Überprüfen Sie die eingegebene URL',
'no-results' => 'keine Ergebnisse',
'currency' => '',
'price' => 'Preis',
'shipping' => 'Versand',
Expand Down
25 changes: 14 additions & 11 deletions bridges/PepperBridgeAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ protected function collectDeals($url)
);

// If there is no results, we don't parse the content because it display some random deals
$noresult = $html->find('h3[class*=text--b]', 0);
if ($noresult != null && strpos($noresult->plaintext, $this->i8n('no-results')) !== false) {
$noresult = $html->find('section[class=subNav]', 0)->find('div[class*=page-center listLayout aGrid]', 0);
if ($noresult === null) {
$this->items = [];
} else {
foreach ($list as $deal) {
Expand Down Expand Up @@ -174,13 +174,16 @@ protected function collectDataTalk()
$item['uid'] = $comment->commentId;
// Timestamp handling needs a new parsing function
if ($onlyWithUrl == true) {
// Count Links and Quote Links
$content = str_get_html($item['content']);
$countLinks = count($content->find('a[href]'));
$countQuoteLinks = count($content->find('a[href][class=userHtml-quote-source]'));
// Only add element if there are Links ans more links tant Quote links
if ($countLinks > 0 && $countLinks > $countQuoteLinks) {
$this->items[] = $item;
// Only parse the comment if it is not empry
if ($item['content'] != '') {
// Count Links and Quote Links
$content = str_get_html($item['content']);
$countLinks = count($content->find('a[href]'));
$countQuoteLinks = count($content->find('a[href][class=userHtml-quote-source]'));
// Only add element if there are Links and more links tant Quote links
if ($countLinks > 0 && $countLinks > $countQuoteLinks) {
$this->items[] = $item;
}
}
} else {
$this->items[] = $item;
Expand Down Expand Up @@ -264,7 +267,7 @@ private function getTitle($jsonDealData)
private function getTalkTitle()
{
$html = getSimpleHTMLDOMCached($this->getInput('url'));
$title = $html->find('.thread-title', 0)->plaintext;
$title = $html->find('title', 0)->plaintext;
return $title;
}

Expand Down Expand Up @@ -472,7 +475,7 @@ private function getSearchURI()
$priceFrom = $this->getInput('priceFrom');
$priceTo = $this->getInput('priceTo');
$url = $this->i8n('bridge-uri')
. 'search/advanced?q='
. 'search?q='
. urlencode($q)
. '&hide_expired=' . $hide_expired
. '&hide_local=' . $hide_local
Expand Down

0 comments on commit 82606a4

Please sign in to comment.