aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2015-07-06 11:14:59 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2015-07-06 11:14:59 +0200
commit1f07bd2cdd4361a36359ae73bdcf0b5ecbea8f0a (patch)
tree621966ee5469215a441169c1760677e801a84dd1
parentbd391dc6f7468695490ac5c5732e66b42d9b2b8b (diff)
parentc1398afe8c8d220ace5fc4ccac02953adddf18c5 (diff)
Merge pull request #888 from Alkarex/fullContentDataSrc
Full content img data-src. Tested by @Pangolun https://github.com/FreshRSS/FreshRSS/issues/877#issuecomment-118777077
-rw-r--r--lib/lib_rss.php20
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/lib_rss.php b/lib/lib_rss.php
index 191a58f35..c51b4e6de 100644
--- a/lib/lib_rss.php
+++ b/lib/lib_rss.php
@@ -195,17 +195,27 @@ function sanitizeHTML($data, $base = '') {
/* permet de récupérer le contenu d'un article pour un flux qui n'est pas complet */
function get_content_by_parsing ($url, $path) {
- require_once (LIB_PATH . '/lib_phpQuery.php');
+ require_once(LIB_PATH . '/lib_phpQuery.php');
Minz_Log::notice('FreshRSS GET ' . SimplePie_Misc::url_remove_credentials($url));
- $html = file_get_contents ($url);
+ $html = file_get_contents($url);
if ($html) {
- $doc = phpQuery::newDocument ($html);
- $content = $doc->find ($path);
+ $doc = phpQuery::newDocument($html);
+ $content = $doc->find($path);
+
+ foreach (pq('img[data-src]') as $img) {
+ $imgP = pq($img);
+ $dataSrc = $imgP->attr('data-src');
+ if (strlen($dataSrc) > 4) {
+ $imgP->attr('src', $dataSrc);
+ $imgP->removeAttr('data-src');
+ }
+ }
+
return sanitizeHTML($content->__toString(), $url);
} else {
- throw new Exception ();
+ throw new Exception();
}
}