Search url in article content (body)

1 Commentaires

  • Ahmed Zaid
    User Group Leader Community Moderator

    Hi Jacques van Rensburg,

    Perhaps you can try a simple script to search within the html body. This javascript code can even run in your browser's developer tools console if you are logged in to the help center. It will print the url of all articles with downloads.page.com in the html code:

    function hasImages(url) {
        fetch(url)
            .then((res) => {
                return res.json();
            })
            .then((json) => {
                json.articles.forEach((article) => {
                  if (article.body.search("downloads.page.com") !== -1) {
                        console.log(article.html_url);
                    }
                });
                if (json.next_page) {
                    hasImages(json.next_page);
                }
            });
    }

    hasImages("/api/v2/help_center/articles.json?per_page=100");

    With a bit of effort from a developer, you can even tweak the script to download, reupload and replace the images in all the articles.

    0

Vous devez vous connecter pour laisser un commentaire.

Réalisé par Zendesk