javascript - Retrieving HTML metadata for image instead of downloading image -
i trying use cheerio node.js request library retrieve metadata images. looks when make http request url ends in .jpg, .png, etc, send whole file , can't access html in response. so, question is, given url image, how read html or metadata instead of downloading whole image file upon making request url?
for example, here simple code have:
var request = require('request'); var cheerio = require('cheerio'); // cheerio used parse html on server, jquery server request('http://l.yimg.com/os/mit/media/m/content_index/images/sidekick_tv_news-2e9c408.png',function(err,response,body){ var $ = cheerio.load(body); //here seems body not html data pertaining image - want typical html response, not picture file });
does know talking about?
for starters can use image url in img element:
var img = cheerio('<img src="' + imageurl + '"></img>');
or
var img = cheerio.load('<img src="' + imageurl + '"></img>');
then might able perform queries
Comments
Post a Comment