{"id":24333271,"url":"https://github.com/web-scrobbler/metadata-filter","last_synced_at":"2025-09-27T20:31:17.319Z","repository":{"id":38992273,"uuid":"250689007","full_name":"web-scrobbler/metadata-filter","owner":"web-scrobbler","description":"A module for cleaning up artist, album, and song names","archived":false,"fork":false,"pushed_at":"2024-05-28T19:03:53.000Z","size":757,"stargazers_count":30,"open_issues_count":13,"forks_count":10,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-29T10:11:53.534Z","etag":null,"topics":["amazon","filter","music","spotify","tidal","youtube"],"latest_commit_sha":null,"homepage":"https://metadata-filter.vercel.app","language":"TypeScript","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/web-scrobbler.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-28T01:31:15.000Z","updated_at":"2024-06-19T01:29:48.204Z","dependencies_parsed_at":"2023-02-08T13:46:37.906Z","dependency_job_id":"e00bd87d-1f71-4dee-811e-d0d79880bc5b","html_url":"https://github.com/web-scrobbler/metadata-filter","commit_stats":{"total_commits":354,"total_committers":10,"mean_commits":35.4,"dds":0.5056497175141244,"last_synced_commit":"8515477b6c0500f73fdd659bcdb93985d86cbba3"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/web-scrobbler%2Fmetadata-filter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/web-scrobbler%2Fmetadata-filter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/web-scrobbler%2Fmetadata-filter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/web-scrobbler%2Fmetadata-filter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/web-scrobbler","download_url":"https://codeload.github.com/web-scrobbler/metadata-filter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234455950,"owners_count":18835667,"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":["amazon","filter","music","spotify","tidal","youtube"],"created_at":"2025-01-18T03:14:47.008Z","updated_at":"2025-09-27T20:31:16.966Z","avatar_url":"https://github.com/web-scrobbler.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# metadata-filter [![Test][workflow-badge]][workflow] [![NPM][npm-badge]][npm] [![Codacy][codacy-badge]][codacy] [![Coverage][coverage-badge]][codacy]\n\nA module for cleaning up artist, album, and song names.\n\n## Installation\n\n### Install using npm\n\n```\nnpm i @web-scrobbler/metadata-filter\n```\n\n### Include via CDN\n\n```html\n\u003cscript src=\"https://unpkg.com/@web-scrobbler/metadata-filter@latest/dist/filter.min.js\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\nIf you want to use this module in a project which is built with a bundler (e.g.\nwebpack), you can use CommonJS-like or ES6 imports:\n\n```javascript\n// CommonJS style\nconst MetadataFilter = require('@web-scrobbler/metadata-filter');\n\n// ES6 style\nimport * as MetadataFilter from '@web-scrobbler/metadata-filter';\n\nMetadataFilter.removeRemastered(yourInput);\n```\n\nIn a browser you can access to the module by using the global `MetadataFilter`\nobject:\n\n```html\n\u003c!-- Assume you have `metadata-filter` module included with `script` tag --\u003e\n\u003cscript lang=\"javascript\"\u003e\n\tMetadataFilter.removeRemastered(yourInput);\n\u003c/script\u003e\n```\n\n### Single filter functions\n\nYou can call filter functions for basic, one-line filter functionality.\nThese filter functions are intended to be used on a single field, such as\nan artist, album, or track.\n\nHowever, it is possible (not officially supported) to use some of these on\ncombined fields (\"Artist - Song\", \"Artist - Album\"), as in the third example below.\n\n```javascript\nconsole.log(MetadataFilter.removeRemastered('Jane Doe (Remastered)')); // Jane Doe\nconsole.log(MetadataFilter.removeVersion('Get Lucky (Album Version)')); // Get Lucky\nconsole.log(\n\tMetadataFilter.youtube(\n\t\t'Car Bomb - Scattered Sprites (Official Music Video)'\n\t)\n); // Car Bomb - Scattered Sprites\n```\n\nSee [src/functions.ts](src/functions.ts) for more details.\n\n### Combine filter functions\n\nYou can also use multiple filter functions on a string at once by creating a\n`MetadataFilter` object which combines multiple functions from above,\nor by using one of the pre-existing [filter objects](#predefined-filters).\n\nFirst, create a filter set. This is a set of filter functions for different\nfields.\n\n```javascript\nconst filterSet = {\n\ttrack: [\n\t\tMetadataFilter.removeRemastered,\n\t\tMetadataFilter.fixTrackSuffix,\n\t\tMetadataFilter.removeLive,\n\t],\n\talbum: [\n\t\tMetadataFilter.removeRemastered,\n\t\tMetadataFilter.fixTrackSuffix,\n\t\tMetadataFilter.removeLive,\n\t],\n};\n```\n\nThen, construct a `MetadataFilter` using this filter set.\n\n```javascript\nconst filter = MetadataFilter.createFilter(filterSet);\nconsole.log(filter.filterField('album', 'Nevermind (Remastered)')); // Nevermind\nconsole.log(filter.filterField('track', 'In Bloom - Nevermind Version')); // In Bloom (Nevermind Version)\n```\n\n### Predefined filters\n\nThere are also predefined filters available for easy access. For example,\nthe above filter set can be acquired using `createSpotifyFilter()` function:\n\n```javascript\nconst filter = MetadataFilter.createSpotifyFilter();\n```\n\nSee [src/filters.ts](src/filters.ts) for more details.\n\n### Extending filters\n\nFinally, you can take existing `MetadataFilter` objects and extend them with another filter.\nThis is done by providing the `.extend()` method with another `MetadataFilter` object.\n\n```javascript\nconst filter = MetadataFilter.createSpotifyFilter();\n\nfilter.extend(MetadataFilter.createAmazonFilter());\n// This would also work: filter.extend(MetadataFilter.createFilter(filterSet));\n\nconsole.log(\n\tfilter.filterField('track', 'Seasons in the Abyss (Album Version)')\n); // Seasons in the Abyss\n```\n\nAs an alternative, you can use the `.append()` method to apply a filter set to\nan existing `MetadataFilter` object.\n\n```javascript\nconst filter = MetadataFilter.createFilter({ track: filterTrack });\n\nfilter.append({ artist: filterArtist });\n```\n\nSince these methods return a `MetadataFilter` instance, you can chain method calls.\n\n```javascript\nconst filter = MetadataFilter.createFilter({ track: filterTrack }).append({\n\tartist: filterArtist,\n});\n```\n\n## Development\n\n```sh\n# Install dev dependencies\n\u003e npm install\n\n# Build the dist file\n\u003e npm run build\n\n# Format files\n\u003e npm run format\n\n# Lint source files\n\u003e npm run lint\n\n# Run tests\n\u003e npm test\n\n# Run tests with a coverage report\n\u003e npm run test-with-coverage\n```\n\n## See also\n\n-   [music-metadata-filter] - Python implementation of this module\n\n## License\n\nLicensed under the [MIT License](LICENSE.md).\n\n\u003c!-- Badges --\u003e\n\n[workflow-badge]: https://img.shields.io/github/actions/workflow/status/web-scrobbler/metadata-filter/test.yml\n[npm-badge]: https://img.shields.io/npm/v/@web-scrobbler/metadata-filter\n[codacy-badge]: https://img.shields.io/codacy/grade/100b50dc21664ce6bc591c28b73d6892\n[coverage-badge]: https://img.shields.io/codacy/coverage/100b50dc21664ce6bc591c28b73d6892\n\n\u003c!-- Related pages --\u003e\n\n[codacy]: https://app.codacy.com/gh/web-scrobbler/metadata-filter/dashboard\n[npm]: https://www.npmjs.com/package/@web-scrobbler/metadata-filter\n[workflow]: https://github.com/web-scrobbler/metadata-filter/actions/workflows/test.yml\n\n\u003c!-- Related projects --\u003e\n\n[music-metadata-filter]: https://github.com/djmattyg007/music-metadata-filter\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweb-scrobbler%2Fmetadata-filter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweb-scrobbler%2Fmetadata-filter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweb-scrobbler%2Fmetadata-filter/lists"}