{"id":16557662,"url":"https://github.com/patrickkfkan/mixcloud-fetch","last_synced_at":"2025-03-04T23:40:53.076Z","repository":{"id":57298546,"uuid":"344473392","full_name":"patrickkfkan/mixcloud-fetch","owner":"patrickkfkan","description":"Node module for fetching Mixcloud resources.","archived":false,"fork":false,"pushed_at":"2023-12-07T16:05:22.000Z","size":763,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-15T22:35:24.958Z","etag":null,"topics":["api","mixcloud","scraper"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/patrickkfkan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-03-04T12:52:43.000Z","updated_at":"2023-12-01T13:59:04.000Z","dependencies_parsed_at":"2023-12-04T22:35:41.263Z","dependency_job_id":null,"html_url":"https://github.com/patrickkfkan/mixcloud-fetch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickkfkan%2Fmixcloud-fetch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickkfkan%2Fmixcloud-fetch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickkfkan%2Fmixcloud-fetch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickkfkan%2Fmixcloud-fetch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/patrickkfkan","download_url":"https://codeload.github.com/patrickkfkan/mixcloud-fetch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241940529,"owners_count":20045878,"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":["api","mixcloud","scraper"],"created_at":"2024-10-11T20:08:10.529Z","updated_at":"2025-03-04T23:40:53.049Z","avatar_url":"https://github.com/patrickkfkan.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mixcloud-fetch\n\nNode module for fetching Mixcloud resources.\n\nNote: `mixcloud-fetch` does not support user login, so you won't be able to fetch exclusive content or access account-specific features.\n\n# Installation\n\n```\nnpm i mixcloud-fetch --save\n```\n\n# Usage\n\n```\nimport mcfetch from 'mixcloud-fetch';\n\n// Get shows matching the 'ambient' and 'lounge' tags\nconst shows = await mcfetch.tag(['ambient', 'lounge']).getShows();\n\n// Search for tags matching 'jazz funk'\nconst tags = await mcfetch.search('jazz funk').getTags();\n```\n\nHere, `mcfetch` is the default [MixcloudFetch](docs/api/classes/MixcloudFetch.md) instance exported by `mixcloud-fetch`. The `MixcloudFetch` class defines methods for accessing the underlying APIs.\n\n## Tag API\n\n#### Access method\n\n#### `MixcloudFetch#tag(slug | slug[])`\n\nReturns a [TagAPI](docs/api/classes/TagAPI.md) instance targeting the tag given by `slug`, or multiple tags given by `slug[]`.\n\n#### Description\n\nA tag is used to discover shows and is identified by its **slug**. To access the Tag API, call the `tag()` method of a `MixcloudFetch` instance, passing into it the slug of the target tag.\n\n```\nconst slug = 'jazz';\nconst tag = mcfetch.tag(slug);\n```\n\nTo target multiple tags, put their slugs into an array and pass the array into `tag()`:\n\n```\nconst slugs = [\n    'jazz',\n    'funk'\n];\nconst tag = mcfetch.tag(slugs);\n```\n\nYou can then call methods provided by `TagAPI`.\n\n#### API methods\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ccode\u003eTagAPI#getInfo()\u003c/code\u003e\u003c/summary\u003e\n\u003cbr /\u003e\n\n[Example](examples/tag/getInfo.ts) ➔ [Output](examples/tag/getInfo_output.txt)\n\n\u003cp\u003eFetches information about the target tag(s).\u003c/p\u003e\n\n**Returns**\n\nPromise:\n- If none of the target tag(s) exist, the Promise resolves to `null`.\n- Otherwise, the Promise resolves to an Array of [Tag](docs/api/interfaces/Tag.md) items. Only tags that exist will be included in the Array.\n\n---\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ccode\u003eTagAPI#getShows([params])\u003c/code\u003e\u003c/summary\u003e\n\u003cbr /\u003e\n\n[Example](examples/tag/getShows.ts) ➔ [Output](examples/tag/getShows_output.txt)\n\n\u003cp\u003eFetches Cloudcasts matching the target tag(s).\u003c/p\u003e\n\n**Params**\n\n`params`: (object) (*optional* and *all properties optional*)\n\n| Property      | Description               |\n|---------------|---------------------------|\n| `orderBy`     | (string) `trending` \\| `popular` \\| `latest`. Default: `trending`      |\n| `country`     | \u003cp\u003e(string) Country code - **only supported when `orderBy` is `trending`.**\u003c/p\u003e\u003cp\u003eIf specified, return Cloudcasts originating from  `country`. For the list of values you can specify, call [MiscAPI#getCountries()](#api-methods-6).\u003c/p\u003e\u003cp\u003eIf not specified, the default value will be determined by Mixcloud.\u003c/p\u003e |\n| `limit`       | (number) Number of items to fetch (max: 100). Default: 20 |\n| `pageToken`   | (string) Continuation token for fetching the next batch of items following the previous fetch.\n\n**Returns**\n\n- If none of the target tag(s) exist, the Promise resolves to `null`.\n- Otherwise, the Promise resolves to an object with the following properties:\n\n| Property      | Description               |\n|---------------|---------------------------|\n| `items`       | (Array) The list of [Cloudcast](docs/api/interfaces/Cloudcast.md) items fetched.\n| `nextPageToken` | \u003cp\u003e(string) If available, the continuation token for retrieving the next batch of items. Otherwise, there are no further items available.\u003c/p\u003e\u003cp\u003eTo fetch the next batch of items, pass the token as `params.pageToken` in the next call to this method.\u003c/p\u003e\n| `selectedTags` | (Array) The [Tag](docs/api/interfaces/Tag.md) items representing the target tags. |\n| `params`      | (object) Sanitized version of `params` used to request data from Mixcloud. |\n\n---\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ccode\u003eTagAPI#getFeatured([params])\u003c/code\u003e\u003c/summary\u003e\n\u003cbr /\u003e\n\n[Example](examples/tag/getFeatured.ts) ➔ [Output](examples/tag/getFeatured_output.txt)\n\n\u003cp\u003eFetches featured Cloudcasts matching the target tag(s).\u003c/p\u003e\n\n**Params**\n\n`params`: (object) (*optional* and *all properties optional*)\n\n| Property      | Description               |\n|---------------|---------------------------|\n| `orderBy`     | (string) `popular` \\| `latest`. Default: `latest`      |\n| `limit`       | (number) Number of items to fetch (max: 100). Default: 20 |\n| `pageToken`   | (string) Continuation token for fetching the next batch of items following the previous fetch.\n\n**Returns**\n\nPromise:\n- If none of the target tag(s) exist, the Promise resolves to `null`.\n- Otherwise, the Promise resolves to an object with the following properties:\n\n| Property      | Description               |\n|---------------|---------------------------|\n| `items`       | (Array) The list of [Cloudcast](docs/api/interfaces/Cloudcast.md) items fetched.\n| `nextPageToken` | \u003cp\u003e(string) If available, the continuation token for retrieving the next batch of items. Otherwise, there are no further items available.\u003c/p\u003e\u003cp\u003eTo fetch the next batch of items, pass the token as `params.pageToken` in the next call to this method.\u003c/p\u003e\n| `selectedTags` | (Array) The [Tag](docs/api/interfaces/Tag.md) items representing the target tags. |\n| `params`      | (object) Sanitized version of `params` used to request data from Mixcloud. |\n\n---\n\u003c/details\u003e\n\n## User API\n\n#### Access method\n\n#### `MixcloudFetch#user(username)`\n\nReturns a [UserAPI](docs/api/classes/UserAPI.md) instance targeting the user given by `username`.\n\n#### Description\n\nA user is identified by **username**. To access the User API, call the `user()` method of a `MixcloudFetch` instance, passing into it the username of the target user:\n\n```\nconst username = 'jazzcat';\nconst user = mcfetch.user(username);\n```\n\nYou can then call methods provided by `UserAPI`.\n\n#### API methods\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ccode\u003eUserAPI#getInfo()\u003c/code\u003e\u003c/summary\u003e\n\u003cbr /\u003e\n\n[Example](examples/user/getInfo.ts) ➔ [Output](examples/user/getInfo_output.txt)\n\n\u003cp\u003eFetches information about the target user.\u003c/p\u003e\n\n**Returns**\n\nPromise resolving to [User](docs/api/interfaces/User.md), or `null` if target user does not exist.\n\n---\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ccode\u003eUserAPI#getShows([params])\u003c/code\u003e\u003c/summary\u003e\n\u003cbr /\u003e\n\n[Example](examples/user/getShows.ts) ➔ [Output](examples/user/getShows_output.txt)\n\n\u003cp\u003eFetches Cloudcasts uploaded by the target user.\u003c/p\u003e\n\n**Params**\n\n`params`: (object) (*optional* and *all properties optional*)\n\n| Property      | Description               |\n|---------------|---------------------------|\n| `orderBy`     | (string) 'trending' \\| 'popular' \\| 'latest' \\| 'oldest'. Default: `latest`      |\n| `limit`       | (number) Number of items to fetch (max: 100). Default: 20 |\n| `pageToken`   | (string) Continuation token for fetching the next batch of items following the previous fetch.\n\n**Returns**\n\nPromise:\n- If target user does not exist, the Promise resolves to `null`.\n- Otherwise, the Promise resolves to an object with the following properties:\n\n| Property      | Description               |\n|---------------|---------------------------|\n| `items`       | (Array) The list of [Cloudcast](docs/api/interfaces/Cloudcast.md) items fetched.\n| `nextPageToken` | \u003cp\u003e(string) If available, the continuation token for retrieving the next batch of items. Otherwise, there are no further items available.\u003c/p\u003e\u003cp\u003eTo fetch the next batch of items, pass the token as `params.pageToken` in the next call to this method.\u003c/p\u003e\n| `params`      | (object) Sanitized version of `params` used to request data from Mixcloud. |\n\n---\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ccode\u003eUserAPI#getPlaylists()\u003c/code\u003e\u003c/summary\u003e\n\u003cbr /\u003e\n\n[Example](examples/user/getPlaylists.ts) ➔ [Output](examples/user/getPlaylists_output.txt)\n\n\u003cp\u003eFetches playlists owned by the target user.\u003c/p\u003e\n\n**Returns**\n\nPromise:\n- If target user does not exist, the Promise resolves to `null`.\n- Otherwise, the Promise resolves to an Array of [Playlist](docs/api/interfaces/Playlist.md) items.\n\n---\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ccode\u003eUserAPI#getLiveStream()\u003c/code\u003e\u003c/summary\u003e\n\u003cbr /\u003e\n\n[Example](examples/user/getLiveStream.ts) ➔ [Output](examples/user/getLiveStream_output.txt)\n\n\u003cp\u003eFetches the target user's live stream.\u003c/p\u003e\n\n\u003e Note: it is possible that the live stream has ended. Check the `status` property to ascertain.\n\n**Returns**\n\nPromise:\n- If there is no live stream, or target user does not exist, the Promise resolves to `null`.\n- Otherwise, the Promise resolves to a [LiveStream](docs/api/interfaces/LiveStream.md) item.\n\n---\n\u003c/details\u003e\n\n## Playlist API\n\n#### Access method\n\n#### `MixcloudFetch#playlist(playlistID)`\n\nReturns a [PlaylistAPI](docs/api/classes/PlaylistAPI.md) instance targeting the playlist given by `playlistID`.\n\n#### Description\n\nA playlist is identified by its ID. To access the Playlist API, call the `playlist()` method of a `MixcloudFetch` instance, passing into it the ID of the target playlist:\n\n```\nconst playlistId = 'UGxheWxpc3Q6MTM5NDM2MA==';\nconst playlist = mcfetch.playlist(playlistId);\n```\n\nYou can then call methods provided by `PlaylistAPI`.\n\n#### API methods\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ccode\u003ePlaylistAPI#getInfo()\u003c/code\u003e\u003c/summary\u003e\n\u003cbr /\u003e\n\n[Example](examples/playlist/getInfo.ts) ➔ [Output](examples/playlist/getInfo_output.txt)\n\n\u003cp\u003eFetches information about the target playlist.\u003c/p\u003e\n\n**Returns**\n\nPromise resolving to [Playlist](docs/api/interfaces/Playlist.md), or `null` if target playlist does not exist.\n\n---\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ccode\u003ePlaylistAPI#getShows([params])\u003c/code\u003e\u003c/summary\u003e\n\u003cbr /\u003e\n\n[Example](examples/playlist/getShows.ts) ➔ [Output](examples/playlist/getShows_output.txt)\n\n\u003cp\u003eFetches Cloudcasts in the target playlist.\u003c/p\u003e\n\n**Params**\n\n`params`: (object) (*optional* and *all properties optional*)\n\n| Property      | Description               |\n|---------------|---------------------------|\n| `limit`       | (number) Number of items to fetch (max: 100). Default: 20 |\n| `pageToken`   | (string) Continuation token for fetching the next batch of items following the previous fetch.\n\n**Returns**\n\nPromise:\n- If target playlist does not exist, the Promise resolves to `null`.\n- Otherwise, the Promise resolves to an object with the following properties:\n\n| Property      | Description               |\n|---------------|---------------------------|\n| `items`       | (Array) The list of [Cloudcast](docs/api/interfaces/Cloudcast.md) items fetched.\n| `nextPageToken` | \u003cp\u003e(string) If available, the continuation token for retrieving the next batch of items. Otherwise, there are no further items available.\u003c/p\u003e\u003cp\u003eTo fetch the next batch of items, pass the token as `params.pageToken` in the next call to this method.\u003c/p\u003e\n\n---\n\u003c/details\u003e\n\n## Cloudcast API\n\n#### Access method\n\n#### `MixcloudFetch#cloudcast(cloudcastID)`\n\nReturns a [CloudcastAPI](docs/api/classes/CloudcastAPI.md) instance targeting the Cloudcast given by `cloudcastID`.\n\n#### Description\n\nA Cloudcast is identified by its ID. To access the Cloudcast API, call the `cloudcast()` method of a `MixcloudFetch` instance, passing into it the ID of the target Cloudcast:\n\n```\nconst cloudcastId = 'Q2xvdWRjYXN0OjE1MDg0MzQzNA==';\nconst cloudcast = mcfetch.cloudcast(cloudcastId);\n```\n\nYou can then call methods provided by `CloudcastAPI`.\n\n#### API methods\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ccode\u003eCloudcastAPI#getInfo()\u003c/code\u003e\u003c/summary\u003e\n\u003cbr /\u003e\n\n[Example](examples/cloudcast/getInfo.ts) ➔ [Output](examples/cloudcast/getInfo_output.txt)\n\n\u003cp\u003eFetches information about the target Cloudcast.\u003c/p\u003e\n\n**Returns**\n\nPromise resolving to [Cloudcast](docs/api/interfaces/Cloudcast.md), or `null` if target Cloudcast does not exist.\n\n---\n\u003c/details\u003e\n\n## Search API\n\n#### Access method\n\n#### `MixcloudFetch#search(keywords)`\n\nReturns a [SearchAPI](docs/api/classes/SearchAPI.md) instance targeting the `keywords` to search for.\n\n#### Description\n\n`mixcloud-fetch` supports searching Tags, Shows and Users. To access the Search API, call the `search()` method of a `MixcloudFetch` instance, passing into it the keywords you would like to search for.\n\n```\nconst keywords = 'ambient lounge';\nconst search = mcfetch.search(keywords);\n```\n\nYou can then call methods provided by `SearchAPI`.\n\n#### API methods\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ccode\u003eSearchAPI#getTags([params])\u003c/code\u003e\u003c/summary\u003e\n\u003cbr /\u003e\n\n[Example](examples/search/getTags.ts) ➔ [Output](examples/search/getTags_output.txt)\n\n\u003cp\u003eSearches for tags matching the target keywords.\u003c/p\u003e\n\n**Params**\n\n`params`: (object) (*optional* and *all properties optional*)\n\n| Property      | Description               |\n|---------------|---------------------------|\n| `limit`       | (number) Number of items to fetch (max: 100). Default: 20 |\n| `pageToken`   | (string) Continuation token for fetching the next batch of items following the previous fetch.\n\n**Returns**\n\nPromise resolving to an object with the following properties:\n\n| Property      | Description               |\n|---------------|---------------------------|\n| `items`       | (Array) The list of [Tag](docs/api/interfaces/Tag.md) items found.\n| `nextPageToken` | \u003cp\u003e(string) If available, the continuation token for retrieving the next batch of items. Otherwise, there are no further items available.\u003c/p\u003e\u003cp\u003eTo fetch the next batch of items, pass the token as `params.pageToken` in the next call to this method.\u003c/p\u003e\n| `params`      | (object) Sanitized version of `params` used to request data from Mixcloud. |\n\n---\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ccode\u003eSearchAPI#getShows([params])\u003c/code\u003e\u003c/summary\u003e\n\u003cbr /\u003e\n\n[Example](examples/search/getShows.ts) ➔ [Output](examples/search/getShows_output.txt)\n\n\u003cp\u003eSearches for Cloudcasts matching the target keywords.\u003c/p\u003e\n\n**Params**\n\n`params`: (object) (*optional* and *all properties optional*)\n\n| Property      | Description               |\n|---------------|---------------------------|\n| `dateUploaded`| (string) `pastWeek` \\| `pastMonth` \\| `pastYear` \\| `anyTime`. Default: `anyTime` |\n| `requireTimeStamp` | (boolean) If `true`, only return Cloudcasts that are timestamped. Default: `false` |\n| `limit`       | (number) Number of items to fetch (max: 100). Default: 20 |\n| `pageToken`   | (string) Continuation token for fetching the next batch of items following the previous fetch.\n\n**Returns**\n\nPromise resolving to an object with the following properties:\n\n| Property      | Description               |\n|---------------|---------------------------|\n| `items`       | (Array) The list of [Cloudcast](docs/api/interfaces/Cloudcast.md) items found.\n| `nextPageToken` | \u003cp\u003e(string) If available, the continuation token for retrieving the next batch of items. Otherwise, there are no further items available.\u003c/p\u003e\u003cp\u003eTo fetch the next batch of items, pass the token as `params.pageToken` in the next call to this method.\u003c/p\u003e\n| `params`      | (object) Sanitized version of `params` used to request data from Mixcloud. |\n\n---\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ccode\u003eSearchAPI#getUsers([params])\u003c/code\u003e\u003c/summary\u003e\n\u003cbr /\u003e\n\n[Example](examples/search/getUsers.ts) ➔ [Output](examples/search/getUsers_output.txt)\n\n\u003cp\u003eSearches for users matching the target keywords.\u003c/p\u003e\n\n**Params**\n\n`params`: (object) (*optional* and *all properties optional*)\n\n| Property      | Description               |\n|---------------|---------------------------|\n| `dateJoined`| (string) `pastWeek` \\| `pastMonth` \\| `pastYear` \\| `anyTime`. Default: `anyTime` |\n| `userType`    | (string) `uploader` \\| `listener` \\| `any`. Default: `any`\n| `limit`       | (number) Number of items to fetch (max: 100). Default: 20 |\n| `pageToken`   | (string) Continuation token for fetching the next batch of items following the previous fetch.\n\n**Returns**\n\nPromise resolving to an object with the following properties:\n\n| Property      | Description               |\n|---------------|---------------------------|\n| `items`       | (Array) The list of [User](docs/api/interfaces/User.md) items found.\n| `nextPageToken` | \u003cp\u003e(string) If available, the continuation token for retrieving the next batch of items. Otherwise, there are no further items available.\u003c/p\u003e\u003cp\u003eTo fetch the next batch of items, pass the token as `params.pageToken` in the next call to this method.\u003c/p\u003e\n| `params`      | (object) Sanitized version of `params` used to request data from Mixcloud. |\n\n---\n\u003c/details\u003e\n\n## LiveStream API\n\n#### Access property\n\n#### `MixcloudFetch#liveStream`\n\nReturns a [LiveStreamAPI](docs/api/classes/LiveStreamAPI.md) isntance.\n\n#### Description\n\nThe LiveStream API allows you to fetch Mixcloud live streams.\n\n#### API methods\n\n\u003e For fetching the live stream of a user, call [UserAPI#getLiveStream()](#api-methods-1) instead.\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ccode\u003eLiveStreamAPI#getCurrent([params])\u003c/code\u003e\u003c/summary\u003e\n\u003cbr /\u003e\n\n[Example](examples/live_stream/getCurrent.ts) ➔ [Output](examples/live_stream/getCurrent_output.txt)\n\n\u003cp\u003eFetches the current live streams on Mixcloud.\u003c/p\u003e\n\n**Params**\n\n`params`: (object) (*optional* and *all properties optional*)\n\n| Property      | Description               |\n|---------------|---------------------------|\n| `orderBy`     | (string) `popular` \\| `mostRecent`. Default: `popular` |\n| `category`    | \u003cp\u003e(string) If specified, return live streams in  `category`.\u003c/p\u003e\u003cp\u003eFor the list of values you can specify, call `getCategories()` of this API.\u003c/p\u003e |\n| `limit`       | (number) Number of items to fetch (max: 100). Default: 20 |\n| `pageToken`   | (string) Continuation token for fetching the next batch of items following the previous fetch.\n\n**Returns**\n\nPromise resolving to an object with the following properties:\n\n| Property      | Description               |\n|---------------|---------------------------|\n| `items`       | (Array) The list of [LiveStream](docs/api/interfaces/LiveStream.md) items fetched.\n| `nextPageToken` | \u003cp\u003e(string) If available, the continuation token for retrieving the next batch of items. Otherwise, there are no further items available.\u003c/p\u003e\u003cp\u003eTo fetch the next batch of items, pass the token as `params.pageToken` in the next call to this method.\u003c/p\u003e\n| `params`      | (object) Sanitized version of `params` used to request data from Mixcloud. |\n\n---\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ccode\u003eLiveStreamAPI#getCategories()\u003c/code\u003e\u003c/summary\u003e\n\u003cbr /\u003e\n\n[Example](examples/live_stream/getCategories.ts) ➔ [Output](examples/live_stream/getCategories_output.txt)\n\n\u003cp\u003eFetches the available live stream categories.\u003c/p\u003e\n\n**Returns**\n\nPromise resolving to an Array of strings. Each array element is the name of a live stream category.\n\n---\n\u003c/details\u003e\n\n## Miscellaneous API\n\n#### Access property\n\n#### `MixcloudFetch#misc`\n\nReturns a [MiscAPI](docs/api/classes/MiscAPI.md) instance.\n\n#### Description\n\nThe Miscellaneous API provides methods for obtaining values that can be used in other API methods.\n\n#### API methods\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ccode\u003eMiscAPI#getCategories()\u003c/code\u003e\u003c/summary\u003e\n\u003cbr /\u003e\n\n[Example](examples/misc/getCategories.ts) ➔ [Output](examples/misc/getCategories_output.txt)\n\nFetches the list of Mixcloud categories. See Usage below for example of fetching Cloudcasts belonging to a specific category.\n\n**Returns**\n\nPromise resolving to a [CategoryBundle](docs/api/interfaces/Category.md). A bundle is an object with the following structure:\n\n```\n{\n  bundle1: Category[],\n  bundle2: Category[]\n}\n```\n\nA [Category](docs/api/interfaces/Category.md) is an object wih the following key properties:\n\n| Property          | Description                    |\n|-------------------|--------------------------------|\n| `name`            | (string) Category name         |\n| `slug`            | (string) Category identifier   |\n\n**Usage**\n\nSay we have the following category bundle obtained from `getCategories()`:\n\n```\n{\n  music: [\n    { name: 'Ambient', slug: 'ambient' },\n    { name: 'Bass', slug: 'bass' }\n    ...\n  ],\n  talk: [\n    { name: 'Business', slug: 'business' },\n    { name: 'Comedy', slug: 'comedy' }\n    ...\n  ]\n}\n```\n\nTo obtain Cloudcasts belonging to the 'Ambient' category, use its `slug` property in conjunction with the Tag API:\n\n```\nconst tag = mcfetch.tag(bundle['music'][0]['slug']); \nconst showsInAmbientCategory = await tag.getShows(); \n```\n\n---\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ccode\u003eMiscAPI#getCountries()\u003c/code\u003e\u003c/summary\u003e\n\u003cbr /\u003e\n\n[Example](examples/misc/getCountries.ts) ➔ [Output](examples/misc/getCountries_output.txt)\n\nFetches the list of countries available on Mixcloud. See Usage below for example of fetching Cloudcasts originating from a specific country.\n\n**Returns**\n\nPromise resolving to a [CountryBundle](docs/api/interfaces/CountryBundle.md). A bundle is an object with the following properties:\n\n| Property          | Description                    |\n|-------------------|--------------------------------|\n| `default`         | (object) The default country   |\n| `available`       | (Array) The list of available countries |\n\nEach [Country](docs/api/interfaces/Country.md) is an object with the following properties:\n\n| Property          | Description                    |\n|-------------------|--------------------------------|\n| `code`            | (string) Country code          |\n| `name`            | (string) Country name          |\n\n**Usage**\n\nSay we have the following countries returned by `getCountries()`:\n\n```\n{\n  default: { code: 'HKG', name: 'Hong Kong' },\n  available: [\n    { code: 'GLOBAL', name: 'Global' },\n    { code: 'AUS', name: 'Australia' },\n    { code: 'CAN', name: 'Canada' },\n    ...\n  ]\n}\n```\n\nTo obtain Cloudcasts matching the 'jazz' tag and originating from Canada:\n\n```\nconst tag = mcfetch.tag('jazz'); \nconst jazzShowsFromCanada = await tag.getShows({\n  country: 'CAN' // Use the country code\n});\n```\n\n---\n\u003c/details\u003e\n\n# Rate Limiting\n\nFetch requests are rate limited by default. Rate limiting is useful when you need to make a large number of queries and don't want to run the risk of getting rejected by the server for making too many requests within a short time interval.\n\nThe library uses [Bottleneck](https://www.npmjs.com/package/bottleneck) for rate limiting. You can configure the rate limiter like this:\n\n```\nmcfetch.limiter.setOptions({\n    maxConcurrent: 10,  // default: 5\n    minTime: 100        // default: 200\n});\n```\n`setOptions()` is just a passthrough function to Bottleneck's `updateSettings()`. Check the [Bottleneck doc](https://www.npmjs.com/package/bottleneck#docs) for the list of options you can set.\n\nTo check if the rate limiter is enabled:\n\n```\nmcfetch.limiter.isEnabled()\n```\n\nTo disable the rate limiter:\n\n```\nmcfetch.limiter.setEnabled(false);\n```\n\n# Caching\n\nThe library maintains an in-memory cache for storing results of fetch requests. You can access the cache functions as follows:\n\n```\n// Set the expiry time of cache entries (seconds)\nmcfetch.cache.setTTL(500); // Default: 300\n\n// Set the maximum number of entries that can be stored in the cache\n// Specify a negative value (e.g -1) for unlimited entries.\nmcfetch.cache.setMaxEntries(20); // Default: 10\n\n// Clears the cache\nmcfetch.cache.clear();\n```\n\n# Changelog\n\n1.0.3\n- LiveStream API: fix `pageToken` ignored in `getCurrent()`\n\n1.0.2\n- Fix regression: `PlaylistAPI#getShows()` missing params\n\n1.0.1\n- `Playlist`: fix wrong type for `name` property\n\n1.0.0\n- Migrate to Typescript; package as ESM + CJS hybrid module\n- Add support for fetching live streams\n\n0.1.1:\n- Fix fetch errors due to Mixcloud changing their GraphQL URL.\n\n# License\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickkfkan%2Fmixcloud-fetch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatrickkfkan%2Fmixcloud-fetch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickkfkan%2Fmixcloud-fetch/lists"}