diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Readability.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/Readability.php b/src/Readability.php index 4dcde3c..19ccd5d 100644 --- a/src/Readability.php +++ b/src/Readability.php @@ -1396,7 +1396,17 @@ class Readability foreach ($article->getElementsByTagName('img') as $img) { /** @var DOMElement $img */ - $src = $img->getAttribute('src'); + /* + * Extract all possible sources of img url and select the first one on the list. + */ + $url = [ + $img->getAttribute('src'), + $img->getAttribute('data-original'), + $img->getAttribute('data-url') + ]; + + $src = array_filter($url); + $src = reset($src); if ($src) { $img->setAttribute('src', $this->toAbsoluteURI($src)); } |