[HDWallpapers] Adapt to some website changes (Fixes #1088). Add wallpapers to enclosures, and select "HD" as the default resolution

This commit is contained in:
Lyra 2019-04-07 22:02:11 +02:00
parent 90bf90d167
commit 98c2530984

View file

@ -16,13 +16,13 @@ class HDWallpapersBridge extends BridgeAbstract {
), ),
'r' => array( 'r' => array(
'name' => 'resolution', 'name' => 'resolution',
'defaultValue' => '1920x1200', 'defaultValue' => 'HD',
'exampleValue' => '1920x1200, 1680x1050,…' 'exampleValue' => 'HD, 1920x1200, 1680x1050,…'
) )
)); ));
public function collectData(){ public function collectData(){
$category = $this->category; $category = $this->getInput('c');
if(strrpos($category, 'wallpapers') !== strlen($category) - strlen('wallpapers')) { if(strrpos($category, 'wallpapers') !== strlen($category) - strlen('wallpapers')) {
$category .= '-desktop-wallpapers'; $category .= '-desktop-wallpapers';
} }
@ -45,13 +45,12 @@ class HDWallpapersBridge extends BridgeAbstract {
$thumbnail = $element->find('img', 0); $thumbnail = $element->find('img', 0);
$item = array(); $item = array();
// http://www.hdwallpapers.in/download/yosemite_reflections-1680x1050.jpg
$item['uri'] = self::URI $item['uri'] = self::URI
. '/download' . '/download'
. str_replace('wallpapers.html', $this->getInput('r') . '.jpg', $element->href); . str_replace('wallpapers.html', $this->getInput('r') . '.jpg', $element->href);
$item['timestamp'] = time(); $item['timestamp'] = time();
$item['title'] = $element->find('p', 0)->text(); $item['title'] = $element->find('em1', 0)->text();
$item['content'] = $item['title'] $item['content'] = $item['title']
. '<br><a href="' . '<br><a href="'
. $item['uri'] . $item['uri']
@ -60,6 +59,7 @@ class HDWallpapersBridge extends BridgeAbstract {
. $thumbnail->src . $thumbnail->src
. '" /></a>'; . '" /></a>';
$item['enclosures'] = array($item['uri']);
$this->items[] = $item; $this->items[] = $item;
$num++; $num++;