Mihaaru scraper support
This commit is contained in:
@@ -15,15 +15,15 @@ class MihaaruService extends Client
|
||||
{
|
||||
|
||||
$articles = $this->get("https://mihaaru.com/rss")["channel"]["item"];
|
||||
|
||||
|
||||
$articlesitems = [];
|
||||
$emihaaru = new MihaaruScraper();
|
||||
$scraper = new MihaaruScraper();
|
||||
|
||||
foreach ($articles as $article) {
|
||||
$link = $article['link'];
|
||||
$date = $article['pubDate'];
|
||||
$guid = $article['guid'];
|
||||
$articlesitems[] = $emihaaru->extract($link, $date, $guid);
|
||||
$articlesitems[] = $scraper->extract($link, $date, $guid);
|
||||
}
|
||||
|
||||
return $articlesitems;
|
||||
|
@@ -19,7 +19,7 @@ class MihaaruScraper
|
||||
$this->client = new Client;
|
||||
}
|
||||
|
||||
public function extract($url)
|
||||
public function extract($url, $date = null, $guid = null)
|
||||
{
|
||||
|
||||
$crawler = $this->client->request('GET', $url);
|
||||
@@ -66,6 +66,8 @@ class MihaaruScraper
|
||||
'image' => $this->image,
|
||||
'content' => $this->content,
|
||||
'url' => $url,
|
||||
'date' => $date,
|
||||
'guid' => $guid,
|
||||
'author' => $this->author,
|
||||
'topics' => $this->tags,
|
||||
];
|
||||
|
Reference in New Issue
Block a user