mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-04 18:14:44 +02:00
[bridges] Use caching with applicable bridges
This commit is contained in:
parent
e4b314f78a
commit
78f6757622
5 changed files with 25 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
class NumeramaBridge extends BridgeAbstract{
|
||||
class NumeramaBridge extends HttpCachingBridgeAbstract {
|
||||
|
||||
public function loadMetadatas() {
|
||||
|
||||
|
@ -31,7 +31,10 @@ class NumeramaBridge extends BridgeAbstract{
|
|||
$item['timestamp'] = strtotime($element->find('pubDate', 0)->plaintext);
|
||||
|
||||
$article_url = NumeramaStripCDATA($element->find('guid', 0)->plaintext);
|
||||
$article_html = $this->getSimpleHTMLDOM($article_url) or $this->returnServerError('Could not request Numerama: '.$article_url);
|
||||
if($this->get_cached_time($article_url) <= strtotime('-24 hours'))
|
||||
$this->remove_from_cache($article_url);
|
||||
|
||||
$article_html = $this->get_cached($article_url) or $this->returnServerError('Could not request Numerama: '.$article_url);
|
||||
$contents = $article_html->find('section[class=related-article]', 0)->innertext = ''; // remove related articles block
|
||||
$contents = '<img alt="" style="max-width:300px;" src="'.$article_html->find('meta[property=og:image]', 0)->getAttribute('content').'">'; // add post picture
|
||||
$contents = $contents.$article_html->find('article[class=post-content]', 0)->innertext; // extract the post
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue