1
0
Fork 0
forked from blallo/rss-bridge

[bridges] Remove calls to get_cached and remove_from_cache

This commit is contained in:
logmanoriginal 2016-09-10 00:19:24 +02:00
parent 3a92a1e04b
commit 3a94956915
16 changed files with 0 additions and 36 deletions

View file

@ -16,8 +16,6 @@ class CADBridge extends FeedExpander {
} }
private function CADExtractContent($url) { private function CADExtractContent($url) {
if($this->get_cached_time($url) <= strtotime('-24 hours'))
$this->remove_from_cache($url);
$html3 = $this->get_cached($url); $html3 = $this->get_cached($url);
// The request might fail due to missing https support or wrong URL // The request might fail due to missing https support or wrong URL

View file

@ -17,8 +17,6 @@ class CommonDreamsBridge extends FeedExpander {
} }
private function CommonDreamsExtractContent($url) { private function CommonDreamsExtractContent($url) {
if($this->get_cached_time($url) <= strtotime('-24 hours'))
$this->remove_from_cache($url);
$html3 = $this->get_cached($url); $html3 = $this->get_cached($url);
$text = $html3->find('div[class=field--type-text-with-summary]', 0)->innertext; $text = $html3->find('div[class=field--type-text-with-summary]', 0)->innertext;
$html3->clear(); $html3->clear();

View file

@ -28,7 +28,6 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{
$item = array(); $item = array();
$item['author'] = $episode->find('a', 0)->text(); $item['author'] = $episode->find('a', 0)->text();
$item['title'] = $episode->find('a', 0)->text(); $item['title'] = $episode->find('a', 0)->text();
$item['timestamp'] = $this->get_cached_time($episode->find('a', 0)->getAttribute('href'));
$textefiche=$htmlepisode->find('#textefiche', 0)->find('p',1); $textefiche=$htmlepisode->find('#textefiche', 0)->find('p',1);
if (isset($textefiche)) { if (isset($textefiche)) {
$item['content'] = $textefiche->text(); $item['content'] = $textefiche->text();

View file

@ -47,8 +47,6 @@ class DauphineLibereBridge extends FeedExpander {
} }
private function ExtractContent($url) { private function ExtractContent($url) {
if($this->get_cached_time($url) <= strtotime('-24 hours'))
$this->remove_from_cache($url);
$html2 = $this->get_cached($url); $html2 = $this->get_cached($url);
$text = $html2->find('div.column', 0)->innertext; $text = $html2->find('div.column', 0)->innertext;
$text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text); $text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text);

View file

@ -42,8 +42,6 @@ class DeveloppezDotComBridge extends FeedExpander {
} }
private function DeveloppezDotComExtractContent($url) { private function DeveloppezDotComExtractContent($url) {
if($this->get_cached_time($url) <= strtotime('-24 hours'))
$this->remove_from_cache($url);
$articleHTMLContent = $this->get_cached($url); $articleHTMLContent = $this->get_cached($url);
$text = $this->convert_smart_quotes($articleHTMLContent->find('div.content', 0)->innertext); $text = $this->convert_smart_quotes($articleHTMLContent->find('div.content', 0)->innertext);
$text = utf8_encode($text); $text = utf8_encode($text);

View file

@ -86,8 +86,6 @@ class FuturaSciencesBridge extends FeedExpander {
protected function parseItem($newsItem){ protected function parseItem($newsItem){
$item = $this->parseRSS_2_0_Item($newsItem); $item = $this->parseRSS_2_0_Item($newsItem);
$item['uri'] = str_replace('#xtor=RSS-8', '', $item['uri']); $item['uri'] = str_replace('#xtor=RSS-8', '', $item['uri']);
if($this->get_cached_time($item['uri']) <= strtotime('-24 hours'))
$this->remove_from_cache($item['uri']);
$article = $this->get_cached($item['uri']) $article = $this->get_cached($item['uri'])
or $this->returnServerError('Could not request Futura-Sciences: ' . $item['uri']); or $this->returnServerError('Could not request Futura-Sciences: ' . $item['uri']);
$item['content'] = $this->ExtractArticleContent($article); $item['content'] = $this->ExtractArticleContent($article);

View file

@ -59,8 +59,6 @@ class JapanExpoBridge extends HttpCachingBridgeAbstract {
if ($count >= 5) { if ($count >= 5) {
break; break;
} }
if($this->get_cached_time($url) <= strtotime('-24 hours'))
$this->remove_from_cache($url);
$article_html = $this->get_cached($url) or $this->returnServerError('Could not request JapanExpo: '.$url); $article_html = $this->get_cached($url) or $this->returnServerError('Could not request JapanExpo: '.$url);
$header = $article_html->find('header.pageHeadBox', 0); $header = $article_html->find('header.pageHeadBox', 0);

View file

@ -224,9 +224,6 @@ class KununuBridge extends HttpCachingBridgeAbstract {
*/ */
private function extract_full_description($uri){ private function extract_full_description($uri){
// Load full article // Load full article
if($this->get_cached_time($uri) <= strtotime('-24 hours'))
$this->remove_from_cache($uri);
$html = $this->get_cached($uri); $html = $this->get_cached($uri);
if($html === false) if($html === false)
$this->returnServerError('Could not load full description!'); $this->returnServerError('Could not load full description!');

View file

@ -17,8 +17,6 @@ class LeJournalDuGeekBridge extends FeedExpander {
} }
private function LeJournalDuGeekExtractContent($url) { private function LeJournalDuGeekExtractContent($url) {
if($this->get_cached_time($url) <= strtotime('-24 hours'))
$this->remove_from_cache($url);
$articleHTMLContent = $this->get_cached($url); $articleHTMLContent = $this->get_cached($url);
$text = $articleHTMLContent->find('div.post-content', 0)->innertext; $text = $articleHTMLContent->find('div.post-content', 0)->innertext;

View file

@ -12,8 +12,6 @@ class LeMondeInformatiqueBridge extends FeedExpander {
protected function parseItem($newsItem){ protected function parseItem($newsItem){
$item = $this->parseRSS_1_0_Item($newsItem); $item = $this->parseRSS_1_0_Item($newsItem);
if($this->get_cached_time($item['uri']) <= strtotime('-24 hours'))
$this->remove_from_cache($item['uri']);
$article_html = $this->get_cached($item['uri']) $article_html = $this->get_cached($item['uri'])
or $this->returnServerError('Could not request LeMondeInformatique: ' . $item['uri']); or $this->returnServerError('Could not request LeMondeInformatique: ' . $item['uri']);
$item['content'] = $this->CleanArticle($article_html->find('div#article', 0)->innertext); $item['content'] = $this->CleanArticle($article_html->find('div#article', 0)->innertext);

View file

@ -17,9 +17,6 @@ class LichessBridge extends FeedExpander {
} }
private function retrieve_lichess_post($blog_post_uri){ private function retrieve_lichess_post($blog_post_uri){
if($this->get_cached_time($blog_post_uri) <= strtotime('-24 hours'))
$this->remove_from_cache($blog_post_uriuri);
$blog_post_html = $this->get_cached($blog_post_uri); $blog_post_html = $this->get_cached($blog_post_uri);
$blog_post_div = $blog_post_html->find('#lichess_blog', 0); $blog_post_div = $blog_post_html->find('#lichess_blog', 0);

View file

@ -17,8 +17,6 @@ class NextInpactBridge extends FeedExpander {
} }
private function ExtractContent($url) { private function ExtractContent($url) {
if($this->get_cached_time($url) <= strtotime('-24 hours'))
$this->remove_from_cache($url);
$html2 = $this->get_cached($url); $html2 = $this->get_cached($url);
$text = '<p><em>'.$html2->find('span.sub_title', 0)->innertext.'</em></p>' $text = '<p><em>'.$html2->find('span.sub_title', 0)->innertext.'</em></p>'
.'<p><img src="'.$html2->find('div.container_main_image_article', 0)->find('img.dedicated',0)->src.'" alt="-" /></p>' .'<p><img src="'.$html2->find('div.container_main_image_article', 0)->find('img.dedicated',0)->src.'" alt="-" /></p>'

View file

@ -17,8 +17,6 @@ class NiceMatinBridge extends FeedExpander {
} }
private function NiceMatinExtractContent($url) { private function NiceMatinExtractContent($url) {
if($this->get_cached_time($url) <= strtotime('-24 hours'))
$this->remove_from_cache($url);
$html = $this->get_cached($url); $html = $this->get_cached($url);
if(!$html) if(!$html)
return 'Could not acquire content from url: ' . $url . '!'; return 'Could not acquire content from url: ' . $url . '!';

View file

@ -17,9 +17,6 @@ class NumeramaBridge extends FeedExpander {
} }
private function ExtractContent($url){ private function ExtractContent($url){
if($this->get_cached_time($url) <= strtotime('-24 hours'))
$this->remove_from_cache($url);
$article_html = $this->get_cached($url) or $this->returnServerError('Could not request Numerama: '.$url); $article_html = $this->get_cached($url) or $this->returnServerError('Could not request Numerama: '.$url);
$contents = $article_html->find('section[class=related-article]', 0)->innertext = ''; // remove related articles block $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 = '<img alt="" style="max-width:300px;" src="'.$article_html->find('meta[property=og:image]', 0)->getAttribute('content').'">'; // add post picture

View file

@ -175,9 +175,6 @@ class WikipediaBridge extends HttpCachingBridgeAbstract {
* Loads the full article from a given URI * Loads the full article from a given URI
*/ */
private function LoadFullArticle($uri){ private function LoadFullArticle($uri){
if($this->get_cached_time($uri) <= strtotime('-24 hours'))
$this->remove_from_cache($uri);
$content_html = $this->get_cached($uri); $content_html = $this->get_cached($uri);
if(!$content_html) if(!$content_html)

View file

@ -82,9 +82,6 @@ class WordPressBridge extends HttpCachingBridgeAbstract {
$item['timestamp'] = strtotime($article->find('updated', 0)->innertext); $item['timestamp'] = strtotime($article->find('updated', 0)->innertext);
} }
if($this->get_cached_time($item['uri']) <= strtotime('-24 hours'))
$this->remove_from_cache($item['uri']);
$article_html = $this->get_cached($item['uri']); $article_html = $this->get_cached($item['uri']);
// Attempt to find most common content div // Attempt to find most common content div