php-readability icon indicating copy to clipboard operation
php-readability copied to clipboard

Call to undefined method DOMDocument::hasAttribute()

Open kolaente opened this issue 1 year ago • 2 comments

Trying to parse https://www.youngmoney.co/p/defense-fed with Graby's fetchContent results in an exception:

https://flareapp.io/share/yPa9qqKP (You need to expand the vendor frames to see the stack trace)

It looks like the error occures here: https://github.com/j0k3r/php-readability/blob/master/src/Readability.php#L1183

Not sure if this is a problem with the site or Graby or this package.

kolaente avatar Dec 25 '23 17:12 kolaente

What version of Graby are you using? I just tried on the 2.4.4 and I worked well:

<?php

declare(strict_types=1);

require 'vendor/autoload.php';

use Graby\Graby;

$article = 'https://www.youngmoney.co/p/defense-fed';

$graby = new Graby(['debug' => true]);
$result = $graby->fetchContent($article);

var_export($result);

j0k3r avatar Jan 03 '24 07:01 j0k3r

I'm using Graby 4c0b0365ddd3fbe877d05abf985a15dc1bf3ad75 (via dev-master) with https://github.com/j0k3r/graby/pull/286 and https://github.com/j0k3r/graby/pull/332

kolaente avatar Jan 04 '24 12:01 kolaente