|
@@ -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
|