[PepperBridge] Fix date parsing (#3727)

Website changed the date display.
This fix adapt the date parsing to the new website date display
This commit is contained in:
sysadminstory 2023-10-03 23:15:10 +02:00 committed by GitHub
parent 59dd49671d
commit 1cbe1a6f98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -3316,6 +3316,7 @@ class HotUKDealsBridge extends PepperBridgeAbstract
'and ' 'and '
], ],
'date-prefixes' => [ 'date-prefixes' => [
'Posted ',
'Found ', 'Found ',
'Refreshed ', 'Refreshed ',
'Made hot ' 'Made hot '

View File

@ -128,9 +128,9 @@ class PepperBridgeAbstract extends BridgeAbstract
$clock = end($clocks); $clock = end($clocks);
// Find the text corresponding to the clock // Find the text corresponding to the clock
$spanDateDiv = $clock->parent()->find('span[class=hide--toW3]', 0); $spanDateDiv = $clock->next_sibling();
$itemDate = $spanDateDiv->plaintext ?? ''; $itemDate = $spanDateDiv->plaintext;
// In case of a Local deal, there is no date, but we can use // In some case of a Local deal, there is no date, but we can use
// this case for other reason (like date not in the last field) // this case for other reason (like date not in the last field)
if ($this->contains($itemDate, $this->i8n('localdeal'))) { if ($this->contains($itemDate, $this->i8n('localdeal'))) {
$item['timestamp'] = time(); $item['timestamp'] = time();