[BinanceBridge] Fix blog posts (#2226)

This commit is contained in:
Tobias Alexander Franke 2021-07-29 18:55:36 +02:00 committed by GitHub
parent 877707f7b2
commit c673917aca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -38,25 +38,21 @@ class BinanceBridge extends BridgeAbstract {
$html = getSimpleHTMLDOM($this->getURI()) $html = getSimpleHTMLDOM($this->getURI())
or returnServerError('Could not fetch Binance blog data.'); or returnServerError('Could not fetch Binance blog data.');
foreach($html->find('div[direction="row"]') as $element) { $appData = $html->find('script[id="__APP_DATA"]');
$appDataJson = json_decode($appData[0]->innertext);
$date = $element->find('div[direction="column"]', 0); foreach($appDataJson->pageData->redux->blogList->blogList as $element) {
$day = $date->find('div', 0)->innertext;
$month = $date->find('div', 1)->innertext;
$extractedDate = $day . ' ' . $month;
$abstract = $element->find('div[direction="column"]', 1); $date = $element->postTime;
$a = $abstract->find('a', 0); $abstract = $element->brief;
$uri = self::URI . $a->href; $uri = self::URI . '/' . $element->lang . '/blog/' . $element->idStr;
$title = $a->innertext; $title = $element->title;
$content = $element->content;
$full = getSimpleHTMLDOMCached($uri);
$content = $full->find('div.desc', 1);
$item = array(); $item = array();
$item['title'] = $title; $item['title'] = $title;
$item['uri'] = $uri; $item['uri'] = $uri;
$item['timestamp'] = strtotime($extractedDate); $item['timestamp'] = substr($date, 0, -3);
$item['author'] = 'Binance'; $item['author'] = 'Binance';
$item['content'] = $content; $item['content'] = $content;