2018-08-05 00:42:58 +03:00
|
|
|
<?php
|
|
|
|
|
2022-07-01 16:10:30 +03:00
|
|
|
class ForGifsBridge extends FeedExpander
|
|
|
|
{
|
|
|
|
const MAINTAINER = 'logmanoriginal';
|
|
|
|
const NAME = 'forgifs Bridge';
|
|
|
|
const URI = 'https://forgifs.com';
|
|
|
|
const DESCRIPTION = 'Returns the forgifs feed with actual gifs instead of images';
|
|
|
|
|
|
|
|
public function collectData()
|
|
|
|
{
|
|
|
|
$this->collectExpandableDatas('https://forgifs.com/gallery/srss/7');
|
|
|
|
}
|
|
|
|
|
2023-10-13 02:59:05 +03:00
|
|
|
protected function parseItem(array $item)
|
2022-07-01 16:10:30 +03:00
|
|
|
{
|
2023-10-13 01:25:34 +03:00
|
|
|
$dom = str_get_html($item['content']);
|
|
|
|
$img = $dom->find('img', 0);
|
2022-07-01 16:10:30 +03:00
|
|
|
$poster = $img->src;
|
|
|
|
|
|
|
|
// The actual gif is the same path but its id must be decremented by one.
|
|
|
|
// Example:
|
|
|
|
// http://forgifs.com/gallery/d/279419-2/Reporter-videobombed-shoulder-checks.gif
|
|
|
|
// http://forgifs.com/gallery/d/279418-2/Reporter-videobombed-shoulder-checks.gif
|
|
|
|
// Notice how this changes ----------^
|
|
|
|
// Now let's extract that number and do some math
|
|
|
|
// Notice: Technically we could also load the content page but that would
|
|
|
|
// require unnecessary traffic. As long as it works...
|
|
|
|
$num = substr($img->src, 29, 6);
|
|
|
|
$num -= 1;
|
|
|
|
$img->src = substr_replace($img->src, $num, 29, strlen($num));
|
|
|
|
$img->width = 'auto';
|
|
|
|
$img->height = 'auto';
|
|
|
|
|
2023-10-13 01:25:34 +03:00
|
|
|
$item['content'] = (string) $dom;
|
2022-07-01 16:10:30 +03:00
|
|
|
|
|
|
|
return $item;
|
|
|
|
}
|
2018-08-05 00:42:58 +03:00
|
|
|
}
|