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

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -