2019-12-01 13:27:41 +03:00
|
|
|
<?php
|
|
|
|
class FurAffinityUserBridge extends BridgeAbstract {
|
|
|
|
const NAME = 'FurAffinity User Gallery';
|
|
|
|
const URI = 'https://www.furaffinity.net';
|
|
|
|
const MAINTAINER = 'CyberJacob';
|
2022-03-31 21:28:46 +03:00
|
|
|
const DESCRIPTION = 'See https://rss-bridge.github.io/rss-bridge/Bridge_Specific/Furaffinityuser.html for explanation';
|
2019-12-01 13:27:41 +03:00
|
|
|
const PARAMETERS = array(
|
|
|
|
array(
|
|
|
|
'searchUsername' => array(
|
|
|
|
'name' => 'Search Username',
|
|
|
|
'type' => 'text',
|
|
|
|
'required' => true,
|
2022-03-25 17:33:34 +03:00
|
|
|
'title' => 'Username to fetch the gallery for',
|
|
|
|
'exampleValue' => 'armundy',
|
2019-12-01 13:27:41 +03:00
|
|
|
),
|
2022-03-31 21:28:46 +03:00
|
|
|
'aCookie' => array(
|
|
|
|
'name' => 'Login cookie \'a\'',
|
2019-12-01 13:27:41 +03:00
|
|
|
'type' => 'text',
|
|
|
|
'required' => true
|
|
|
|
),
|
2022-03-31 21:28:46 +03:00
|
|
|
'bCookie' => array(
|
|
|
|
'name' => 'Login cookie \'b\'',
|
2019-12-01 13:27:41 +03:00
|
|
|
'type' => 'text',
|
|
|
|
'required' => true
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
public function collectData() {
|
2022-03-31 21:28:46 +03:00
|
|
|
$opt = array(CURLOPT_COOKIE => 'b=' . $this->getInput('bCookie') . '; a=' . $this->getInput('aCookie'));
|
|
|
|
|
2019-12-01 13:27:41 +03:00
|
|
|
$url = self::URI . '/gallery/' . $this->getInput('searchUsername');
|
|
|
|
|
2022-03-31 21:28:46 +03:00
|
|
|
$html = getSimpleHTMLDOM($url, array(), $opt)
|
|
|
|
or returnServerError('Could not load the user\'s gallery page.');
|
2019-12-01 13:27:41 +03:00
|
|
|
|
|
|
|
$submissions = $html->find('section[id=gallery-gallery]', 0)->find('figure');
|
|
|
|
foreach($submissions as $submission) {
|
|
|
|
$item = array();
|
|
|
|
$item['title'] = $submission->find('figcaption', 0)->find('a', 0)->plaintext;
|
|
|
|
|
|
|
|
$thumbnail = $submission->find('a', 0);
|
|
|
|
$thumbnail->href = self::URI . $thumbnail->href;
|
|
|
|
|
|
|
|
$item['content'] = $submission->find('a', 0);
|
|
|
|
|
|
|
|
$this->items[] = $item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getName() {
|
|
|
|
return self::NAME . ' for ' . $this->getInput('searchUsername');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getURI() {
|
|
|
|
return self::URI . '/user/' . $this->getInput('searchUsername');
|
|
|
|
}
|
|
|
|
}
|