mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-18 14:22:38 +02:00
[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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user