Skip to content

Commit

Permalink
v1.1.4 update, check changelog file to see what new
Browse files Browse the repository at this point in the history
  • Loading branch information
nikkozu committed May 6, 2021
1 parent 7a6fad7 commit 21d5dd5
Show file tree
Hide file tree
Showing 5 changed files with 191 additions and 9 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@

All notable changes to this project will be documented in this file. This project adheres to [SemVer](https://semver.org/spec/v2.0.0.html).

## [1.1.3] - 2020-01-07
## [1.1.4] - 2021-05-06

### Added
- Fuction to modify the keyword on `lib/nHentai.js`

### Changed
- URL variables on `lib/nHentai.js` to using the new function
- v1.1.3 date on `CHANGELOG.md` file

## [1.1.3] - 2021-01-07

### Changed
- Axios version to `0.21.1`
Expand Down Expand Up @@ -53,6 +62,7 @@ All notable changes to this project will be documented in this file. This projec

- Fixed `num_pages` result in Request API file.

[1.1.4]: https://github.com/masami45/nana-api/compare/v1.1.3...v1.1.4
[1.1.3]: https://github.com/masami45/nana-api/compare/v1.1.2...v1.1.3
[1.1.2]: https://github.com/masami45/nana-api/compare/v1.1.1...v1.1.2
[1.1.1]: https://github.com/masami45/nana-api/compare/v1.1.0...v1.1.1
Expand Down
18 changes: 14 additions & 4 deletions lib/nHentai.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ module.exports = class nHentai {
let query = qs.stringify({
page,
});
let url = `${baseUrl}/tag/${keyword.replace(/ /g, "-")}/${sort}?${query}`;
let url = `${baseUrl}/tag/${modifyKeyword(keyword)}/${sort}?${query}`;

return request.getList(url);
}
Expand All @@ -129,7 +129,7 @@ module.exports = class nHentai {
let query = qs.stringify({
page,
});
let url = `${baseUrl}/artist/${keyword.replace(/ /g, "-")}/${sort}?${query}`;
let url = `${baseUrl}/artist/${modifyKeyword(keyword)}/${sort}?${query}`;

return request.getList(url);
}
Expand All @@ -147,7 +147,7 @@ module.exports = class nHentai {
let query = qs.stringify({
page,
});
let url = `${baseUrl}/character/${keyword.replace(/ /g, "-")}/${sort}?${query}`;
let url = `${baseUrl}/character/${modifyKeyword(keyword)}/${sort}?${query}`;

return request.getList(url);
}
Expand All @@ -165,7 +165,7 @@ module.exports = class nHentai {
let query = qs.stringify({
page,
});
let url = `${baseUrl}/parody/${keyword.replace(/ /g, "-")}${sort}?${query}`;
let url = `${baseUrl}/parody/${modifyKeyword(keyword)}${sort}?${query}`;

return request.getList(url);
}
Expand Down Expand Up @@ -202,3 +202,13 @@ function getSort(sort) {
return sort == "all" || sort == true ? "popular" : `popular-${sort}`;
}

/**
* Modify keyword to replace space and
* convert it to lowercase
*
* @param {string} keyword user keyword
* @return {string} modified keyword
*/
function modifyKeyword(keyword) {
return keyword.replace(/ /g, "-").toLowerCase();
}
166 changes: 164 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nana-api",
"version": "1.1.3",
"version": "1.1.4",
"description": "nhentai unofficial api",
"main": "./index.js",
"typings": "./index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ const nanaApi = require("../index");
let API = new nanaApi();

(async function () {
console.log(await API.g("130335"));
console.log(await API.artist("ShindoL"));
})();

0 comments on commit 21d5dd5

Please sign in to comment.