# spotify-activity-listener

> Poll Last.fm for your most recent Spotify listens.

Latest version **1.1.2** (published 2018-08-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install spotify-activity-listener
pnpm add spotify-activity-listener
yarn add spotify-activity-listener
bun add spotify-activity-listener
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2018-08-26 |
| First published | 2016-10-02 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 716.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Brady Sheridan |
| Maintainers | bradysheridan |
| Keywords | scrobble, lastfm, spotify, music, feed, activity, listener, display, node, package, real, time |

## Links

- npm: https://www.npmjs.com/package/spotify-activity-listener
- Repository: https://github.com/bradysheridan/spotify-activity-listener
- Homepage: https://github.com/bradysheridan/spotify-activity-listener#readme
- Issues: https://github.com/bradysheridan/spotify-activity-listener/issues
- npm.io page: https://npm.io/package/spotify-activity-listener

## Dependencies (1)

- [xhr2](https://npm.io/package/xhr2.md) ^0.1.4

## Alternatives

- [@js-joda/timezone](https://npm.io/package/@js-joda/timezone.md) — 383.4K weekly downloads
- [chartjs-adapter-moment](https://npm.io/package/chartjs-adapter-moment.md) — 210.8K weekly downloads
- [strftime](https://npm.io/package/strftime.md) — 171.2K weekly downloads
- [vue-flatpickr-component](https://npm.io/package/vue-flatpickr-component.md) — 115.8K weekly downloads
- [timepicker](https://npm.io/package/timepicker.md) — 51.0K weekly downloads

## Recent versions

- 1.1.2 (latest) — 2018-08-26
- 1.1.1 — 2018-08-26
- 1.1.0 — 2016-10-02
- 1.0.6 — 2016-10-02
- 1.0.5 — 2016-10-02
- 1.0.4 — 2016-10-02
- 1.0.3 — 2016-10-02
- 1.0.2 — 2016-10-02
- 1.0.1 — 2016-10-02
- 1.0.0 — 2016-10-02

## README

# **Spotify Activity Listener**
### Poll Last.fm for your recent Spotify listening data.

## **Demo**
![The gif failed to load, please refresh your browser!](https://github.com/bradysheridan/spotify-activity-listener/blob/master/images/demo.gif)

## **Prerequisite Configuration**
1. [Create a Last.fm account](https://www.last.fm/join)
2. [Enable API access for your account](http://www.last.fm/api/account/create)
3. Make note of your API key
![The image failed to load, please refresh your browser!](https://github.com/bradysheridan/spotify-activity-listener/blob/master/images/api-key.png)
4. In Spotify, go to `Settings > Last.fm` and select `Connect to Last.fm`
![The image failed to load, please refresh your browser!](https://github.com/bradysheridan/spotify-activity-listener/blob/master/images/spotify-settings.jpg)

## **Installation**
1. `npm i spotify-activity-listener --save`

## **Usage**
### [**Full Usage Example (React.js)**](https://github.com/bradysheridan/spotify-activity-listener/blob/master/example/Example.js)
- Import the listener:
```javascript
import SpotifyListener from 'spotify-activity-listener';
// Or
var SpotifyListener = require('spotify-activity-listener');
```
- Instantiate the listener:
```javascript
var Listener = new SpotifyListener({
  username: 'YOUR_LAST.FM_USERNAME',
  key: 'YOUR_LAST.FM_API_KEY',
  pollInterval: 5000, // (Milliseconds)
  trackCount: 1, // Capped at 50 by Last.fm
  callback: (res) => {
    // Handle response data here
  }
});
```
- Start listening
```javascript
Listener.startListening();
```
- Stop listening (if need be)
```javascript
Listener.stopListening();
```

## **Response Format**
```javascript
[
  {
    album: "Atrocity Exhibition",
    art: "https://lastfm-img2.akamaized.net/i/u/300x300/514bed1643432ccf69854d30e35d24ba.png",
    artist: "Danny Brown",
    name: "Downward Spiral"
  },
  { /* (...) */ },
  { /* (...) */ }
]
```

## **Contribute**
1. Fork it
2. Create your branch
3. Make some changes
4. Commit the changes
5. Submit a pull request

---
_Source: https://npm.io/package/spotify-activity-listener · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
