R
R
Roma Kozubiak2018-08-11 01:21:20
RSS
Roma Kozubiak, 2018-08-11 01:21:20

Why doesn't the parser copy title photos from the article?

There is a parser plugin for WordPress. Parses articles from websites via rss. There are no problems with the content of the article. And with title photos, the bottom line is that there are no title photos on the rss page. I thought to solve this problem in the following way. The item tag has a link tag that is a link to each article, and I would like to make the parser for each article follow this link and copy the photo from the featured-image block. I just don't know how to implement it. Link to rss - merezha.co/feed
Here is the plugin configuration code:

if($blog_enc != $src_enc){
    $content = mb_convert_encoding($content, $blog_enc, $src_enc);
    $title   = mb_convert_encoding($title, $blog_enc, $src_enc);
}

$res .= $pr->set_title($title);             //Заголовок материала
$res .= $content.$attachments;              //Основной текст материала
$content = str_replace("://://","",$content);
$content = str_replace("/wp-content/","http://merezha.co/wp-content/",$content);
$content = $pr->process_images($content);   //Закачиваем картинки

My attempt to solve the problem: (added before process_images)
$data = file_get_contents($link);
$str = $pr->cut_str($data,'<div class = "featured-image">',"</div>");
if($str!="") $content .= $str;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Semchenko, 2018-08-11
@0xcffaedfe

Have you even looked at xml(rss)? As if there are pictures:

<content:encoded><![CDATA[<p><img src="/wp-content/uploads/2018/08/aabbf793e4e20e7ea34bebd0c8de2b2e.jpg"   class="insidewpg"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question