Skip to content

Commit f77ee91

Browse files
authored
Merge pull request #9 from Sv443/ver/1.2.0
2 parents 113ff2f + a9a1d58 commit f77ee91

File tree

8 files changed

+1380
-677
lines changed

8 files changed

+1380
-677
lines changed

.env.template

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
HTTP_PORT=8074
1+
HTTP_PORT=8074 #
2+
HTTP_HOST=0.0.0.0 # Defaults to 0.0.0.0 (listen on all interfaces)
23
GENIUS_ACCESS_TOKEN=abcdef # Gotten from POST https://api.genius.com/oauth/token or from creating a client on https://genius.com/api-clients
4+
AUTH_TOKENS= # Comma-separated list of HTTP bearer tokens that are excluded from rate limiting

README.md

Lines changed: 52 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# geniURL
22

33
Simple JSON and XML REST API to search for song metadata and the lyrics URL on [genius.com](https://genius.com/)
4-
Obtaining actual lyrics sadly isn't possible due to licensing and copyright reasons
4+
Authorization is not required and geniURL implements a fuzzy search that will greatly improve search results over the genius.com API.
5+
6+
Obtaining actual lyrics sadly isn't possible due to licensing and copyright reasons.
57

68
<br><br>
79

@@ -32,26 +34,35 @@ All routes support gzip and deflate compression.
3234

3335
> ### GET `/search`
3436
>
35-
> This endpoint gives you the top 10 results for a search query specified by `search_text`
36-
> The returned data contains various data like the lyrics website URL, song and thumbnail metadata and more (see below).
37+
> This endpoint gives you up to 10 results for a search query specified by `search_text`
38+
> The returned payload contains various data like the lyrics website URL, song and thumbnail metadata and more (see below).
3739
>
3840
> <br>
3941
>
4042
> **URL Parameters:**
4143
> `?q=search%20query`
4244
> This parameter should contain both the song and artist name (for best result artist name should come first, separate with a whitespace).
4345
> Sometimes the song name alone might be enough but the results vary greatly.
44-
> Using this parameter instead of `?artist` and `?song` will not modify the search results and so you will sometimes get blatantly wrong top matches.
46+
> Using this parameter instead of `?artist` and `?song` means you will get slightly less accurate results.
4547
> Make sure the search query is [percent/URL-encoded.](https://en.wikipedia.org/wiki/Percent-encoding)
46-
>
48+
>
49+
> **OR**
50+
>
4751
> `?artist=name` and `?song=name`
48-
> Instead of `?q`, you can use `?artist` and `?song` to tell geniURL to preemptively filter the search results.
49-
> This is done using a fuzzy search to greatly increase the chances the correct search result will be at the top.
52+
> Instead of `?q`, you can use `?artist` and `?song` to help geniURL filter the search results better, so your top results will be more accurate.
5053
> Make sure these parameters are [percent/URL-encoded.](https://en.wikipedia.org/wiki/Percent-encoding)
51-
>
54+
>
55+
> <br>
56+
>
57+
> **Optional URL Parameters:**
5258
> `?format=json/xml`
53-
> Use this parameter to change the response format from the default (`json`) to `xml`
59+
> Use this optional parameter to change the response format from the default (`json`) to `xml`
5460
> The structure of the XML data is similar to the shown JSON data.
61+
>
62+
> `?threshold=0.65`
63+
> This optional parameter can be used to change the fuzzy search threshold from the default of 0.65
64+
> It has to be between 0.0 and 1.0; the lower the number, the less results you'll get but the more accurate the top results will be.
65+
> 0.65 is a good middle ground but depending on your use-case you might want to play around with this.
5566
>
5667
> <br>
5768
>
@@ -64,23 +75,23 @@ All routes support gzip and deflate compression.
6475
> "error": false,
6576
> "matches": 10,
6677
> "top": {
67-
> "url": "https://genius.com/Artist-1-song-name-lyrics",
68-
> "path": "/Artist-1-song-name-lyrics",
78+
> "url": "https://genius.com/Artist-Foo-song-name-lyrics",
79+
> "path": "/Artist-Foo-song-name-lyrics",
6980
> "language": "en",
7081
> "meta": {
7182
> "title": "Song Name",
72-
> "fullTitle": "Song Name by Artist 1 (ft. Artist 2)",
73-
> "artists": "Artist 1 (ft. Artist 2)",
83+
> "fullTitle": "Song Name by Artist Foo (ft. Artist Bar)",
84+
> "artists": "Artist Foo (ft. Artist Bar)",
7485
> "primaryArtist": {
75-
> "name": "Artist 1",
76-
> "url": "https://genius.com/artists/Artist-1",
86+
> "name": "Artist Foo",
87+
> "url": "https://genius.com/artists/Artist-Foo",
7788
> "headerImage": "https://images.genius.com/...",
7889
> "image": "https://images.genius.com/..."
7990
> },
8091
> "featuredArtists": [
8192
> {
82-
> "name": "Featured Artist 1",
83-
> "url": "https://genius.com/artists/Featured-Artist-1",
93+
> "name": "Artist Bar",
94+
> "url": "https://genius.com/artists/Artist-Bar",
8495
> "headerImage": "https://images.genius.com/...",
8596
> "image": "https://images.genius.com/..."
8697
> }
@@ -139,7 +150,7 @@ All routes support gzip and deflate compression.
139150
140151
> ### GET `/search/top`
141152
>
142-
> This endpoint is the same as `/search`, but it only gives the top result.
153+
> This endpoint is similar to `/search`, but it only gives the top result.
143154
> Use this if you are only interested in the top result and want to reduce traffic.
144155
>
145156
> <br>
@@ -148,17 +159,26 @@ All routes support gzip and deflate compression.
148159
> `?q=search%20query`
149160
> This parameter should contain both the song and artist name (for best result artist name should come first, separate with a whitespace).
150161
> Sometimes the song name alone might be enough but the results vary greatly.
151-
> Using this parameter instead of `?artist` and `?song` will not modify the search result and so you will sometimes get a blatantly wrong top match.
162+
> Using this parameter instead of `?artist` and `?song` means you will get slightly less accurate results.
152163
> Make sure the search query is [percent/URL-encoded.](https://en.wikipedia.org/wiki/Percent-encoding)
153-
>
164+
>
165+
> **OR**
166+
>
154167
> `?artist=name` and `?song=name`
155-
> Instead of `?q`, you can use `?artist` and `?song` to tell geniURL to preemptively filter the search results.
156-
> This is done using a fuzzy search to greatly increase the chances the correct search result will be returned.
168+
> Instead of `?q`, you can use `?artist` and `?song` to help geniURL filter the search results better, so your top results will be more accurate.
157169
> Make sure these parameters are [percent/URL-encoded.](https://en.wikipedia.org/wiki/Percent-encoding)
158-
>
170+
>
171+
> <br><br>
172+
>
173+
> **Optional URL Parameters:**
159174
> `?format=json/xml`
160-
> Use this parameter to change the response format from the default (`json`) to `xml`
175+
> Use this optional parameter to change the response format from the default (`json`) to `xml`
161176
> The structure of the XML data is similar to the shown JSON data.
177+
>
178+
> `?threshold=0.65`
179+
> This optional parameter can be used to change the fuzzy search threshold from the default of 0.65
180+
> It has to be between 0.0 and 1.0; the lower the number, the less results you'll get but the more accurate the top results will be.
181+
> 0.65 is a good middle ground but depending on your use-case you might want to play around with this.
162182
>
163183
> <br>
164184
>
@@ -170,23 +190,23 @@ All routes support gzip and deflate compression.
170190
> {
171191
> "error": false,
172192
> "matches": 1,
173-
> "url": "https://genius.com/Artist-1-song-name-lyrics",
174-
> "path": "/Artist-1-song-name-lyrics",
193+
> "url": "https://genius.com/Artist-Foo-song-name-lyrics",
194+
> "path": "/Artist-Foo-song-name-lyrics",
175195
> "language": "en",
176196
> "meta": {
177197
> "title": "Song Name",
178-
> "fullTitle": "Song Name by Artist 1 (ft. Artist 2)",
179-
> "artists": "Artist 1 (ft. Artist 2)",
198+
> "fullTitle": "Song Name by Artist Foo (ft. Artist Bar)",
199+
> "artists": "Artist Foo (ft. Artist Bar)",
180200
> "primaryArtist": {
181-
> "name": "Artist 1",
182-
> "url": "https://genius.com/artists/Artist-1",
201+
> "name": "Artist Foo",
202+
> "url": "https://genius.com/artists/Artist-Foo",
183203
> "headerImage": "https://images.genius.com/...",
184204
> "image": "https://images.genius.com/..."
185205
> },
186206
> "featuredArtists": [
187207
> {
188-
> "name": "Featured Artist 1",
189-
> "url": "https://genius.com/artists/Featured-Artist-1",
208+
> "name": "Artist Bar",
209+
> "url": "https://genius.com/artists/Artist-Bar",
190210
> "headerImage": "https://images.genius.com/...",
191211
> "image": "https://images.genius.com/..."
192212
> }

changelog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
## Version History:
2+
- [**1.2.0**](#v120)
23
- [1.1.1](#v111)
34
- [1.1.0](#v110)
45
- [1.0.0](#v100)
@@ -7,6 +8,12 @@
78

89
<br><br>
910

11+
### v1.2.0
12+
- Added `?threshold` parameter to change the fuzzy search threshold from its default of 0.6 ([#7](https://github.com/Sv443/geniURL/issues/7))
13+
- Added support for fuzzy searching when using `?q` instead of `?artist` and `?song` ([#8](https://github.com/Sv443/geniURL/issues/8))
14+
15+
<br>
16+
1017
### v1.1.1
1118
- Minor fixes
1219

0 commit comments

Comments
 (0)