[WebfailBridge] Properly handle gifs (DOM changed)
This commit is contained in:
parent
6d1e8af982
commit
9124ed640e
1 changed files with 9 additions and 2 deletions
|
@ -99,14 +99,14 @@ class WebfailBridge extends BridgeAbstract {
|
||||||
$item = array();
|
$item = array();
|
||||||
$item['title'] = $this->fixTitle($article->find('a', 1)->innertext);
|
$item['title'] = $this->fixTitle($article->find('a', 1)->innertext);
|
||||||
|
|
||||||
// Webfail shares videos or images
|
// Images, videos and gifs are provided in their own unique way
|
||||||
if(!is_null($article->find('img.wf-image', 0))){ // Image type
|
if(!is_null($article->find('img.wf-image', 0))){ // Image type
|
||||||
$item['uri'] = $this->getURI() . $article->find('a', 2)->href;
|
$item['uri'] = $this->getURI() . $article->find('a', 2)->href;
|
||||||
$item['content'] = '<a href="'
|
$item['content'] = '<a href="'
|
||||||
. $item['uri']
|
. $item['uri']
|
||||||
. '"><img src="'
|
. '"><img src="'
|
||||||
. $article->find('img.wf-image', 0)->src
|
. $article->find('img.wf-image', 0)->src
|
||||||
. '">';
|
. '"></a>';
|
||||||
} elseif(!is_null($article->find('div.wf-video', 0))){ // Video type
|
} elseif(!is_null($article->find('div.wf-video', 0))){ // Video type
|
||||||
$videoId = $this->getVideoId($article->find('div.wf-play', 0)->onclick);
|
$videoId = $this->getVideoId($article->find('div.wf-play', 0)->onclick);
|
||||||
$item['uri'] = 'https://youtube.com/watch?v=' . $videoId;
|
$item['uri'] = 'https://youtube.com/watch?v=' . $videoId;
|
||||||
|
@ -115,6 +115,13 @@ class WebfailBridge extends BridgeAbstract {
|
||||||
. '"><img src="http://img.youtube.com/vi/'
|
. '"><img src="http://img.youtube.com/vi/'
|
||||||
. $videoId
|
. $videoId
|
||||||
. '/0.jpg"></a>';
|
. '/0.jpg"></a>';
|
||||||
|
} elseif(!is_null($article->find('video[id*=gif-]', 0))){ // Gif type
|
||||||
|
$item['uri'] = $this->getURI() . $article->find('a', 2)->href;
|
||||||
|
$item['content'] = '<video controls src="'
|
||||||
|
. $article->find('video[id*=gif-]', 0)->src
|
||||||
|
. '" poster="'
|
||||||
|
. $article->find('video[id*=gif-]', 0)->poster
|
||||||
|
. '"></video>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
|
|
Loading…
Reference in a new issue