c# - Download image from Wikimedia -
i've read documentation , after research im not sure if there easy way this.
i using musicbrainz image of artist. produces url
https://commons.wikimedia.org/wiki/file:michael_jackson_in_1988.jpg
i download image (which have worked out) dont know how or correct procedure be?
i have read few links , seem pretty dated including:
download image site in .net/c#
which doesnt answer question have way of downloading image. im after in case way of getting image url using above link contains download links.
i did read link targeting api again dated , ready pages didnt mention api (so have been third party).
i have download image, getting correct url can found on link posted above dont know how extract url?
you use html agility pack <a href
elements in html page , ones image type extension.
var document= new htmlweb().load("https://commons.wikimedia.org/wiki/file:michael_jackson_in_1988.jpg"); var allhrefs = document.documentelement.selectnodes("//a[@href]");
i'm sure share common structure, so i'll let figure out. @ quick glance looks first <a href
points raw image.
var imagelink = allhrefs.firstordefault();
edit: if want more careful, can filter nodes looking class='fullimagelink'
div id='file'
. seems host <a href
original image.
Comments
Post a Comment