Better img extracting from feed content

This commit is contained in:
Muki 2019-03-11 20:26:07 +01:00
parent 31f13602d9
commit 825fd9388b
3 changed files with 6 additions and 3 deletions

View file

@ -1615,7 +1615,8 @@ int NvFetcher::storeFeeds()
QRegExp rx("<img\\s[^>]*src\\s*=\\s*(\"[^\"]*\"|'[^']*')", Qt::CaseInsensitive);
if (rx.indexIn(e.content)!=-1) {
QString imgSrc = rx.cap(1); imgSrc = imgSrc.mid(1,imgSrc.length()-2);
if (imgSrc!="") {
if (!imgSrc.isEmpty()) {
imgSrc.replace("&amp;","&", Qt::CaseInsensitive);
if (!s->db->isCacheExistsByFinalUrl(Utils::hash(imgSrc))) {
DatabaseManager::CacheItem item;
item.origUrl = imgSrc;

View file

@ -1454,7 +1454,8 @@ void OldReaderFetcher::storeStream()
QRegExp rx("<img\\s[^>]*src\\s*=\\s*(\"[^\"]*\"|'[^']*')", Qt::CaseInsensitive);
if (rx.indexIn(e.content)!=-1) {
QString imgSrc = rx.cap(1); imgSrc = imgSrc.mid(1,imgSrc.length()-2);
if (imgSrc!="") {
if (!imgSrc.isEmpty()) {
imgSrc.replace("&amp;","&", Qt::CaseInsensitive);
if (s->getCachingMode() == 2 || (s->getCachingMode() == 1 && s->dm->isWLANConnected())) {
if (!s->db->isCacheExistsByFinalUrl(Utils::hash(imgSrc))) {
DatabaseManager::CacheItem item;

View file

@ -452,7 +452,8 @@ void TTRssFetcher::storeStream()
QRegExp rx("<img\\s[^>]*src\\s*=\\s*(\"[^\"]*\"|'[^']*')", Qt::CaseInsensitive);
if (rx.indexIn(e.content)!=-1) {
QString imgSrc = rx.cap(1); imgSrc = imgSrc.mid(1,imgSrc.length()-2);
if (imgSrc!="") {
if (!imgSrc.isEmpty()) {
imgSrc.replace("&amp;","&", Qt::CaseInsensitive);
if (s->getCachingMode() == 2 || (s->getCachingMode() == 1 && s->dm->isWLANConnected())) {
if (!s->db->isCacheExistsByFinalUrl(Utils::hash(imgSrc))) {
DatabaseManager::CacheItem item;