Skip to content

Commit

Permalink
refactor: refactoring the code
Browse files Browse the repository at this point in the history
  • Loading branch information
iseizuu committed Sep 29, 2024
1 parent 1e420ce commit 6f3fff7
Show file tree
Hide file tree
Showing 46 changed files with 579 additions and 535 deletions.
37 changes: 0 additions & 37 deletions .eslintrc.json

This file was deleted.

5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ bin-release/
# information for Eclipse / Flash Builder.
node_modules
.npmignore
.eslintrc.json
yarn.lock
es.json
CNAME
yarn.lock
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@

Get Anime wallpapers based on scrapping from websites.

| Website | Type | Status |
|---------|------|-----------|
| [4K Wallpapers](https://free4kwallpapers.com/) | Image | |
| [Wall Haven](https://wallhaven.cc) | Image ||
| [ZeroChan](https://www.zerochan.net) | Image ||
| [Wallpapers.com](https://wallpapers.com) | Image ||
| [Hoyolab](https://www.hoyolab.com/) | Image ||
| [Pinterest](https://pinterest.com/) | Image ||
| [Moe Walls](https://moewalls.com) | Video/Image ||
| Website | Type | Status |
| ---------------------------------------- | ----------- | ------ |
| [Hqdwalls](https://hdqwalls.com) [NEW] | Image | |
| [Wall Haven](https://wallhaven.cc) | Image | |
| [ZeroChan](https://www.zerochan.net) | Image | |
| [Wallpapers.com](https://wallpapers.com) | Image | |
| [Hoyolab](https://www.hoyolab.com/) | Image | |
| [Pinterest](https://pinterest.com/) | Image | |
| [Moe Walls](https://moewalls.com) [NEW] | Video/Image | |

<br>

Expand All @@ -45,10 +45,10 @@ const { AnimeWallpaper, AnimeSource } = require('anime-wallpaper');
const wallpaper = new AnimeWallpaper();
```

- ~~Getting a random wallpaper from [4K Wallpapers](https://free4kwallpapers.com/)~~
- Getting a random wallpaper from [Hqdwalls](https://hdqwalls.com) <img align="center" width="15" src="https://cdn.discordapp.com/emojis/735119429016485920.webp?size=128&quality=lossless">

```js
const wallpaper = await wallpaper.random();
const wallpaper = await wallpaper.random({ resolution: "1920x1080" });
return console.log(wallpaper)
```

Expand Down
4 changes: 2 additions & 2 deletions dist/hoyo.d.ts → dist/classes/hoyo.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { hoyoResult, hoyolab } from "./typing";
import { hoyolabResult, hoyolabSearchQuery } from "../typing";
export default class Hoyolab {
private client;
constructor();
Expand All @@ -8,5 +8,5 @@ export default class Hoyolab {
* @returns {Promise<hoyoResult>} - A Promise that resolves to the hoyoResult object containing the post data.
* @throws {AnimeWallError} - If result is empty or error.
*/
getHoyoArt(options: hoyolab): Promise<hoyoResult>;
getHoyoArt(options: hoyolabSearchQuery): Promise<hoyolabResult>;
}
18 changes: 9 additions & 9 deletions dist/hoyo.js → dist/classes/hoyo.js

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

31 changes: 16 additions & 15 deletions dist/wallpaper.d.ts → dist/classes/wallpaper.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AnimeSource, dataImageFormat, hoyoResult, hoyolab, live2D, searchForWallhaven, searchOpt } from "./typing";
import { AnimeSource, dataImageFormat, hoyolabResult, hoyolabSearchQuery, live2D, resolutionList, searchForWallhaven, searchOptions } from "../typing";
export declare class AnimeWallpaper {
private client;
constructor();
Expand All @@ -7,11 +7,11 @@ export declare class AnimeWallpaper {
*
* this function will return an array of queried anime wallpapers
*
* @param {searchOpt | searchForWallhaven} options - The search options.
* @param {searchOptions | searchForWallhaven} options - The search options.
* @param {AnimeSource} [source=AnimeSource.WallHaven] - The source to search from.
* @returns {Promise<dataImageFormat[]>}
*/
search(options: searchOpt | searchForWallhaven, source?: AnimeSource): Promise<dataImageFormat[]>;
search(options: searchOptions | searchForWallhaven, source?: AnimeSource): Promise<dataImageFormat[]>;
/**
* Scrapes live2D images from moewalls.
*
Expand All @@ -21,21 +21,21 @@ export declare class AnimeWallpaper {
*/
live2d(title: string): Promise<live2D[]>;
/**
* @deprecated
* Scrapes 4kWallpaper for a random Wallpaper
*
* This function will return an array of random Wallpapers
*
* @returns {dataImageFormat}
* @param {resolutionList} [resolution] - The resolution to use for scrapping.
* @returns {Promise<dataImageFormat[]>}
*/
random(): Promise<dataImageFormat[]>;
random(resolution?: resolutionList): Promise<dataImageFormat[]>;
/**
* Retrieves fanart from the Hoyolab.
*
* @param {hoyolab} params - Parameters for the Hoyolab request.
* @returns {Promise<hoyoResult>} - A promise that resolves to the result of the request.
* @param {hoyolabSearchQuery} params - Parameters for the Hoyolab request.
* @returns {Promise<hoyolabResult>} - A promise that resolves to the result of the request.
*/
hoyolab(params: hoyolab): Promise<hoyoResult>;
hoyolab(params: hoyolabSearchQuery): Promise<hoyolabResult>;
/**
* Retrieves images from Pinterest based on a search query.
*
Expand All @@ -44,12 +44,6 @@ export declare class AnimeWallpaper {
* @throws {WallError} - If the search query is empty or no images are found.
*/
pinterest(query: string): Promise<dataImageFormat[]>;
/**
* Scrapes a random anime wallpaper from free4kWallpaper.
*
* @returns {Promise<dataImageFormat[]>} An array of dataImageFormat objects.
*/
private scrapeRandomWallpaper;
/**
* Scraping images wallpaper from Wallpapers.com
*
Expand Down Expand Up @@ -82,5 +76,12 @@ export declare class AnimeWallpaper {
* @throws {WallError} - If the search query is empty or no images are found.
*/
private scrapeFromMoewall;
/**
* Scrapes images from hdqwalls.com
* @param resolution Resolutions of image that you want to search.
* @returns {Promise<dataImageFormat[]>} A promise that resolves to an array of dataImageFormat objects containing information about the retrieved images.
* @throws {WallError} - If the search query is empty or no images are found.
*/
private scrapeHdqWallpaper;
}
export { AnimeSource };
Loading

0 comments on commit 6f3fff7

Please sign in to comment.