Search url in article content (body)
Hi All
Is it possible and if so, how do I search for a url (to images) in a article?
Years back we imported our articles from another source into Zendesk Guide with all images pointing to a specific server.
Need to move these images elsewhere which means updating the url and trying to determine which articles needs updating (vs opening each one)
Tried eg: api/v2/help_center/articles/search.json?query=downloads.page.com
With and without placing downloads.page.com in double quotes.
And replacing '.' with %2E.
Seems its only searching for 'downloads'
Guess this could work if I then do a find on the results, but first prize is getting only the affected articles.
Thanks
-
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.
Vous devez vous connecter pour laisser un commentaire.
1 Commentaires