20 lines
No EOL
409 B
PHP
20 lines
No EOL
409 B
PHP
<?php
|
|
|
|
namespace App\Services\Parsers;
|
|
|
|
class BelgaHomepageParser
|
|
{
|
|
/**
|
|
* @return array<int, string>
|
|
*/
|
|
public static function extractArticleUrls(string $html): array
|
|
{
|
|
preg_match_all('/href="(https:\/\/www\.belganewsagency\.eu\/[a-z0-9-]+)"/', $html, $matches);
|
|
|
|
$urls = collect($matches[1])
|
|
->unique()
|
|
->toArray();
|
|
|
|
return $urls;
|
|
}
|
|
} |