19 lines
No EOL
458 B
PHP
19 lines
No EOL
458 B
PHP
<?php
|
|
|
|
namespace App\Services\Parsers;
|
|
|
|
class VrtHomepageParser
|
|
{
|
|
public static function extractArticleUrls(string $html): array
|
|
{
|
|
// Extract article links using regex
|
|
preg_match_all('/href="(\/vrtnws\/en\/\d{4}\/\d{2}\/\d{2}\/[^"]+)"/', $html, $matches);
|
|
|
|
$urls = collect($matches[1])
|
|
->unique()
|
|
->map(fn ($path) => 'https://www.vrt.be' . $path)
|
|
->toArray();
|
|
|
|
return $urls;
|
|
}
|
|
} |