Rss-Bridge/bridges/TheCodingLoveBridge.php
Joseph 4c0e234479 [Bridges] Use HTTPS (#1337)
* [Rule34pahealBridge] Use HTTPS
* [KonachanBridge] Use HTTPS
* [Rule34Bridge] Use HTTPS
* [SafebooruBridge] Use HTTPS
* [TbibBridge] Use HTTPS
* [XbooruBridge] Use HTTPS
* [ScmbBridge] Use HTTPS
* [ReporterreBridge] Use HTTPS
* [BastaBridge] Use HTTPS
* [NiceMatinBridge] Use HTTPS
* [ScoopItBridge] Use HTTPS
* [TheCodingLoveBridge] Use HTTPS
* [Shimmie2Bridge] Use HTTPS
* [HDWallpapersBridge] Use HTTPS
* [GiphyBridge] Use HTTPS
* [PickyWallpapersBridge] Use HTTPS
* [ParuVenduImmoBridge] Use HTTPS
* [ElsevierBridge] Use HTTPS
* [CastorusBridge] Use HTTPS
* [CollegeDeFranceBridge] Use HTTPS
* [MangareaderBridge] Use HTTPS
2019-10-16 21:34:28 +02:00

46 lines
1.2 KiB
PHP

<?php
class TheCodingLoveBridge extends BridgeAbstract {
const MAINTAINER = 'superbaillot.net';
const NAME = 'The Coding Love';
const URI = 'https://thecodinglove.com/';
const CACHE_TIMEOUT = 7200; // 2h
const DESCRIPTION = 'The Coding Love';
public function collectData(){
$html = getSimpleHTMLDOM(self::URI)
or returnServerError('Could not request The Coding Love.');
foreach($html->find('div.post') as $element) {
$item = array();
$temp = $element->find('h3 a', 0);
$titre = $temp->innertext;
$url = $temp->href;
$temp = $element->find('div.bodytype', 0);
// retrieve .gif instead of static .jpg
$images = $temp->find('p.e img');
foreach($images as $image) {
$img_src = str_replace('.jpg', '.gif', $image->src);
$image->src = $img_src;
}
$content = $temp->innertext;
$auteur = $temp->find('i', 0);
$pos = strpos($auteur->innertext, 'by');
if($pos > 0) {
$auteur = trim(str_replace('*/', '', substr($auteur->innertext, ($pos + 2))));
$item['author'] = $auteur;
}
$item['content'] .= trim($content);
$item['uri'] = $url;
$item['title'] = trim($titre);
$this->items[] = $item;
}
}
}