2019-06-01 12:18:30 +03:00
|
|
|
<?php
|
2022-07-01 16:10:30 +03:00
|
|
|
|
|
|
|
class BinanceBridge extends BridgeAbstract
|
|
|
|
{
|
|
|
|
const NAME = 'Binance Blog';
|
|
|
|
const URI = 'https://www.binance.com/en/blog';
|
|
|
|
const DESCRIPTION = 'Subscribe to the Binance blog.';
|
|
|
|
const MAINTAINER = 'thefranke';
|
|
|
|
const CACHE_TIMEOUT = 3600; // 1h
|
|
|
|
|
|
|
|
public function collectData()
|
|
|
|
{
|
2023-10-13 21:48:08 +03:00
|
|
|
$url = 'https://www.binance.com/bapi/composite/v1/public/content/blog/list?category=&tag=&page=1&size=12';
|
|
|
|
$json = getContents($url);
|
|
|
|
$data = Json::decode($json, false);
|
|
|
|
foreach ($data->data->blogList as $post) {
|
2022-07-01 16:10:30 +03:00
|
|
|
$item = [];
|
2023-10-13 21:48:08 +03:00
|
|
|
$item['title'] = $post->title;
|
|
|
|
// Url slug not in json
|
|
|
|
//$item['uri'] = $uri;
|
|
|
|
$item['timestamp'] = $post->postTimeUTC / 1000;
|
2022-07-01 16:10:30 +03:00
|
|
|
$item['author'] = 'Binance';
|
2023-10-13 21:48:08 +03:00
|
|
|
$item['content'] = $post->brief;
|
|
|
|
//$item['categories'] = $category;
|
|
|
|
$item['uid'] = $post->idStr;
|
2022-07-01 16:10:30 +03:00
|
|
|
$this->items[] = $item;
|
|
|
|
}
|
|
|
|
}
|
2023-10-13 21:48:08 +03:00
|
|
|
|
|
|
|
public function getIcon()
|
|
|
|
{
|
|
|
|
return 'https://bin.bnbstatic.com/static/images/common/favicon.ico';
|
|
|
|
}
|
2019-06-01 12:18:30 +03:00
|
|
|
}
|