shah / uniform-resource

Uniform resource transformers for content orchestration engines
GNU Affero General Public License v3.0
1 stars 0 forks source link

Curation of image list #12

Closed shanilsasikumar closed 4 years ago

shanilsasikumar commented 4 years ago

Hi @shah We can have a list of images from the curable content, So that featured image can be selected from the list.

Sample code returning image URLs using Cheerio selector

 var resObj = {}, // return object
//set a reference to the document that came back
$ = cheerio.load(responseHtml),
$images = $('img');
if ($images && $images.length) {
    resObj.images = [];
    for (var i = 0; i < $images.length; i++) {
        resObj.images.push($($images[i]).attr('src'));
    }
}
shah commented 4 years ago

@shanilsasikumar the initial code is now in the package, please add test cases and verify functionality.