mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-11-22 09:35:28 +03:00
[PicukiBridge] Add source field (#3265)
* [PicukiBridge] Add source_url field * Simplify the regex matching. * Add picuki source for feeds
This commit is contained in:
parent
5d4247dded
commit
db437b6326
1 changed files with 8 additions and 0 deletions
|
@ -40,6 +40,7 @@ class PicukiBridge extends BridgeAbstract
|
|||
|
||||
public function collectData()
|
||||
{
|
||||
$re = '#let short_code = "(.*?)";\s*$#m';
|
||||
$html = getSimpleHTMLDOM($this->getURI());
|
||||
|
||||
foreach ($html->find('.box-photos .box-photo') as $element) {
|
||||
|
@ -49,6 +50,11 @@ class PicukiBridge extends BridgeAbstract
|
|||
}
|
||||
|
||||
$url = urljoin(self::URI, $element->find('a', 0)->href);
|
||||
$html = getSimpleHTMLDOMCached($url);
|
||||
$sourceUrl = null;
|
||||
if (preg_match($re, $html, $matches) > 0) {
|
||||
$sourceUrl = 'https://instagram.com/p/' . $matches[1];
|
||||
}
|
||||
|
||||
$author = trim($element->find('.user-nickname', 0)->plaintext);
|
||||
|
||||
|
@ -77,11 +83,13 @@ class PicukiBridge extends BridgeAbstract
|
|||
'timestamp' => date_format($date, 'r'),
|
||||
'title' => strlen($description) > 60 ? mb_substr($description, 0, 57) . '...' : $description,
|
||||
'thumbnail' => $imageUrl,
|
||||
'source' => $sourceUrl,
|
||||
'enclosures' => [$imageUrl],
|
||||
'content' => <<<HTML
|
||||
<a href="{$url}">
|
||||
<img loading="lazy" src="{$imageUrl}" />
|
||||
</a>
|
||||
<a href="{$sourceUrl}">{$sourceUrl}</a>
|
||||
{$videoNote}
|
||||
<p>{$description}<p>
|
||||
HTML
|
||||
|
|
Loading…
Reference in a new issue