Skip to content

ellerbrock/get-links

Repository files navigation

Javascript JavaScript Style Guide Commitizen friendly Standard Version Open Source Love Gitter Chat

Get Links via DOM / CSS Selector

Project Status

Build Status

Overview

Get Links via DOM / CSS Selector

Simple like: getLinks(url, selector)

Installation

install with npm

npm install --save get-links

install with yarn

yarn add get-links

Example

ES5

var getLinks = require('get-links')

ES6

import getLinks from 'get-links'

Examples

import getLinks from 'get-links'
import log from 'console-emoji'

// get pinned repository links from github
const url = 'https://github.com/ellerbrock'
const selector = '.pinned-repo-item-content .d-block a'

getLinks(url, selector)
  .then(links => {
    log('GitHub: Pinned Repositories:', 'ok')
    links.forEach(v => log(`  :link:  ${url}${v}`))
  })

Output should look like this:

get-links

Contact / Social Media

Get the latest News about Web Development, Open Source, Tooling, Server & Security

TwitterFacebookGoogle+GitterGithub

License

Copyright (c) 2016 Maik Ellerbrock

MIT Licence