mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-04-09 16:38:50 +00:00
[BinanceBridge] Remove announcements because of Cloudflare issue (#2610)
This commit is contained in:
parent
6ffe531e4f
commit
a3b0b91dee
@ -1,41 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
class BinanceBridge extends BridgeAbstract {
|
class BinanceBridge extends BridgeAbstract {
|
||||||
const NAME = 'Binance';
|
const NAME = 'Binance Blog';
|
||||||
const URI = 'https://www.binance.com';
|
const URI = 'https://www.binance.com/en/blog';
|
||||||
const DESCRIPTION = 'Subscribe to the Binance blog or the Binance Zendesk announcements.';
|
const DESCRIPTION = 'Subscribe to the Binance blog.';
|
||||||
const MAINTAINER = 'thefranke';
|
const MAINTAINER = 'thefranke';
|
||||||
const CACHE_TIMEOUT = 3600; // 1h
|
const CACHE_TIMEOUT = 3600; // 1h
|
||||||
|
|
||||||
const PARAMETERS = array( array(
|
|
||||||
'category' => array(
|
|
||||||
'name' => 'category',
|
|
||||||
'type' => 'list',
|
|
||||||
'exampleValue' => 'Blog',
|
|
||||||
'title' => 'Select a category',
|
|
||||||
'values' => array(
|
|
||||||
'Blog' => 'Blog',
|
|
||||||
'Announcements' => 'Announcements'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
));
|
|
||||||
|
|
||||||
public function getIcon() {
|
public function getIcon() {
|
||||||
return 'https://bin.bnbstatic.com/static/images/common/favicon.ico';
|
return 'https://bin.bnbstatic.com/static/images/common/favicon.ico';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName() {
|
public function collectData() {
|
||||||
return self::NAME . ' ' . $this->getInput('category');
|
$html = getSimpleHTMLDOM(self::URI)
|
||||||
}
|
or returnServerError('Could not fetch Binance blog data.');
|
||||||
|
|
||||||
public function getURI() {
|
|
||||||
if ($this->getInput('category') == 'Blog')
|
|
||||||
return self::URI . '/en/blog';
|
|
||||||
else
|
|
||||||
return 'https://binance.zendesk.com/hc/en-us/categories/115000056351-Announcements';
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function collectBlogData() {
|
|
||||||
$html = getSimpleHTMLDOM($this->getURI());
|
|
||||||
|
|
||||||
$appData = $html->find('script[id="__APP_DATA"]');
|
$appData = $html->find('script[id="__APP_DATA"]');
|
||||||
$appDataJson = json_decode($appData[0]->innertext);
|
$appDataJson = json_decode($appData[0]->innertext);
|
||||||
@ -61,37 +38,4 @@ class BinanceBridge extends BridgeAbstract {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function collectAnnouncementData() {
|
|
||||||
$html = getSimpleHTMLDOM($this->getURI());
|
|
||||||
|
|
||||||
foreach($html->find('a.article-list-link') as $a) {
|
|
||||||
$title = $a->innertext;
|
|
||||||
$uri = 'https://binance.zendesk.com' . $a->href;
|
|
||||||
|
|
||||||
$full = getSimpleHTMLDOMCached($uri);
|
|
||||||
$content = $full->find('div.article-body', 0);
|
|
||||||
$date = $full->find('time', 0)->getAttribute('datetime');
|
|
||||||
|
|
||||||
$item = array();
|
|
||||||
|
|
||||||
$item['title'] = $title;
|
|
||||||
$item['uri'] = $uri;
|
|
||||||
$item['timestamp'] = strtotime($date);
|
|
||||||
$item['author'] = 'Binance';
|
|
||||||
$item['content'] = $content;
|
|
||||||
|
|
||||||
$this->items[] = $item;
|
|
||||||
|
|
||||||
if (count($this->items) >= 10)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function collectData() {
|
|
||||||
if ($this->getInput('category') == 'Blog')
|
|
||||||
$this->collectBlogData();
|
|
||||||
else
|
|
||||||
$this->collectAnnouncementData();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user