mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-11-26 11:26:31 +03:00
[AskfmBridge] code simplification
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
parent
ff5ac1659f
commit
efb6ad9ff2
1 changed files with 2 additions and 3 deletions
|
@ -15,13 +15,12 @@ class AskfmBridge extends BridgeAbstract{
|
|||
);
|
||||
|
||||
public function collectData(){
|
||||
$html = '';
|
||||
$html = $this->getSimpleHTMLDOM($this->getURI())
|
||||
or $this->returnServerError('Requested username can\'t be found.');
|
||||
|
||||
foreach($html->find('div.streamItem-answer') as $element) {
|
||||
$item = array();
|
||||
$item['uri'] = 'http://ask.fm'.$element->find('a.streamItemsAge',0)->href;
|
||||
$item['uri'] = $this->uri.$element->find('a.streamItemsAge',0)->href;
|
||||
$question = trim($element->find('h1.streamItemContent-question',0)->innertext);
|
||||
$item['title'] = trim(htmlspecialchars_decode($element->find('h1.streamItemContent-question',0)->plaintext, ENT_QUOTES));
|
||||
$answer = trim($element->find('p.streamItemContent-answer',0)->innertext);
|
||||
|
@ -36,7 +35,7 @@ class AskfmBridge extends BridgeAbstract{
|
|||
}
|
||||
$content = '<p>' . $question . '</p><p>' . $answer . '</p><p>' . $visual . '</p>';
|
||||
// Fix relative links without breaking // scheme used by YouTube stuff
|
||||
$content = preg_replace('#href="\/(?!\/)#', 'href="http://ask.fm/',$content);
|
||||
$content = preg_replace('#href="\/(?!\/)#', 'href="'.$this->uri,$content);
|
||||
$item['content'] = $content;
|
||||
$this->items[] = $item;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue