{"id":13630348,"url":"https://github.com/microlinkhq/spotify-url-info","last_synced_at":"2025-04-07T07:10:50.954Z","repository":{"id":41380065,"uuid":"138942841","full_name":"microlinkhq/spotify-url-info","owner":"microlinkhq","description":"Get metadata from any Spotify URL.","archived":false,"fork":false,"pushed_at":"2024-05-24T08:35:23.000Z","size":393,"stargazers_count":72,"open_issues_count":1,"forks_count":16,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-06-26T11:18:34.343Z","etag":null,"topics":["link-preview","metadata","spotify","spotify-urls"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/microlinkhq.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-27T23:23:08.000Z","updated_at":"2024-07-06T09:41:39.697Z","dependencies_parsed_at":"2023-01-31T09:45:54.193Z","dependency_job_id":"31d625ab-ebb2-49ba-bc61-b25ce1db72da","html_url":"https://github.com/microlinkhq/spotify-url-info","commit_stats":{"total_commits":159,"total_committers":14,"mean_commits":"11.357142857142858","dds":0.3647798742138365,"last_synced_commit":"dacc16348bcbaa0745a948aef3a90ecc557590e3"},"previous_names":[],"tags_count":52,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microlinkhq%2Fspotify-url-info","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microlinkhq%2Fspotify-url-info/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microlinkhq%2Fspotify-url-info/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microlinkhq%2Fspotify-url-info/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/microlinkhq","download_url":"https://codeload.github.com/microlinkhq/spotify-url-info/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247608151,"owners_count":20965952,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["link-preview","metadata","spotify","spotify-urls"],"created_at":"2024-08-01T22:01:39.612Z","updated_at":"2025-04-07T07:10:50.931Z","avatar_url":"https://github.com/microlinkhq.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/microlinkhq/cdn/raw/master/dist/logo/banner.png#gh-light-mode-only\" alt=\"microlink logo\"\u003e\n  \u003cimg src=\"https://github.com/microlinkhq/cdn/raw/master/dist/logo/banner-dark.png#gh-dark-mode-only\" alt=\"microlink logo\"\u003e\n  \u003cbr\u003e\n  \u003cbr\u003e\n\u003c/div\u003e\n\n![Last version](https://img.shields.io/github/tag/microlinkhq/spotify-url-info.svg?style=flat-square)\n[![Coverage Status](https://img.shields.io/coveralls/microlinkhq/spotify-url-info.svg?style=flat-square)](https://coveralls.io/github/microlinkhq/spotify.url-info)\n[![NPM Status](https://img.shields.io/npm/dm/spotify-url-info.svg?style=flat-square)](https://www.npmjs.org/package/spotify-url-info)\n\n\u003e Get metadata from Spotify URLs.\n\n## Install\n\n```bash\nnpm install spotify-url-info\n```\n\n## Usage\n\nIn order to use the library, you have to provide the fetch agent to use:\n\n```js\nconst fetch = require('isomorphic-unfetch')\nconst { getData, getPreview, getTracks, getDetails } =\n  require('spotify-url-info')(fetch)\n```\n\nThere are four functions:\n\n- **getData**\u003cbr/\u003e\n  Provides the full available data, in a shape that is very similar to [what the spotify API returns](https://developer.spotify.com/documentation/web-api/reference/object-model/).\n\n- **getPreview** \u003cbr/\u003e\n  Always returns the same fields for different types of resources (album, artist, playlist, track). The preview track is the first in the Album, Playlist, etc.\n\n- **getTracks** \u003cbr/\u003e\n  Returns array with tracks. This data is passed on straight from spotify, so the shape could change.Only the first 100 tracks will be returned.\n\n- **getDetails** \u003cbr/\u003e\n  Returns both the preview and tracks. Should be used if you require information from both of them so that only one request is made.\n\nAll the methods receive a Spotify URL (play. or open.) as first argument:\n\n```js\ngetPreview('https://open.spotify.com/track/5nTtCOCds6I0PHMNtqelas').then(data =\u003e\n  console.log(data)\n)\n```\n\nAdditionally, you can provide fetch agent options as second argument:\n\n```js\ngetPreview('https://open.spotify.com/track/5nTtCOCds6I0PHMNtqelas', {\n  headers: {\n    'user-agent': 'googlebot'\n  }\n}).then(data =\u003e console.log(data))\n```\n\nIt returns back the information related to the Spotify URL:\n\n```json\n{\n  \"title\": \"Immaterial\",\n  \"type\": \"track\",\n  \"track\": \"Immaterial\",\n  \"artist\": \"SOPHIE\",\n  \"image\": \"https://i.scdn.co/image/d6f496a6708d22a2f867e5acb84afb0eb0b07bc1\",\n  \"audio\": \"https://p.scdn.co/mp3-preview/6be8eb12ff18ae09b7a6d38ff1e5327fd128a74e?cid=162b7dc01f3a4a2ca32ed3cec83d1e02\",\n  \"link\": \"https://open.spotify.com/track/5nTtCOCds6I0PHMNtqelas\",\n  \"embed\": \"https://embed.spotify.com/?uri=spotify:track:5nTtCOCds6I0PHMNtqelas\",\n  \"date\": \"2018-06-15T00:00:00.000Z\",\n  \"description\": \"description of a podcast episode\"\n}\n```\n\nWhen a field can't be retrieved, the value will be `undefined`.\n\nThere are no guarantees about the shape of this data, because it varies with different media and scraping methods. Handle it carefully.\n\n## License\n\n**spotify-url-info** © [microlink.io](https://microlink.io), released under the [MIT](https://github.com/microlinkhq/spotify-url-info/blob/master/LICENSE.md) License.\u003cbr\u003e\nAuthored by [Karl Sander](https://github.com/karlsander) and maintained by [Kiko Beats](https://kikobeats.com) with help from [contributors](https://github.com/microlinkhq/spotify-url-info/contributors).\n\n\u003e [microlink.io](https://microlink.io) · GitHub [microlink.io](https://github.com/microlinkhq) · X [@microlinkhq](https://x.com/microlinkhq)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrolinkhq%2Fspotify-url-info","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicrolinkhq%2Fspotify-url-info","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrolinkhq%2Fspotify-url-info/lists"}