There was an error while loading. Please reload this page.
1 parent fe13a51 commit d51d462Copy full SHA for d51d462
1 file changed
src/Import/ArticleImport.php
@@ -78,9 +78,13 @@ public static function getBodyTextByHtml($html)
78
79
public static function getTitleTextByHtml($html)
80
{
81
- $dom = new \DOMDocument();
82
- @$dom->loadHTML($html, LIBXML_NOERROR | LIBXML_NOWARNING);
83
- $title = $dom->getElementsByTagName('title')->item(0)->nodeValue;
+ try {
+ $dom = new \DOMDocument();
+ @$dom->loadHTML($html, LIBXML_NOERROR | LIBXML_NOWARNING);
84
+ $title = $dom->getElementsByTagName('title')->item(0)->nodeValue;
85
+ } catch (\Throwable $th) {
86
+ $title = '';
87
+ }
88
return trim($title);
89
}
90
0 commit comments