fedi-feed-router/app/Services/Parsers/BelgaHomepageParser.php

17 lines
365 B
PHP
Raw Normal View History

2025-06-29 21:39:28 +02:00
<?php
namespace App\Services\Parsers;
class BelgaHomepageParser
{
public static function extractArticleUrls(string $html): array
{
2025-06-30 21:28:15 +02:00
preg_match_all('/href="(https:\/\/www\.belganewsagency\.eu\/[a-z0-9-]+)"/', $html, $matches);
2025-06-29 21:39:28 +02:00
2025-06-30 21:28:15 +02:00
$urls = collect($matches[1] ?? [])
2025-06-29 21:39:28 +02:00
->unique()
->toArray();
return $urls;
}
}