I am trying to import my tumblr feed

I am trying to import my tumblr feed geekguardian.tumblr.com/rss and none of the embedded videos are coming in even though its the first thing in the rss description. Is there anyway I can fix this?

  • Vaughan

    Hi @robert,

    Can you take a screenshot of your feed config? Which options are you using for the images etc?

    When I try to validate the feed I see the following:

    This feed is valid, but interoperability with the widest range of feed readers could be improved by implementing the following recommendations.
    line 24, column 0: description should not contain iframe tag (3 occurrences)

    It looks like the embed is in an iframe which is not allowed. Also when I try to process, the feed isn't valid.

    Can you try enabling the disable sanitizing add on & force feed.

    Dashboard > autoblog > add-ons

    Then edit the feed and tick the boxes at bottom for force feed and disable sanitizing.

    Thanks

  • Vaughan

    Hi Robert,

    I can't actually get the feed to process because it's an invalid feed.

    iframes are default as bad because they are a security risk & can open your site to serious XSS attacks, so you should only enable disable sanitizing for sites you know and explicitly trust. if you take a feed from an untrusted site and they hide malicious scripts in an iframe of a feed, then they could pose a security risk to your site.

    I'm going to ask one of our developers to see if he can help with this though, as W3C feed validator says the feed is valid, though with 2 erros. but autoblog still refuses to process it even with force feed enabled.

    Hopefully the developer should respond soon, but it could take a little longer depending on how big his queue is.

    Thanks

  • Hoang Ngo

    Hi Robert,

    I hope you are well today and I'm sorry for the delay.

    As Vaughan said, the iframe will be stripped by default when wordpress import feed. Please add this code to your theme functions.php or use mu-plugins

    add_filter('autoblog_pre_post_insert','autoblog_remove_iframe_when_import',11,3);
    add_filter('autoblog_pre_post_update','autoblog_remove_iframe_when_import',11,3);
    
    function autoblog_remove_iframe_when_import($old_content, $details, SimplePie_Item $item ){
        global $allowedposttags;
        $allowed_domain ='yourdomain.com';
    
        $allowedposttags['iframe'] = array(
            "src"    => array(),
            "height" => array(),
            "width"  => array()
        );
        $content                   = $item->get_content();
        $doc                       = new DOMDocument();
        $can_use_dom               = @$doc->loadHTML( mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8') );
        $doc->preserveWhiteSpace = false;
        if ( $can_use_dom ) {
            //now only allow iframe from youtube
            $iframes = $doc->getElementsByTagName( 'iframe' );
            foreach ( $iframes as $iframe ) {
                $url = $iframe->getAttribute( 'src' );
                if ( strpos( $url, '//' ) == 0 ) {
                    $url = 'http:' . $url;
                }
                if ( ! stristr( parse_url( $url, PHP_URL_HOST ), $allowed_domain ) ) {
                    $iframe->parentNode->removeChild( $iframe );
                }
            }
            $doc->removeChild($doc->firstChild);
            $doc->replaceChild($doc->firstChild->firstChild->firstChild, $doc->firstChild);
            $new_content = $doc->saveHTML();
    
            return $new_content;
        }
        return $old_content;
    }

    Please replace the $allowed_domain to your feed domain, so that will allow iframe for that feed.

    Please give it a try and let us update.

    Best regards,
    Hoang Ngo

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.