2025-06-29 21:33:18 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Services\Parsers;
|
|
|
|
|
|
|
|
|
|
use App\Contracts\HomepageParserInterface;
|
|
|
|
|
|
|
|
|
|
class VrtHomepageParserAdapter implements HomepageParserInterface
|
|
|
|
|
{
|
2026-03-07 18:02:27 +01:00
|
|
|
public function __construct(
|
|
|
|
|
private string $language = 'en',
|
|
|
|
|
) {}
|
|
|
|
|
|
2025-06-29 21:33:18 +02:00
|
|
|
public function canParse(string $url): bool
|
|
|
|
|
{
|
|
|
|
|
return str_contains($url, 'vrt.be');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function extractArticleUrls(string $html): array
|
|
|
|
|
{
|
2026-03-07 18:02:27 +01:00
|
|
|
return VrtHomepageParser::extractArticleUrls($html, $this->language);
|
2025-06-29 21:33:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getHomepageUrl(): string
|
|
|
|
|
{
|
2026-03-07 18:02:27 +01:00
|
|
|
return "https://www.vrt.be/vrtnws/{$this->language}/";
|
2025-06-29 21:33:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getSourceName(): string
|
|
|
|
|
{
|
|
|
|
|
return 'VRT News';
|
|
|
|
|
}
|
2026-03-08 14:18:28 +01:00
|
|
|
}
|