From 81926bc9f404a16e1d568af785991393064d9936 Mon Sep 17 00:00:00 2001 From: Denis Mysenko Date: Wed, 22 Mar 2017 09:04:18 +1100 Subject: [PATCH] f Unicode bug in symfony crawler --- src/Parsers/HtmlParser.php | 3 ++- tests/LinkPreview/Tests/LinkPreviewTest.php | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Parsers/HtmlParser.php b/src/Parsers/HtmlParser.php index db85448..de0ff90 100644 --- a/src/Parsers/HtmlParser.php +++ b/src/Parsers/HtmlParser.php @@ -140,7 +140,8 @@ protected function parseHtml(LinkInterface $link) $images = []; try { - $parser = new Crawler($link->getContent()); + $parser = new Crawler(); + $parser->addHtmlContent($link->getContent()); // Parse all known tags foreach($this->tags as $tag => $selectors) { diff --git a/tests/LinkPreview/Tests/LinkPreviewTest.php b/tests/LinkPreview/Tests/LinkPreviewTest.php index e0506c5..37b2c90 100644 --- a/tests/LinkPreview/Tests/LinkPreviewTest.php +++ b/tests/LinkPreview/Tests/LinkPreviewTest.php @@ -98,8 +98,8 @@ public function can_set_an_url() */ public function can_parse_a_youtube_link() { - $linkPreview = new Client('https://www.youtube.com/watch?v=C0DPdy98e4c'); + $linkPreview = new Client('https://www.youtube.com/watch?v=ycGfvA1vkR8'); $parsedLink = $linkPreview->getPreview('youtube'); self::assertInstanceOf('Dusterio\LinkPreview\Models\VideoPreview', $parsedLink); } -} \ No newline at end of file +}