mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-04-23 23:16:53 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
37f3d093c1
@ -60,7 +60,7 @@ class Arte7Bridge extends BridgeAbstract {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = 'https://api.arte.tv/api/opa/v3/videos?sort=broadcastBegin&limit=10&language='
|
$url = 'https://api.arte.tv/api/opa/v3/videos?sort=-lastModified&limit=10&language='
|
||||||
. $lang
|
. $lang
|
||||||
. ($category != null ? '&category.code=' . $category : '');
|
. ($category != null ? '&category.code=' . $category : '');
|
||||||
|
|
||||||
|
@ -15,12 +15,6 @@ class PinterestBridge extends FeedExpander {
|
|||||||
'b' => array(
|
'b' => array(
|
||||||
'name' => 'board',
|
'name' => 'board',
|
||||||
'required' => true
|
'required' => true
|
||||||
),
|
|
||||||
'r' => array(
|
|
||||||
'name' => 'Use custom RSS',
|
|
||||||
'type' => 'checkbox',
|
|
||||||
'required' => false,
|
|
||||||
'title' => 'Uncheck to return data via custom filters (more data)'
|
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'From search' => array(
|
'From search' => array(
|
||||||
@ -34,12 +28,8 @@ class PinterestBridge extends FeedExpander {
|
|||||||
public function collectData(){
|
public function collectData(){
|
||||||
switch($this->queriedContext) {
|
switch($this->queriedContext) {
|
||||||
case 'By username and board':
|
case 'By username and board':
|
||||||
if($this->getInput('r')) {
|
$this->collectExpandableDatas($this->getURI() . '.rss');
|
||||||
$html = getSimpleHTMLDOMCached($this->getURI());
|
$this->fixLowRes();
|
||||||
$this->getUserResults($html);
|
|
||||||
} else {
|
|
||||||
$this->collectExpandableDatas($this->getURI() . '.rss');
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'From search':
|
case 'From search':
|
||||||
default:
|
default:
|
||||||
@ -48,49 +38,17 @@ class PinterestBridge extends FeedExpander {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getUserResults($html){
|
private function fixLowRes() {
|
||||||
$json = json_decode($html->find('#jsInit1', 0)->innertext, true);
|
|
||||||
$results = $json['tree']['children'][0]['children'][0]['children'][0]['options']['props']['data']['board_feed'];
|
|
||||||
$username = $json['resourceDataCache'][0]['data']['owner']['username'];
|
|
||||||
$fullname = $json['resourceDataCache'][0]['data']['owner']['full_name'];
|
|
||||||
$avatar = $json['resourceDataCache'][0]['data']['owner']['image_small_url'];
|
|
||||||
|
|
||||||
foreach($results as $result) {
|
$newitems = [];
|
||||||
$item = array();
|
$pattern = '/https\:\/\/i\.pinimg\.com\/[a-zA-Z0-9]*x\//';
|
||||||
|
foreach($this->items as $item) {
|
||||||
|
|
||||||
$item['uri'] = $result['link'];
|
$item["content"] = preg_replace($pattern, 'https://i.pinimg.com/originals/', $item["content"]);
|
||||||
|
$newitems[] = $item;
|
||||||
// Some use regular titles, others provide 'advanced' infos, a few
|
|
||||||
// provide even less info. Thus we attempt multiple options.
|
|
||||||
$item['title'] = trim($result['title']);
|
|
||||||
|
|
||||||
if($item['title'] === "")
|
|
||||||
$item['title'] = trim($result['rich_summary']['display_name']);
|
|
||||||
|
|
||||||
if($item['title'] === "")
|
|
||||||
$item['title'] = trim($result['description']);
|
|
||||||
|
|
||||||
$item['timestamp'] = strtotime($result['created_at']);
|
|
||||||
$item['username'] = $username;
|
|
||||||
$item['fullname'] = $fullname;
|
|
||||||
$item['avatar'] = $avatar;
|
|
||||||
$item['author'] = $item['username'] . ' (' . $item['fullname'] . ')';
|
|
||||||
$item['content'] = '<img align="left" style="margin: 2px 4px;" src="'
|
|
||||||
. htmlentities($item['avatar'])
|
|
||||||
. '" /><p><strong>'
|
|
||||||
. $item['username']
|
|
||||||
. '</strong><br>'
|
|
||||||
. $item['fullname']
|
|
||||||
. '</p><br><img src="'
|
|
||||||
. $result['images']['736x']['url']
|
|
||||||
. '" alt="" /><br><p>'
|
|
||||||
. $result['description']
|
|
||||||
. '</p>';
|
|
||||||
|
|
||||||
$item['enclosures'] = array($result['images']['orig']['url']);
|
|
||||||
|
|
||||||
$this->items[] = $item;
|
|
||||||
}
|
}
|
||||||
|
$this->items = $newitems;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getSearchResults($html){
|
private function getSearchResults($html){
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
<?php
|
|
||||||
class PlanetLibreBridge extends BridgeAbstract {
|
|
||||||
|
|
||||||
const MAINTAINER = 'pit-fgfjiudghdf';
|
|
||||||
const NAME = 'PlanetLibre';
|
|
||||||
const URI = 'http://www.planet-libre.org';
|
|
||||||
const DESCRIPTION = 'Returns the 5 newest posts from PlanetLibre (full text)';
|
|
||||||
|
|
||||||
private function extractContent($url){
|
|
||||||
$html2 = getSimpleHTMLDOM($url);
|
|
||||||
$text = $html2->find('div[class="post-text"]', 0)->innertext;
|
|
||||||
return $text;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function collectData(){
|
|
||||||
$html = getSimpleHTMLDOM(self::URI)
|
|
||||||
or returnServerError('Could not request PlanetLibre.');
|
|
||||||
$limit = 0;
|
|
||||||
foreach($html->find('div.post') as $element) {
|
|
||||||
if($limit < 5) {
|
|
||||||
$item = array();
|
|
||||||
$item['title'] = $element->find('h1', 0)->plaintext;
|
|
||||||
$item['uri'] = $element->find('a', 0)->href;
|
|
||||||
$item['timestamp'] = strtotime(
|
|
||||||
str_replace(
|
|
||||||
'/',
|
|
||||||
'-',
|
|
||||||
$element->find('div[class="post-date"]', 0)->plaintext
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
$item['content'] = $this->extractContent($item['uri']);
|
|
||||||
$this->items[] = $item;
|
|
||||||
$limit++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,7 +2,7 @@
|
|||||||
class SteamBridge extends BridgeAbstract {
|
class SteamBridge extends BridgeAbstract {
|
||||||
|
|
||||||
const NAME = 'Steam Bridge';
|
const NAME = 'Steam Bridge';
|
||||||
const URI = 'https://steamcommunity.com/';
|
const URI = 'https://store.steampowered.com/';
|
||||||
const CACHE_TIMEOUT = 3600; // 1h
|
const CACHE_TIMEOUT = 3600; // 1h
|
||||||
const DESCRIPTION = 'Returns games list';
|
const DESCRIPTION = 'Returns games list';
|
||||||
const MAINTAINER = 'jacknumber';
|
const MAINTAINER = 'jacknumber';
|
||||||
@ -68,62 +68,65 @@ class SteamBridge extends BridgeAbstract {
|
|||||||
|
|
||||||
$username = $this->getInput('username');
|
$username = $this->getInput('username');
|
||||||
$params = array(
|
$params = array(
|
||||||
'sort' => $this->getInput('sort'),
|
'cc' => $this->getInput('currency'),
|
||||||
'cc' => $this->getInput('currency')
|
'sort' => $this->getInput('sort')
|
||||||
);
|
);
|
||||||
|
|
||||||
$url = self::URI . 'id/' . $username . '/wishlist?' . http_build_query($params);
|
$url = self::URI . 'wishlist/id/' . $username . '/?' . http_build_query($params);
|
||||||
|
|
||||||
$html = '';
|
$jsonDataRegex = '/var g_rg(?:WishlistData|AppInfo) = ([^;]*)/';
|
||||||
$html = getSimpleHTMLDOM($url)
|
$content = getContents($url)
|
||||||
or returnServerError("Could not request Steam Wishlist. Tried:\n - $url");
|
or returnServerError("Could not request Steam Wishlist. Tried:\n - $url");
|
||||||
|
|
||||||
foreach($html->find('#wishlist_items .wishlistRow') as $element) {
|
preg_match_all($jsonDataRegex, $content, $matches, PREG_SET_ORDER, 0);
|
||||||
|
|
||||||
$gameTitle = $element->find('h4', 0)->plaintext;
|
$appList = json_decode($matches[0][1], true);
|
||||||
$gameUri = $element->find('.storepage_btn_ctn a', 0)->href;
|
$fullAppList = json_decode($matches[1][1], true);
|
||||||
$gameImg = $element->find('.gameListRowLogo img', 0)->src;
|
//var_dump($matches[1][1]);
|
||||||
|
//var_dump($fullAppList);
|
||||||
|
$sortedElementList = array_fill(0, count($appList), 0);
|
||||||
|
foreach($appList as $app) {
|
||||||
|
|
||||||
$discountBlock = $element->find('.discount_block', 0);
|
$sortedElementList[$app["priority"] - 1] = $app["appid"];
|
||||||
|
|
||||||
if($element->find('.discount_block', 0)) {
|
}
|
||||||
$gameHasPromo = 1;
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if($this->getInput('only_discount')) {
|
foreach($sortedElementList as $appId) {
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$gameHasPromo = 0;
|
$app = $fullAppList[$appId];
|
||||||
|
$gameTitle = $app["name"];
|
||||||
}
|
$gameUri = "http://store.steampowered.com/app/" . $appId . "/";
|
||||||
|
$gameImg = $app["capsule"];
|
||||||
if($gameHasPromo) {
|
|
||||||
|
|
||||||
$gamePromoValue = $discountBlock->find('.discount_pct', 0)->plaintext;
|
|
||||||
$gameOldPrice = $discountBlock->find('.discount_original_price', 0)->plaintext;
|
|
||||||
$gameNewPrice = $discountBlock->find('.discount_final_price', 0)->plaintext;
|
|
||||||
$gamePrice = $gameNewPrice;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$gamePrice = $element->find('.gameListPriceData .price', 0)->plaintext;
|
|
||||||
}
|
|
||||||
|
|
||||||
$item = array();
|
$item = array();
|
||||||
$item['uri'] = $gameUri;
|
$item['uri'] = $gameUri;
|
||||||
$item['title'] = $gameTitle;
|
$item['title'] = $gameTitle;
|
||||||
$item['price'] = $gamePrice;
|
|
||||||
$item['hasPromo'] = $gameHasPromo;
|
|
||||||
|
|
||||||
if($gameHasPromo) {
|
if(count($app["subs"]) > 0) {
|
||||||
|
if($app["subs"][0]["discount_pct"] != 0) {
|
||||||
|
|
||||||
$item['promoValue'] = $gamePromoValue;
|
$item['promoValue'] = $app["subs"][0]["discount_pct"];
|
||||||
$item['oldPrice'] = $gameOldPrice;
|
$item['oldPrice'] = $app["subs"][0]["price"] / 100 / ((100 - $gamePromoValue / 100));
|
||||||
$item['newPrice'] = $gameNewPrice;
|
$item['newPrice'] = $app["subs"][0]["price"] / 100;
|
||||||
|
$item['price'] = $item['newPrice'];
|
||||||
|
|
||||||
|
$item['hasPromo'] = true;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if($this->getInput('only_discount')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$item['price'] = $app["subs"][0]["price"] / 100;
|
||||||
|
$item['hasPromo'] = false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,8 @@ class VkBridge extends BridgeAbstract
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
protected $pageName;
|
||||||
|
|
||||||
public function getURI()
|
public function getURI()
|
||||||
{
|
{
|
||||||
if (!is_null($this->getInput('u'))) {
|
if (!is_null($this->getInput('u'))) {
|
||||||
@ -26,15 +28,24 @@ class VkBridge extends BridgeAbstract
|
|||||||
return parent::getURI();
|
return parent::getURI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
if ($this->pageName) {
|
||||||
|
return $this->pageName;
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::getName();
|
||||||
|
}
|
||||||
|
|
||||||
public function collectData()
|
public function collectData()
|
||||||
{
|
{
|
||||||
|
|
||||||
$text_html = $this->getContents()
|
$text_html = $this->getContents()
|
||||||
or returnServerError('No results for group or user name "' . $this->getInput('u') . '".');
|
or returnServerError('No results for group or user name "' . $this->getInput('u') . '".');
|
||||||
|
|
||||||
$text_html = iconv('windows-1251', 'utf-8', $text_html);
|
$text_html = iconv('windows-1251', 'utf-8', $text_html);
|
||||||
$html = str_get_html($text_html);
|
$html = str_get_html($text_html);
|
||||||
$pageName = $html->find('.page_name', 0)->plaintext;
|
$pageName = $html->find('.page_name', 0)->plaintext;
|
||||||
|
$this->pageName = $pageName;
|
||||||
|
|
||||||
foreach ($html->find('.post') as $post) {
|
foreach ($html->find('.post') as $post) {
|
||||||
|
|
||||||
|
@ -50,12 +50,28 @@ class YoutubeBridge extends BridgeAbstract {
|
|||||||
|
|
||||||
private function ytBridgeQueryVideoInfo($vid, &$author, &$desc, &$time){
|
private function ytBridgeQueryVideoInfo($vid, &$author, &$desc, &$time){
|
||||||
$html = $this->ytGetSimpleHTMLDOM(self::URI . "watch?v=$vid");
|
$html = $this->ytGetSimpleHTMLDOM(self::URI . "watch?v=$vid");
|
||||||
$author = $html->innertext;
|
|
||||||
$author = substr($author, strpos($author, '"author=') + 8);
|
|
||||||
$author = substr($author, 0, strpos($author, '\u0026'));
|
|
||||||
|
|
||||||
if(!is_null($html->find('div#watch-description-text', 0)))
|
// Skip unavailable videos
|
||||||
$desc = $html->find('div#watch-description-text', 0)->innertext;
|
if(!strpos($html->innertext, 'IS_UNAVAILABLE_PAGE')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($html->find('script') as $script) {
|
||||||
|
$data = trim($script->innertext);
|
||||||
|
|
||||||
|
if(strpos($data, '{') !== 0)
|
||||||
|
continue; // Wrong script
|
||||||
|
|
||||||
|
$json = json_decode($data);
|
||||||
|
|
||||||
|
if(!isset($json->itemListElement))
|
||||||
|
continue; // Wrong script
|
||||||
|
|
||||||
|
$author = $json->itemListElement[0]->item->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!is_null($html->find('#watch-description-text', 0)))
|
||||||
|
$desc = $html->find('#watch-description-text', 0)->innertext;
|
||||||
|
|
||||||
if(!is_null($html->find('meta[itemprop=datePublished]', 0)))
|
if(!is_null($html->find('meta[itemprop=datePublished]', 0)))
|
||||||
$time = strtotime($html->find('meta[itemprop=datePublished]', 0)->getAttribute('content'));
|
$time = strtotime($html->find('meta[itemprop=datePublished]', 0)->getAttribute('content'));
|
||||||
|
@ -70,6 +70,9 @@ if(!extension_loaded('openssl'))
|
|||||||
if(!extension_loaded('libxml'))
|
if(!extension_loaded('libxml'))
|
||||||
die('"libxml" extension not loaded. Please check "php.ini"');
|
die('"libxml" extension not loaded. Please check "php.ini"');
|
||||||
|
|
||||||
|
if(!extension_loaded('mbstring'))
|
||||||
|
die('"mbstring" extension not loaded. Please check "php.ini"');
|
||||||
|
|
||||||
// configuration checks
|
// configuration checks
|
||||||
if(ini_get('allow_url_fopen') !== "1")
|
if(ini_get('allow_url_fopen') !== "1")
|
||||||
die('"allow_url_fopen" is not set to "1". Please check "php.ini');
|
die('"allow_url_fopen" is not set to "1". Please check "php.ini');
|
||||||
|
Loading…
Reference in New Issue
Block a user