mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-04-13 18:38:48 +00:00
Create PocketExploreBridge.php
This commit is contained in:
parent
776a1f47f3
commit
50e1513ad0
39
bridges/PocketExploreBridge.php
Normal file
39
bridges/PocketExploreBridge.php
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
class PocketExploreBridge extends BridgeAbstract {
|
||||||
|
const NAME = 'Pocket Explore Bridge';
|
||||||
|
const URI = 'https://getpocket.com/';
|
||||||
|
const CACHE_TIMEOUT = 1;
|
||||||
|
const DESCRIPTION = 'Fetches recommendations from Pocket Explore (What you can see on the Firefox Home)';
|
||||||
|
const MAINTAINER = 'dhuschde';
|
||||||
|
const PARAMETERS = [[
|
||||||
|
'language' => [
|
||||||
|
'name' => 'Language',
|
||||||
|
'required' => true,
|
||||||
|
'exampleValue' => 'en',
|
||||||
|
],
|
||||||
|
'region' => [
|
||||||
|
'name' => 'Region',
|
||||||
|
'required' => true,
|
||||||
|
'exampleValue' => 'US',
|
||||||
|
],
|
||||||
|
]];
|
||||||
|
|
||||||
|
public function collectData() {
|
||||||
|
$language = $this->getInput('language');
|
||||||
|
$region = $this->getInput('region');
|
||||||
|
|
||||||
|
$url = 'https://getpocket.cdn.mozilla.net/v3/firefox/global-recs?version=3&consumer_key=40249-e88c401e1b1f2242d9e441c4&locale_lang=' . $language . '®ion=' . $region . '&count=30';
|
||||||
|
|
||||||
|
$json = getContents($url);
|
||||||
|
$data = json_decode($json, true);
|
||||||
|
|
||||||
|
foreach ($data['recommendations'] as $recommendation) {
|
||||||
|
$this->items[] = array(
|
||||||
|
'title' => $recommendation['title'],
|
||||||
|
'uri' => $recommendation['url'],
|
||||||
|
'author' => $recommendation['domain'],
|
||||||
|
'content' => "<img src='" . $recommendation['raw_image_src'] . "'></img><p>" . $recommendation['excerpt'] . "</p>",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user