diff --git a/src/Models/HtmlPreview.php b/src/Models/HtmlPreview.php
index f1d61f6..a0c81f4 100644
--- a/src/Models/HtmlPreview.php
+++ b/src/Models/HtmlPreview.php
@@ -31,6 +31,16 @@ class HtmlPreview implements PreviewInterface
*/
private $title;
+ /**
+ * @var string $video Video for the page (chosen by the webmaster)
+ */
+ private $video;
+
+ /**
+ * @var string $videoType If there is video, what type it is
+ */
+ private $videoType;
+
/**
* Fields exposed
* @var array
@@ -39,6 +49,8 @@ class HtmlPreview implements PreviewInterface
'cover',
'images',
'title',
- 'description'
+ 'description',
+ 'video',
+ 'videoType',
];
-}
\ No newline at end of file
+}
diff --git a/src/Parsers/HtmlParser.php b/src/Parsers/HtmlParser.php
index ce4f43d..db85448 100644
--- a/src/Parsers/HtmlParser.php
+++ b/src/Parsers/HtmlParser.php
@@ -24,23 +24,34 @@ class HtmlParser extends BaseParser implements ParserInterface
*/
private $tags = [
'cover' => [
- ['selector' => 'meta[itemprop="image"]', 'attribute' => 'content'],
+ ['selector' => 'meta[property="twitter:image"]', 'attribute' => 'value'],
['selector' => 'meta[property="og:image"]', 'attribute' => 'content'],
- ['selector' => 'meta[property="twitter:image"]', 'attribute' => 'value']
+ ['selector' => 'meta[itemprop="image"]', 'attribute' => 'content'],
],
'title' => [
- ['selector' => 'meta[itemprop="name"]', 'attribute' => 'content'],
- ['selector' => 'meta[property="og:title"]', 'attribute' => 'content'],
['selector' => 'meta[property="twitter:title"]', 'attribute' => 'value'],
+ ['selector' => 'meta[property="og:title"]', 'attribute' => 'content'],
+ ['selector' => 'meta[itemprop="name"]', 'attribute' => 'content'],
['selector' => 'title']
],
'description' => [
- ['selector' => 'meta[itemprop="description"]', 'attribute' => 'content'],
+ ['selector' => 'meta[property="twitter:description"]', 'attribute' => 'content'],
['selector' => 'meta[property="og:description"]', 'attribute' => 'content'],
- ['selector' => 'meta[name="description"]', 'attribute' => 'content']
- ]
+ ['selector' => 'meta[itemprop="description"]', 'attribute' => 'content'],
+ ['selector' => 'meta[name="description"]', 'attribute' => 'content'],
+ ],
+
+ 'video' => [
+ ['selector' => 'meta[property="twitter:player:stream"]', 'attribute' => 'content'],
+ ['selector' => 'meta[property="og:video"]', 'attribute' => 'content'],
+ ],
+
+ 'videoType' => [
+ ['selector' => 'meta[property="twitter:player:stream:content_type"]', 'attribute' => 'content'],
+ ['selector' => 'meta[property="og:video:type"]', 'attribute' => 'content'],
+ ],
];
/**
@@ -168,6 +179,6 @@ protected function parseHtml(LinkInterface $link)
if (!isset($cover) && count($images)) $cover = $images[0];
- return compact('cover', 'title', 'description', 'images');
+ return compact('cover', 'title', 'description', 'images', 'video', 'videoType');
}
-}
\ No newline at end of file
+}