j0k3r / php-readability

A fork of https://bitbucket.org/fivefilters/php-readability
Apache License 2.0
169 stars 36 forks source link

Call to undefined method DOMDocument::hasAttribute() #84

Open kolaente opened 10 months ago

kolaente commented 10 months ago

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.

j0k3r commented 10 months ago

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);
kolaente commented 10 months ago

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