get-img-src
Version:
Get image src attributes/urls from HTML.
46 lines (29 loc) • 1.29 kB
Markdown
# get-img-src [](https://travis-ci.org/johnotander/get-img-src) [](https://github.com/feross/standard)
Get image src attributes/urls from HTML.
## Installation
```bash
npm install --save get-img-src
```
## Usage
```javascript
var getImgSrc = require('get-img-src')
getImgSrc('<img src="some-img.png"></img> <img src="some-other-img.jpg"></img>', function(err, imgSrcs) {
console.log(imgSrcs)
}) // => ['some-img.png', 'some-other-img.jpg']
getImgSrc('<span>HTML without an image</span>', function(err, imgSrcs) {
console.log(imgSrcs)
}) // => []
```
## License
MIT
## Acknowledgements
* <https://github.com/cheeriojs/cheerio>
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
Crafted with <3 by John Otander ([@4lpine](https://twitter.com/4lpine)).
***
> This package was initially generated with [yeoman](http://yeoman.io) and the [p generator](https://github.com/johnotander/generator-p.git).