podcast-api 1.0.7 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2693 -2422
- package/package.json +7 -4
- package/src/PodcastApiClient.js +19 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "podcast-api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "JavaScript bindings for the Listen Notes Podcast API",
|
|
5
5
|
"main": "src/PodcastApiClient.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,9 +9,11 @@
|
|
|
9
9
|
"test": "jest"
|
|
10
10
|
},
|
|
11
11
|
"jest": {
|
|
12
|
-
"testMatch": [
|
|
12
|
+
"testMatch": [
|
|
13
|
+
"**/tests/*Test.js"
|
|
14
|
+
],
|
|
13
15
|
"testEnvironment": "node"
|
|
14
|
-
},
|
|
16
|
+
},
|
|
15
17
|
"repository": {
|
|
16
18
|
"type": "git",
|
|
17
19
|
"url": "git+https://github.com/ListenNotes/podcast-api-js.git"
|
|
@@ -33,7 +35,8 @@
|
|
|
33
35
|
},
|
|
34
36
|
"homepage": "https://github.com/ListenNotes/podcast-api-js",
|
|
35
37
|
"dependencies": {
|
|
36
|
-
"axios": "^0.21.1"
|
|
38
|
+
"axios": "^0.21.1",
|
|
39
|
+
"query-string": "^7.0.1"
|
|
37
40
|
},
|
|
38
41
|
"devDependencies": {
|
|
39
42
|
"eslint": "^7.25.0",
|
package/src/PodcastApiClient.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const axios = require('axios');
|
|
2
|
+
const queryString = require('query-string');
|
|
2
3
|
|
|
3
4
|
const API_BASE_PROD = 'https://listen-api.listennotes.com/api/v2';
|
|
4
5
|
|
|
@@ -12,41 +13,49 @@ const Client = (config = {}) => {
|
|
|
12
13
|
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
13
14
|
this.httpClient = axios.create({
|
|
14
15
|
baseURL: config.apiKey ? API_BASE_PROD : API_BASE_TEST,
|
|
15
|
-
timeout:
|
|
16
|
+
timeout: 30000,
|
|
16
17
|
headers: {
|
|
17
18
|
'X-ListenAPI-Key': config.apiKey || '',
|
|
18
19
|
'User-Agent': config.userAgent || defaultUserAgent,
|
|
19
20
|
},
|
|
20
21
|
});
|
|
21
22
|
|
|
23
|
+
this._post = (path, params) => this.httpClient.post(path, queryString.stringify(params));
|
|
24
|
+
|
|
22
25
|
this.search = (params) => this.httpClient.get('/search', { params });
|
|
23
26
|
|
|
24
27
|
this.typeahead = (params) => this.httpClient.get('/typeahead', { params });
|
|
25
28
|
|
|
29
|
+
this.spellcheck = (params) => this.httpClient.get('/spellcheck', { params });
|
|
30
|
+
|
|
31
|
+
this.fetchRelatedSearches = (params) => this.httpClient.get('/related_searches', { params });
|
|
32
|
+
|
|
33
|
+
this.fetchTrendingSearches = (params) => this.httpClient.get('/trending_searches', { params });
|
|
34
|
+
|
|
26
35
|
this.fetchBestPodcasts = (params) => this.httpClient.get('/best_podcasts', { params });
|
|
27
36
|
|
|
28
37
|
this.fetchPodcastById = (params) => {
|
|
29
38
|
const { id, ...otherParams } = params;
|
|
30
39
|
return this.httpClient.get(`/podcasts/${id}`, {
|
|
31
|
-
otherParams,
|
|
40
|
+
params: otherParams,
|
|
32
41
|
});
|
|
33
42
|
};
|
|
34
43
|
|
|
35
44
|
this.fetchEpisodeById = (params) => {
|
|
36
45
|
const { id, ...otherParams } = params;
|
|
37
46
|
return this.httpClient.get(`/episodes/${id}`, {
|
|
38
|
-
otherParams,
|
|
47
|
+
params: otherParams,
|
|
39
48
|
});
|
|
40
49
|
};
|
|
41
50
|
|
|
42
|
-
this.batchFetchPodcasts = (params) => this.
|
|
51
|
+
this.batchFetchPodcasts = (params) => this._post('/podcasts', params);
|
|
43
52
|
|
|
44
|
-
this.batchFetchEpisodes = (params) => this.
|
|
53
|
+
this.batchFetchEpisodes = (params) => this._post('/episodes', params);
|
|
45
54
|
|
|
46
55
|
this.fetchCuratedPodcastsListById = (params) => {
|
|
47
56
|
const { id, ...otherParams } = params;
|
|
48
57
|
return this.httpClient.get(`/curated_podcasts/${id}`, {
|
|
49
|
-
otherParams,
|
|
58
|
+
params: otherParams,
|
|
50
59
|
});
|
|
51
60
|
};
|
|
52
61
|
|
|
@@ -63,27 +72,27 @@ const Client = (config = {}) => {
|
|
|
63
72
|
this.fetchRecommendationsForPodcast = (params) => {
|
|
64
73
|
const { id, ...otherParams } = params;
|
|
65
74
|
return this.httpClient.get(`/podcasts/${id}/recommendations`, {
|
|
66
|
-
otherParams,
|
|
75
|
+
params: otherParams,
|
|
67
76
|
});
|
|
68
77
|
};
|
|
69
78
|
|
|
70
79
|
this.fetchRecommendationsForEpisode = (params) => {
|
|
71
80
|
const { id, ...otherParams } = params;
|
|
72
81
|
return this.httpClient.get(`/episodes/${id}/recommendations`, {
|
|
73
|
-
otherParams,
|
|
82
|
+
params: otherParams,
|
|
74
83
|
});
|
|
75
84
|
};
|
|
76
85
|
|
|
77
86
|
this.fetchPlaylistById = (params) => {
|
|
78
87
|
const { id, ...otherParams } = params;
|
|
79
88
|
return this.httpClient.get(`/playlists/${id}`, {
|
|
80
|
-
otherParams,
|
|
89
|
+
params: otherParams,
|
|
81
90
|
});
|
|
82
91
|
};
|
|
83
92
|
|
|
84
93
|
this.fetchMyPlaylists = (params) => this.httpClient.get('/playlists', { params });
|
|
85
94
|
|
|
86
|
-
this.submitPodcast = (params) => this.
|
|
95
|
+
this.submitPodcast = (params) => this._post('/podcasts/submit', params);
|
|
87
96
|
|
|
88
97
|
this.deletePodcast = (params) => {
|
|
89
98
|
const { id, reason } = params;
|