aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar sysadminstory <sysadminstory@users.noreply.github.com> 2025-02-03 15:35:48 +0100
committerGravatar GitHub <noreply@github.com> 2025-02-03 15:35:48 +0100
commit920b21b1fd432959371493121db81d5c98ed4fd3 (patch)
treefc3585430a410c219fd275208c1f59c0cf4cfb41
parent935075072b7937583818677daff31cad5037362f (diff)
downloadrss-bridge-920b21b1fd432959371493121db81d5c98ed4fd3.tar.gz
rss-bridge-920b21b1fd432959371493121db81d5c98ed4fd3.tar.zst
rss-bridge-920b21b1fd432959371493121db81d5c98ed4fd3.zip
[PepperBridgeAbstract, DealabsBridge, HotUKDealsBridge, MydealsBridge] Fixing bridge and add subcategories (#4436)
- Follow site change to get deal data (fix for #4432) - Add Categories (sub categories in reality) support
-rw-r--r--bridges/DealabsBridge.php11
-rw-r--r--bridges/HotUKDealsBridge.php11
-rw-r--r--bridges/MydealsBridge.php11
-rw-r--r--bridges/PepperBridgeAbstract.php25
4 files changed, 45 insertions, 13 deletions
diff --git a/bridges/DealabsBridge.php b/bridges/DealabsBridge.php
index a3d1aaa5..aed32529 100644
--- a/bridges/DealabsBridge.php
+++ b/bridges/DealabsBridge.php
@@ -48,6 +48,16 @@ https://www.dealabs.com/groupe/abonnements-internet?sortBy=lowest_price
Il faut alors saisir :
abonnements-internet',
],
+ 'subgroup' => [
+ 'name' => 'Catégorie',
+ 'type' => 'text',
+ 'exampleValue' => '1071',
+ 'title' => 'Numéro du ou des catégories dans l\'URL : Il faut entrer le ou les numéros de catégories qui sont présent après "groups=" et avant tout éventuel "&"
+Exemple : Si l\'URL du groupe affichées dans le navigateur est :
+https://www.dealabs.com/groupe/telecommunications?groups=1071%2C1070&sortBy=new
+Il faut alors saisir :
+1071%2C1070',
+ ],
'order' => [
'name' => 'Trier par',
'type' => 'list',
@@ -88,6 +98,7 @@ abonnements-internet',
'uri-group' => 'groupe/',
'uri-deal' => 'bons-plans/',
'uri-merchant' => 'search/bons-plans?merchant-id=',
+ 'image-host' => 'https://static-pepper.dealabs.com/',
'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é',
'currency' => '€',
diff --git a/bridges/HotUKDealsBridge.php b/bridges/HotUKDealsBridge.php
index 9d56fa97..f4d65c59 100644
--- a/bridges/HotUKDealsBridge.php
+++ b/bridges/HotUKDealsBridge.php
@@ -48,6 +48,16 @@ https://www.hotukdeals.com/tag/broadband?sortBy=temp
Then enter :
broadband',
],
+ 'subgrousp' => [
+ 'name' => 'category',
+ 'type' => 'text',
+ 'exampleValue' => '343563',
+ 'title' => 'Category number in the URL : The category number that must be entered is present after "groups=" and before any "&".
+Example: If the URL of the group displayed in the browser is :
+https://www.hotukdeals.com/tag/broadband?groups=343563&sortBy=new
+Then enter :
+343563',
+ ],
'order' => [
'name' => 'Order by',
'type' => 'list',
@@ -86,6 +96,7 @@ broadband',
'uri-group' => 'tag/',
'uri-deal' => 'deals/',
'uri-merchant' => 'search/deals?merchant-id=',
+ 'image-host' => 'https://images.hotukdeals.com/',
'request-error' => 'Could not request HotUKDeals',
'thread-error' => 'Unable to determine the thread ID. Check the URL you entered',
'currency' => '£',
diff --git a/bridges/MydealsBridge.php b/bridges/MydealsBridge.php
index 6be2adfb..65d6624c 100644
--- a/bridges/MydealsBridge.php
+++ b/bridges/MydealsBridge.php
@@ -48,6 +48,16 @@ https://www.mydealz.de/gruppe/dsl?sortBy=temp
Dann geben Sie ein:
dsl',
],
+ 'subgroups' => [
+ 'name' => 'Kategorie',
+ 'type' => 'text',
+ 'exampleValue' => '293',
+ 'title' => 'Nummer des Kategorie in der URL: Der einzugebende Kategorienummer steht nach "groups=" und vor einem "&".
+Beispiel: Wenn die URL der Gruppe, die im Browser angezeigt wird, :
+https://www.mydealz.de/gruppe/telefon-internet?groups=153%2C154&sortBy=new&time_frame=0
+Dann geben Sie ein:
+153%2C154',
+ ],
'order' => [
'name' => 'sortieren nach',
'type' => 'list',
@@ -84,6 +94,7 @@ dsl',
'uri-group' => 'gruppe/',
'uri-deal' => 'deals/',
'uri-merchant' => 'search/gutscheine?merchant-id=',
+ 'image-host' => 'https://static.mydealz.de/',
'request-error' => 'Could not request mydeals',
'thread-error' => 'Die ID der Diskussion kann nicht ermittelt werden. Überprüfen Sie die eingegebene URL',
'currency' => '€',
diff --git a/bridges/PepperBridgeAbstract.php b/bridges/PepperBridgeAbstract.php
index c64ad2fa..43dbe829 100644
--- a/bridges/PepperBridgeAbstract.php
+++ b/bridges/PepperBridgeAbstract.php
@@ -62,7 +62,7 @@ class PepperBridgeAbstract extends BridgeAbstract
foreach ($list as $deal) {
// Get the JSON Data stored as vue
$jsonDealData = $this->getDealJsonData($deal);
- $dealMeta = Json::decode($deal->find('div[class=threadGrid-headerMeta]', 0)->find('div[class=js-vue2]', 1)->getAttribute('data-vue2'));
+ $dealMeta = Json::decode($deal->find('div[class=js-vue2]', 1)->getAttribute('data-vue2'));
$item = [];
$item['uri'] = $this->getDealURI($jsonDealData);
@@ -80,7 +80,7 @@ class PepperBridgeAbstract extends BridgeAbstract
. $this->getShipsFrom($dealMeta)
. $this->getShippingCost($jsonDealData)
. $this->getSource($jsonDealData)
- . $this->getDealLocation($dealMeta)
+ . $this->getDealLocation($jsonDealData)
. $deal->find('div[class*=' . $selectorDescription . ']', 0)->innertext
. '</td><td>'
. $this->getTemperature($jsonDealData)
@@ -402,14 +402,9 @@ HEREDOC;
* Get the Deal location if it exists
* @return string String of the deal location
*/
- private function getDealLocation($dealMeta)
+ private function getDealLocation($jsonDealData)
{
- $ribbons = $dealMeta['props']['metaRibbons'];
- $isLocal = false;
- foreach ($ribbons as $ribbon) {
- $isLocal |= ($ribbon['type'] == 'local');
- }
- if ($isLocal) {
+ if ($jsonDealData['props']['thread']['isLocal']) {
$content = '<div>' . $this->i8n('deal-type') . ' : ' . $this->i8n('localdeal') . '</div>';
} else {
$content = '';
@@ -424,8 +419,11 @@ HEREDOC;
private function getImage($deal)
{
// Get thread Image JSON content
- $content = Json::decode($deal->find('div[class*=threadGrid-image]', 0)->find('div[class=js-vue2]', 0)->getAttribute('data-vue2'));
- return '<img src="' . $content['props']['threadImageUrl'] . '"/>';
+ $content = Json::decode($deal->find('div[class=js-vue2]', 0)->getAttribute('data-vue2'));
+ //return '<img src="' . $content['props']['threadImageUrl'] . '"/>';
+ return '<img src="' . $this->i8n('image-host') . $content['props']['thread']['mainImage']['path'] . '/'
+ . $content['props']['thread']['mainImage']['name'] . '/re/202x202/qt/70/'
+ . $content['props']['thread']['mainImage']['uid'] . '"/>';
}
/**
@@ -434,7 +432,7 @@ HEREDOC;
*/
private function getShipsFrom($dealMeta)
{
- $metas = $dealMeta['props']['metaRibbons'];
+ $metas = $dealMeta['props']['metaRibbons'] ?? [];
$shipsFrom = null;
foreach ($metas as $meta) {
if ($meta['type'] == 'dispatched-from') {
@@ -524,6 +522,7 @@ HEREDOC;
{
$group = $this->getInput('group');
$order = $this->getInput('order');
+ $subgroups = $this->getInput('subgroups');
// This permit to keep the existing Feed to work
if ($order == $this->i8n('context-hot')) {
@@ -533,7 +532,7 @@ HEREDOC;
}
$url = $this->i8n('bridge-uri')
- . $this->i8n('uri-group') . $group . '?sortBy=' . $sortBy;
+ . $this->i8n('uri-group') . $group . '?sortBy=' . $sortBy . '&groups=' . $subgroups;
return $url;
}