Update ThiladhunScraper.php
This commit is contained in:
		@@ -13,6 +13,7 @@ class ThiladhunScraper
 | 
			
		||||
    protected $guid;
 | 
			
		||||
    protected $image;
 | 
			
		||||
    protected $author;
 | 
			
		||||
    protected $topics = [];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * __construct.
 | 
			
		||||
@@ -52,6 +53,17 @@ class ThiladhunScraper
 | 
			
		||||
            $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) {
 | 
			
		||||
            $this->author = $node->text();
 | 
			
		||||
        });
 | 
			
		||||
@@ -67,7 +79,7 @@ class ThiladhunScraper
 | 
			
		||||
            'url'        => $url,
 | 
			
		||||
            'author'     => $this->author,
 | 
			
		||||
            'guid'       => $this->guid,
 | 
			
		||||
            'topics'       =>  [
 | 
			
		||||
            'topics'       =>  $this->topics ? : [
 | 
			
		||||
                [
 | 
			
		||||
                    "name" => "ވަކި މަޢުލޫއެއް ނޭންގެ",
 | 
			
		||||
                    "slug" => "no-specific-topic"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user