forked from blallo/rss-bridge
[Pinterest] Add implementation for user/board
The data is no longer provided in HTML upon request, but rather encoded as JSON in a SCRIPT section and decoded via Javascript on the client side. The bridge now decodes the data and returns valid feeds again.
This commit is contained in:
parent
f8e0a4afbc
commit
c3a1cbe98a
1 changed files with 22 additions and 0 deletions
|
@ -68,6 +68,28 @@ class PinterestBridge extends BridgeAbstract {
|
||||||
. $item['fullname'];
|
. $item['fullname'];
|
||||||
|
|
||||||
$item['title'] = $img->getAttribute('alt');
|
$item['title'] = $img->getAttribute('alt');
|
||||||
|
$this->items[] = $item;
|
||||||
|
}
|
||||||
|
} elseif($this->queriedContext === 'By username and board'){
|
||||||
|
$container = $html->find('SCRIPT[type="application/ld+json"]', 0)
|
||||||
|
or $this->returnServerError('Unable to find data container!');
|
||||||
|
|
||||||
|
$json = json_decode($container->innertext, true);
|
||||||
|
|
||||||
|
foreach($json['itemListElement'] as $element){
|
||||||
|
$item = array();
|
||||||
|
|
||||||
|
$item['uri'] = $element['item']['sharedContent']['author']['url'];
|
||||||
|
$item['title'] = $element['item']['name'];
|
||||||
|
$item['author'] = $element['item']['user']['name'];
|
||||||
|
$item['timestamp'] = strtotime($element['item']['datePublished']);
|
||||||
|
$item['content'] = <<<EOD
|
||||||
|
<a href="{$item['uri']}">
|
||||||
|
<img src="{$element['item']['image']}">
|
||||||
|
</a>
|
||||||
|
<p>{$element['item']['text']}</p>
|
||||||
|
EOD;
|
||||||
|
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue