Skip to content

Commit

Permalink
Add metasraper-soundcloud
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Dec 17, 2017
1 parent b96eb09 commit 9814253
Show file tree
Hide file tree
Showing 12 changed files with 245 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/metascraper-soundcloud/.bumpedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
files:
- package.json
plugins:
prerelease:
Linting config files:
plugin: bumped-finepack
postrelease:
Generating CHANGELOG file:
plugin: bumped-changelog
Committing new version:
plugin: bumped-terminal
command: 'git add CHANGELOG.md package.json && git commit -m "Release $newVersion"'
Detecting problems before publish:
plugin: bumped-terminal
command: 'git-dirty && npm test'
Publishing tag to GitHub:
plugin: bumped-terminal
command: 'git tag $newVersion && git push && git push --tags'
Publishing to NPM:
plugin: bumped-terminal
command: npm publish
22 changes: 22 additions & 0 deletions packages/metascraper-soundcloud/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# http://editorconfig.org

root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 100
indent_brace_style = 1TBS
spaces_around_operators = true
quote_type = auto

[package.json]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false
1 change: 1 addition & 0 deletions packages/metascraper-soundcloud/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
34 changes: 34 additions & 0 deletions packages/metascraper-soundcloud/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
############################
# npm
############################
node_modules
npm-debug.log
.node_history
yarn.lock
package-lock.json

############################
# tmp, editor & OS files
############################
.tmp
*.swo
*.swp
*.swn
*.swm
.DS_Store
*#
*~
.idea
*sublime*
nbproject

############################
# Tests
############################
testApp
coverage
.nyc_output

############################
# Other
############################
1 change: 1 addition & 0 deletions packages/metascraper-soundcloud/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
unsafe-perm=true
5 changes: 5 additions & 0 deletions packages/metascraper-soundcloud/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
language: node_js
node_js:
- "node"
- "lts/*"
after_success: npm run coveralls
21 changes: 21 additions & 0 deletions packages/metascraper-soundcloud/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright © 2017 microlink.io <[email protected]> (microlink.io)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
24 changes: 24 additions & 0 deletions packages/metascraper-soundcloud/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# metascraper-soundcloud

![Last version](https://img.shields.io/github/tag/microlinkhq/metascraper-soundcloud.svg?style=flat-square)
[![Build Status](https://img.shields.io/travis/microlinkhq/metascraper-soundcloud/master.svg?style=flat-square)](https://travis-ci.org/microlinkhq/metascraper-soundcloud)
[![Coverage Status](https://img.shields.io/coveralls/microlinkhq/metascraper-soundcloud.svg?style=flat-square)](https://coveralls.io/github/microlinkhq/metascraper-soundcloud)
[![Dependency status](https://img.shields.io/david/microlinkhq/metascraper-soundcloud.svg?style=flat-square)](https://david-dm.org/microlinkhq/metascraper-soundcloud)
[![Dev Dependencies Status](https://img.shields.io/david/dev/microlinkhq/metascraper-soundcloud.svg?style=flat-square)](https://david-dm.org/microlinkhq/metascraper-soundcloud#info=devDependencies)
[![NPM Status](https://img.shields.io/npm/dm/metascraper-soundcloud.svg?style=flat-square)](https://www.npmjs.org/package/metascraper-soundcloud)
[![Donate](https://img.shields.io/badge/donate-paypal-blue.svg?style=flat-square)](https://paypal.me/microlinkhq)

> metascraper integration with SoundCloud.
## Install

```bash
$ npm install metascraper-soundcloud --save
```

## License

**metascraper-soundcloud** © [microlink.io](https://microlink.io), Released under the [MIT](https://github.com/microlinkhq/metascraper-soundcloud/blob/master/LICENSE.md) License.<br>
Authored and maintained by microlink.io with help from [contributors](https://github.com/microlinkhq/metascraper-soundcloud/contributors).

> [microlink.io](https://microlink.io) · GitHub [@microlink.io](https://github.com/microlinkhq) · Twitter [@microlinkhq](https://twitter.com/microlinkhq)
26 changes: 26 additions & 0 deletions packages/metascraper-soundcloud/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'use strict'

const condenseWhitespace = require('condense-whitespace')
const toTitle = require('to-title-case')
const { flow } = require('lodash')

const sanetize = flow([condenseWhitespace, toTitle])

module.exports = () => ({
author: [
({ htmlDom: $, meta, url: baseUrl }) =>
sanetize(
$('.soundTitle__username')
.first()
.text()
)
],
description: [
({ htmlDom: $, meta, url: baseUrl }) =>
sanetize(
$('.soundTitle__description')
.first()
.text()
)
]
})
57 changes: 57 additions & 0 deletions packages/metascraper-soundcloud/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"name": "metascraper-soundcloud",
"description": "metascraper integration with SoundCloud",
"homepage": "https://documentup.com/microlinkhq/metascraper-soundcloud",
"version": "0.0.0",
"main": "index.js",
"author": {
"email": "[email protected]",
"name": "microlink.io",
"url": "https://microlink.io"
},
"repository": {
"type": "git",
"url": "git+https://github.com/microlinkhq/metascraper-soundcloud.git"
},
"bugs": {
"url": "https://github.com/microlinkhq/metascraper-soundcloud/issues"
},
"keywords": [
"clearbit",
"metascraper"
],
"devDependencies": {
"coveralls": "latest",
"mocha": "latest",
"nyc": "latest",
"should": "latest",
"standard": "latest"
},
"engines": {
"node": ">= 8"
},
"files": [
"index.js"
],
"scripts": {
"coveralls": "nyc report --reporter=text-lcov | coveralls",
"test": "TZ=UTC NODE_ENV=test nyc mocha test"
},
"license": "MIT",
"lint-staged": {
"*.js": [
"prettier-standard",
"git add"
]
},
"standard": {
"env": [
"mocha"
]
},
"dependencies": {
"condense-whitespace": "~1.0.0",
"lodash": "~4.17.4",
"to-title-case": "~1.0.0"
}
}
27 changes: 27 additions & 0 deletions packages/metascraper-soundcloud/test/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
'use strict'

const should = require('should')

const clearbitLogo = require('..')()

describe('metascraper clearbit logo', () => {
it('propName is logo', () => {
should(clearbitLogo.propName).be.equal('logo')
})

it('if logo is present, not do nothing', () => {
const url = 'https://facebook.com'
const meta = { logo: 'https://facebook.com/logo.png' }
const data = clearbitLogo[0]({ url, meta })
should(data).be.undefined()
})

it('if logo is not present, fallback to clearbit logo API', () => {
const url = 'https://facebook.com'
const meta = { logo: 'https://facebook.com/favicon.ico' }
const data = clearbitLogo[0]({ url, meta })
should(data).be.equal(
'https://logo.clearbit.com/facebook.com?size=128&format=png'
)
})
})
6 changes: 6 additions & 0 deletions packages/metascraper-soundcloud/test/mocha.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
--require should
--reporter spec
--timeout 120000
--slow 300
--bail
--recursive

0 comments on commit 9814253

Please sign in to comment.