Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loadHtml does not work with latest version #198

Open
kgnfth opened this issue Apr 20, 2023 · 2 comments
Open

loadHtml does not work with latest version #198

kgnfth opened this issue Apr 20, 2023 · 2 comments

Comments

@kgnfth
Copy link

kgnfth commented Apr 20, 2023

Hello, my app uses version 1.18 and it works fine, when i use the latest version this code returns null

<?php

namespace App\Http\Controllers;

use DiDom\Document;

class HomeController extends Controller
{

    public function __construct(Document $document)
    {
        $this->document = $document;
    }

    public function getDashboardPosts()
    {
       $dom  = $this->document->loadHtml($value->body);
       // v1.18 works
       // v2.0+ does not work
       $dom->find('video');
       ....
       .....
    }
}

$value->body contains the following

<p><a class="tumblr_blog" href="https://www.tumblr.com/blog/view/redacted/2672873472">aaproudhus</a>:</p>
<blockquote>
    <figure class="tmblr-full" data-orig-height="1080" data-orig-width="608" data-npf='{"type":"video","provider":"tumblr","url":"https://va.media.tumblr.com/tumblr_rpiredacteduzdm.mp4","media":{"url":"https://va.media.tumblr.com/tumblr_rpiredacteduzdm.mp4","type":"video/mp4","width":608,"height":1080},"poster":[{"url":"https://64.media.tumblr.com/tumblr_rpiredacteduzdm_frame1.jpg","type":"image/jpeg","width":608,"height":1080}],"filmstrip":{"url":"https://64.media.tumblr.com/previews/tumblr_rpiredacteduzdm_filmstrip.jpg","type":"image/jpeg","width":2000,"height":357}}'>
        <video controls="controls" autoplay="autoplay" muted="muted" poster="https://64.media.tumblr.com/tumblr_rpit0redacted_frame1.jpg">
            <source src="https://va.media.tumblr.com/tumblr_rpiredacteduzdm.mp4" type="video/mp4"></source>
        </video>
    </figure>
</blockquote>
@bendbot
Copy link

bendbot commented Jun 28, 2023

Same problem.

@corpsepk
Copy link

corpsepk commented Dec 6, 2023

This commit make method loadHtml void.
Previously it return Document.

Do this:

$dom = $this->document;
$dom->loadHtml($value->body);
$dom->find('video');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants