Update ThiladhunScraper.php
This commit is contained in:
@@ -13,6 +13,7 @@ class ThiladhunScraper
|
|||||||
protected $guid;
|
protected $guid;
|
||||||
protected $image;
|
protected $image;
|
||||||
protected $author;
|
protected $author;
|
||||||
|
protected $topics = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* __construct.
|
* __construct.
|
||||||
@@ -52,6 +53,17 @@ class ThiladhunScraper
|
|||||||
$this->image = $node->attr('src');
|
$this->image = $node->attr('src');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$crawler->filter('.entry-tags a')->each(function ($node) {
|
||||||
|
if(!preg_match('/[^A-Za-z0-9-]/', basename($node->attr('href'))))
|
||||||
|
{
|
||||||
|
$this->topics[] = [
|
||||||
|
"name" => $node->text(),
|
||||||
|
"slug" => basename($node->attr('href'))
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
$crawler->filter('a[class*="entry-author__name"]')->each(function ($node) {
|
$crawler->filter('a[class*="entry-author__name"]')->each(function ($node) {
|
||||||
$this->author = $node->text();
|
$this->author = $node->text();
|
||||||
});
|
});
|
||||||
@@ -67,7 +79,7 @@ class ThiladhunScraper
|
|||||||
'url' => $url,
|
'url' => $url,
|
||||||
'author' => $this->author,
|
'author' => $this->author,
|
||||||
'guid' => $this->guid,
|
'guid' => $this->guid,
|
||||||
'topics' => [
|
'topics' => $this->topics ? : [
|
||||||
[
|
[
|
||||||
"name" => "ވަކި މަޢުލޫއެއް ނޭންގެ",
|
"name" => "ވަކި މަޢުލޫއެއް ނޭންގެ",
|
||||||
"slug" => "no-specific-topic"
|
"slug" => "no-specific-topic"
|
||||||
|
Reference in New Issue
Block a user