mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-11-24 18:36:59 +03:00
[PicukiBridge] Try to fix the bridge (#4262)
This is a try to fix the bridge HTML parsing
This commit is contained in:
parent
40041dd65f
commit
d9316cdc60
1 changed files with 7 additions and 7 deletions
|
@ -58,26 +58,26 @@ class PicukiBridge extends BridgeAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
$count = 0;
|
$count = 0;
|
||||||
foreach ($html->find('.box-photos .box-photo') as $element) {
|
foreach ($html->find('div[class=.box-photo][data-s=media]') as $element) {
|
||||||
// skip ad items
|
// skip ad items
|
||||||
if (in_array('adv', explode(' ', $element->class))) {
|
if (in_array('adv', explode(' ', $element->class))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = urljoin(self::URI, $element->find('a', 0)->href);
|
$url = $element->find('a', 0)->href;
|
||||||
$html = getSimpleHTMLDOMCached($url);
|
$html_single = getSimpleHTMLDOMCached($url);
|
||||||
$sourceUrl = null;
|
$sourceUrl = null;
|
||||||
if (preg_match($re, $html, $matches) > 0) {
|
if (preg_match($re, $html_single, $matches) > 0) {
|
||||||
$sourceUrl = 'https://instagram.com/p/' . $matches[1];
|
$sourceUrl = 'https://instagram.com/p/' . $matches[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
$author = trim($element->find('.user-nickname', 0)->plaintext);
|
//$author = trim($element->find('.single-photo-nickname', 0)->plaintext);
|
||||||
|
|
||||||
$date = date_create();
|
$date = date_create();
|
||||||
$relativeDate = str_replace(' ago', '', $element->find('.time', 0)->plaintext);
|
$relativeDate = str_replace(' ago', '', $element->find('.time', 0)->plaintext);
|
||||||
date_sub($date, date_interval_create_from_date_string($relativeDate));
|
date_sub($date, date_interval_create_from_date_string($relativeDate));
|
||||||
|
|
||||||
$description = trim($element->find('.photo-description', 0)->plaintext);
|
$description = trim($element->find('.photo-action-description', 0)->plaintext);
|
||||||
|
|
||||||
$isVideo = (bool) $element->find('.video-icon', 0);
|
$isVideo = (bool) $element->find('.video-icon', 0);
|
||||||
$videoNote = $isVideo ? '<p><i>(video)</i></p>' : '';
|
$videoNote = $isVideo ? '<p><i>(video)</i></p>' : '';
|
||||||
|
@ -91,7 +91,7 @@ class PicukiBridge extends BridgeAbstract
|
||||||
|
|
||||||
$this->items[] = [
|
$this->items[] = [
|
||||||
'uri' => $url,
|
'uri' => $url,
|
||||||
'author' => $author,
|
/*'author' => $author,*/
|
||||||
'timestamp' => date_format($date, 'r'),
|
'timestamp' => date_format($date, 'r'),
|
||||||
'title' => strlen($description) > 60 ? mb_substr($description, 0, 57) . '...' : $description,
|
'title' => strlen($description) > 60 ? mb_substr($description, 0, 57) . '...' : $description,
|
||||||
'thumbnail' => $imageUrl,
|
'thumbnail' => $imageUrl,
|
||||||
|
|
Loading…
Reference in a new issue