mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-11-27 12:01:09 +03:00
7621784598
Adds favicon to bridges that support it. Some sites prevent downloading favicons, those bridges are left untouched. Affected bridges: - AutoJMBridge - BandcampBridge - BlaguesDeMerdeBridge - BloombergBridge - BundesbankBridge - ChristianDailyReporterBridge - ContainerLinuxReleasesBridge - DailymotionBridge - DiceBridge - DribbbleBridge - EliteDangerousGalnetBridge - ElsevierBridge - FacebookBridge - FB2Bridge - FDroidBridge - FierPandaBridge - GooglePlusPostBridge - JapanExpoBridge - KATBridge - KernelBugTrackerBridge - LegifranceJOBridge - NotAlwaysBridge - NyaaTorrentsBridge - PinterestBridge - RadioMelodieBridge - RainbowSixSiegeBridge - SupInfoBridge - TagBoardBridge - TebeoBridge - TheTVDBBridge - WhydBridge - ZoneTelechargementBridge
47 lines
1.2 KiB
PHP
47 lines
1.2 KiB
PHP
<?php
|
|
class BlaguesDeMerdeBridge extends BridgeAbstract {
|
|
|
|
const MAINTAINER = 'superbaillot.net, logmanoriginal';
|
|
const NAME = 'Blagues De Merde';
|
|
const URI = 'http://www.blaguesdemerde.fr/';
|
|
const CACHE_TIMEOUT = 7200; // 2h
|
|
const DESCRIPTION = 'Blagues De Merde';
|
|
|
|
public function getIcon() {
|
|
return self::URI . 'assets/img/favicon.ico';
|
|
}
|
|
|
|
public function collectData(){
|
|
|
|
$html = getSimpleHTMLDOM(self::URI)
|
|
or returnServerError('Could not request BDM.');
|
|
|
|
foreach($html->find('div.blague') as $element) {
|
|
|
|
$item = array();
|
|
|
|
$item['uri'] = static::URI . '#' . $element->id;
|
|
$item['author'] = $element->find('div[class="blague-footer"] p strong', 0)->plaintext;
|
|
|
|
// Let the title be everything up to the first <br>
|
|
$item['title'] = trim(explode("\n", $element->find('div.text', 0)->plaintext)[0]);
|
|
|
|
$item['content'] = strip_tags($element->find('div.text', 0));
|
|
|
|
// timestamp is part of:
|
|
// <p>Par <strong>{author}</strong> le {date} dans <strong>{category}</strong></p>
|
|
preg_match(
|
|
'/.+le(.+)dans.*/',
|
|
$element->find('div[class="blague-footer"]', 0)->plaintext,
|
|
$matches
|
|
);
|
|
|
|
$item['timestamp'] = strtotime($matches[1]);
|
|
|
|
$this->items[] = $item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|