mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-02-11 20:19:36 +00:00
Added URL handling to a few more existing info providers
This commit is contained in:
parent
10acc2e130
commit
24f0f0d23c
5 changed files with 115 additions and 19 deletions
|
|
@ -32,7 +32,7 @@ use App\Services\InfoProviderSystem\DTOs\PurchaseInfoDTO;
|
|||
use App\Services\InfoProviderSystem\DTOs\SearchResultDTO;
|
||||
use App\Settings\InfoProviderSystem\TMESettings;
|
||||
|
||||
class TMEProvider implements InfoProviderInterface
|
||||
class TMEProvider implements InfoProviderInterface, URLHandlerInfoProviderInterface
|
||||
{
|
||||
|
||||
private const VENDOR_NAME = 'TME';
|
||||
|
|
@ -296,4 +296,22 @@ class TMEProvider implements InfoProviderInterface
|
|||
ProviderCapabilities::PRICE,
|
||||
];
|
||||
}
|
||||
|
||||
public function getHandledDomains(): array
|
||||
{
|
||||
return ['tme.eu'];
|
||||
}
|
||||
|
||||
public function getIDFromURL(string $url): ?string
|
||||
{
|
||||
//Input: https://www.tme.eu/de/details/fi321_se/kuhler/alutronic/
|
||||
//The ID is the part after the details segment and before the next slash
|
||||
|
||||
$matches = [];
|
||||
if (preg_match('#/details/([^/]+)/#', $url, $matches) === 1) {
|
||||
return $matches[1];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue