@vince-gamer/sumire 0.1.0 → 0.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 +79 -19
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +119 -0
- package/dist/index.d.mts +38 -9
- package/dist/index.mjs +1 -1
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
[![npm version][npm-version-src]][npm-version-href]
|
|
8
8
|
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
9
|
-
[![bundle][bundle-src]][bundle-href]
|
|
10
|
-
[![JSDocs][jsdocs-src]][jsdocs-href]
|
|
11
9
|
[![License][license-src]][license-href]
|
|
12
10
|
|
|
13
11
|
## Supported Websites
|
|
@@ -26,6 +24,9 @@ npm i @vince-gamer/sumire
|
|
|
26
24
|
|
|
27
25
|
Here are some of examples:
|
|
28
26
|
|
|
27
|
+
- [Yande.re](#yandere)
|
|
28
|
+
- [Pixiv](#pixiv)
|
|
29
|
+
|
|
29
30
|
### Examples
|
|
30
31
|
|
|
31
32
|
Every main function like `yandere()`, `pixivIllust()` uses sumire config.
|
|
@@ -58,7 +59,7 @@ export interface SumireConfig {
|
|
|
58
59
|
|
|
59
60
|
**Types**:
|
|
60
61
|
```ts
|
|
61
|
-
|
|
62
|
+
interface Params {
|
|
62
63
|
tags?: string // search keywords
|
|
63
64
|
limit?: number // number of pictures per search
|
|
64
65
|
login?: string // don't pass this value, it will be auto filled if config.auth exists.
|
|
@@ -93,22 +94,22 @@ console.log(a)
|
|
|
93
94
|
#### Pixiv
|
|
94
95
|
|
|
95
96
|
> [!IMPORTANT]
|
|
96
|
-
> If you get 404 on request, please login your pixiv account, then add phpSessId
|
|
97
|
+
> If you get 404 on request, please login your pixiv account, then add **phpSessId** from cookie to `config.pixiv`
|
|
98
|
+
|
|
99
|
+
##### Official API
|
|
97
100
|
|
|
98
101
|
**Types**:
|
|
99
102
|
```ts
|
|
100
|
-
|
|
101
|
-
tags?: string
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
password_hash?: string // don't pass this value, it will be auto filled if config.auth exists.
|
|
105
|
-
api_version?: number // api_version, default 2
|
|
103
|
+
interface Params {
|
|
104
|
+
tags?: string
|
|
105
|
+
mode?: string
|
|
106
|
+
limit?: number
|
|
106
107
|
}
|
|
107
108
|
```
|
|
108
109
|
|
|
109
110
|
**Function:**
|
|
110
111
|
```ts
|
|
111
|
-
import { pixivDiscovery, pixivIllust } from '@vince-gamer/sumire'
|
|
112
|
+
import { pixivDiscovery, pixivIllust, pixivUserProfile } from '@vince-gamer/sumire'
|
|
112
113
|
|
|
113
114
|
// Search illusts with tags and mode
|
|
114
115
|
const a = await pixivDiscovery(
|
|
@@ -124,7 +125,7 @@ const a = await pixivDiscovery(
|
|
|
124
125
|
},
|
|
125
126
|
pixiv: {
|
|
126
127
|
mode: 'r18',
|
|
127
|
-
phpSessId: 'xxxx' // pass your phpSessId in cookie if you encounter
|
|
128
|
+
phpSessId: 'xxxx' // pass your phpSessId in cookie if you encounter authentication issue.
|
|
128
129
|
}
|
|
129
130
|
}
|
|
130
131
|
)
|
|
@@ -137,11 +138,73 @@ const b = await pixivIllust('129887775', {
|
|
|
137
138
|
port: 7890
|
|
138
139
|
},
|
|
139
140
|
pixiv: {
|
|
140
|
-
phpSessId: 'xxxx' // pass your phpSessId in cookie if you encounter
|
|
141
|
+
phpSessId: 'xxxx' // pass your phpSessId in cookie if you encounter authentication issue.
|
|
142
|
+
}
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
// get user profile
|
|
146
|
+
const c = await pixivUserProfile('120227846', {
|
|
147
|
+
proxy: {
|
|
148
|
+
protocol: 'http',
|
|
149
|
+
host: '127.0.0.1',
|
|
150
|
+
port: 7890,
|
|
151
|
+
},
|
|
152
|
+
pixiv: {
|
|
153
|
+
phpSessId: 'xxxx' // pass your phpSessId in cookie if you encounter authentication issue.
|
|
141
154
|
}
|
|
142
155
|
})
|
|
143
156
|
|
|
144
|
-
|
|
157
|
+
// get user's following authors, requires authentication
|
|
158
|
+
const d = await pixivFollowingSource({
|
|
159
|
+
userId: '114104704',
|
|
160
|
+
offset: 0,
|
|
161
|
+
limit: 3,
|
|
162
|
+
rest: 'show'
|
|
163
|
+
}, {
|
|
164
|
+
proxy: {
|
|
165
|
+
protocol: 'http',
|
|
166
|
+
host: '127.0.0.1',
|
|
167
|
+
port: 7890,
|
|
168
|
+
},
|
|
169
|
+
pixiv: {
|
|
170
|
+
phpSessId: '114104704_uOsEFSeEc0Bq6fnHafMVUMrLxgh0jABe'
|
|
171
|
+
}
|
|
172
|
+
})
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
##### Third-party API
|
|
176
|
+
|
|
177
|
+
Lolicon API:
|
|
178
|
+
|
|
179
|
+
Types:
|
|
180
|
+
|
|
181
|
+
```ts
|
|
182
|
+
interface LoliconParams {
|
|
183
|
+
r18?: number // 0: not R18, 1: R18, 2: mixed, default 0
|
|
184
|
+
num?: number // result count, range 1 to 20, default 1
|
|
185
|
+
uid?: number[] // returns artwork with specified user id(s), max length is 20
|
|
186
|
+
keyword?: string // search condition, like title, author, tags, etc. Fuzzy matching. Not recommended. Better use tag.
|
|
187
|
+
tag?: string[] | string[][] // returns artwork with specified tags. https://docs.api.lolicon.app/#/setu?id=tag
|
|
188
|
+
size?: string[] // returns specified size of pictures. Options: "original", "regular", "small", "thumb", "mini". Default ["original"]
|
|
189
|
+
proxy?: string // reverse proxy address of i.pximg.net, default i.pixiv.re
|
|
190
|
+
dateAfter?: number // returns artwork which upload time after this value. Timestamp, unit: ms.
|
|
191
|
+
dateBefore?: number // returns artwork which upload time before this value. Timestamp, unit: ms.
|
|
192
|
+
dsc?: boolean // disable auto replacement between keyword(shorthand) and tag, default false. https://docs.api.lolicon.app/#/setu?id=dsc
|
|
193
|
+
excludeAI?: boolean // default false
|
|
194
|
+
aspectRatio?: string // https://docs.api.lolicon.app/#/setu?id=aspectratio
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Function:
|
|
199
|
+
|
|
200
|
+
```ts
|
|
201
|
+
import { lolicon } from '@vince-g/sumire'
|
|
202
|
+
|
|
203
|
+
const aa = await lolicon({
|
|
204
|
+
r18: 1,
|
|
205
|
+
num: 5,
|
|
206
|
+
tag: ['萝莉', '少女'],
|
|
207
|
+
})
|
|
145
208
|
```
|
|
146
209
|
|
|
147
210
|
## License
|
|
@@ -155,8 +218,5 @@ console.log(b)
|
|
|
155
218
|
[npm-downloads-src]: https://img.shields.io/npm/dm/@vince-gamer/sumire?style=flat&colorA=080f12&colorB=1fa669
|
|
156
219
|
[npm-downloads-href]: https://npmjs.com/package/@vince-gamer/sumire
|
|
157
220
|
[bundle-src]: https://img.shields.io/bundlephobia/minzip/@vince-gamer/sumire?style=flat&colorA=080f12&colorB=1fa669&label=minzip
|
|
158
|
-
[
|
|
159
|
-
[license-
|
|
160
|
-
[license-href]: https://github.com/Vincent-the-gamer/@vince-gamer/sumire/blob/main/LICENSE
|
|
161
|
-
[jsdocs-src]: https://img.shields.io/badge/jsdocs-reference-080f12?style=flat&colorA=080f12&colorB=1fa669
|
|
162
|
-
[jsdocs-href]: https://www.jsdocs.io/package/@vince-gamer/sumire
|
|
221
|
+
[license-src]: https://img.shields.io/github/license/Vincent-the-gamer/sumire.svg?style=flat&colorA=080f12&colorB=1fa669
|
|
222
|
+
[license-href]: https://github.com/Vincent-the-gamer/sumire/blob/main/LICENSE
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`axios`);c=s(c);let l=require(`consola`),u=require(`node:crypto`);async function d(e){let{data:t}=await c.default.post(`https://api.lolicon.app/setu/v2`,e,{headers:{"Content-Type":`application/json`}});return t}const f=l.consola.withTag(`sumire`);function p(e){return e[Math.floor(Math.random()*e.length)]}const m=[`Mozilla/5.0 (X11; U; Linux x86_64; zh-CN; rv:1.9.2.10) Gecko/20100922 Ubuntu/10.10 (maverick) Firefox/3.6.10`,`Mozilla/5.0 (Windows NT 6.1; rv,2.0.1) Gecko/20100101 Firefox/4.0.1`,`Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36`,`Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.94 Safari/537.36`,`Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Ubuntu/11.10 Chromium/27.0.1453.93 Chrome/27.0.1453.93 Safari/537.36`];function h(){return p(m)}async function g(e,t){let n=e.tags||``;n&&(e.tags=n),t?.pixiv?.mode&&(e.mode=t.pixiv.mode);try{let{data:n}=await(0,c.default)({url:`https://www.pixiv.net/ajax/illust/discovery`,method:`get`,params:e,proxy:t?.proxy,headers:{"User-Agent":h(),Referer:`https://www.pixiv.net/`,Cookie:t?.pixiv?.phpSessId?`PHPSESSID=${t.pixiv.phpSessId}`:void 0}});return n}catch(e){return f.error(`Fetch Pixiv Discovery metadata failed!${e}`),null}}async function _(e,t){let n=`https://www.pixiv.net/ajax/illust/${e}/pages`;try{let{data:e}=await(0,c.default)({url:n,method:`get`,params:{},proxy:t?.proxy,headers:{"User-Agent":h(),Referer:`https://www.pixiv.net/`,Cookie:t?.pixiv?.phpSessId?`PHPSESSID=${t.pixiv.phpSessId}`:void 0}}),r=e,i=r.body[0].urls;if(t?.pixiv?.mirror)for(let[e,n]of Object.entries(i))i[e]=n.replace(`i.pximg.net`,t.pixiv.mirror);return r.body[0].urls=i,r}catch(e){return f.error(`Connot fetch original picture link: ${e}`),null}}async function v(e,t){let{data:n}=await(0,c.default)({url:`https://www.pixiv.net/ajax/user/${e}/profile/all`,method:`get`,params:{},proxy:t?.proxy,headers:{"User-Agent":h(),Referer:`https://www.pixiv.net/`,Cookie:t?.pixiv?.phpSessId?`PHPSESSID=${t.pixiv.phpSessId}`:void 0}});return n}async function y(e,t){if(!t.pixiv?.phpSessId)return{error:!0,data:Error(`You haven't provide Pixiv PHPSESSID!`)};let{data:n}=await(0,c.default)({url:`https://www.pixiv.net/ajax/user/${e.userId}/following?offset=${e.offset}&limit=${e.limit}&rest=${e.rest}`,method:`get`,params:{},proxy:t?.proxy,headers:{"User-Agent":h(),Referer:`https://www.pixiv.net/`,Cookie:t?.pixiv?.phpSessId?`PHPSESSID=${t.pixiv.phpSessId}`:void 0}});return n}async function b(e,t){if(!t.pixiv?.phpSessId)return{error:!0,data:Error(`You haven't provide Pixiv PHPSESSID!`)};let{data:n}=await(0,c.default)({url:`https://www.pixiv.net/ajax/user/${e.userId}/followers?offset=${e.offset}&limit=${e.limit}`,method:`get`,params:{},proxy:t?.proxy,headers:{"User-Agent":h(),Referer:`https://www.pixiv.net/`,Cookie:t?.pixiv?.phpSessId?`PHPSESSID=${t.pixiv.phpSessId}`:void 0}});return n}function x(e){let t=`choujin-steiner--${e}--`,n=(0,u.createHash)(`sha1`);return n.update(t),n.digest(`hex`)}async function S(e,t){if(e.api_version||=2,t?.yandere){let{auth:n,r18:r}=t.yandere;n&&(e.login=n.username,e.password_hash=x(n.password));let i=e.tags;r?e.tags=`rating:explicit ${i}`:e.tags=`rating:safe ${i}`}let{data:n}=await(0,c.default)({method:`get`,url:`https://yande.re/post.json`,params:e,proxy:t?.proxy});return n}exports.lolicon=d,exports.pixivDiscovery=g,exports.pixivFollowerSource=b,exports.pixivFollowingSource=y,exports.pixivIllust=_,exports.pixivUserProfile=v,exports.yandere=S;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
//#region src/core/lolicon-api.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Lolicon API v2 for Pixiv.net
|
|
4
|
+
*
|
|
5
|
+
* https://docs.api.lolicon.app/
|
|
6
|
+
*/
|
|
7
|
+
interface LoliconParams {
|
|
8
|
+
r18?: number;
|
|
9
|
+
num?: number;
|
|
10
|
+
uid?: number[];
|
|
11
|
+
keyword?: string;
|
|
12
|
+
tag?: string[] | string[][];
|
|
13
|
+
size?: string[];
|
|
14
|
+
proxy?: string;
|
|
15
|
+
dateAfter?: number;
|
|
16
|
+
dateBefore?: number;
|
|
17
|
+
dsc?: boolean;
|
|
18
|
+
excludeAI?: boolean;
|
|
19
|
+
aspectRatio?: string;
|
|
20
|
+
}
|
|
21
|
+
declare function lolicon(params: LoliconParams): Promise<any>;
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/types/pixivTypes.d.ts
|
|
24
|
+
interface PixivIllustResponse {
|
|
25
|
+
error: boolean;
|
|
26
|
+
message: string;
|
|
27
|
+
body: {
|
|
28
|
+
urls: {
|
|
29
|
+
thumb_mini: string;
|
|
30
|
+
small: string;
|
|
31
|
+
regular: string;
|
|
32
|
+
original: string;
|
|
33
|
+
};
|
|
34
|
+
width: number;
|
|
35
|
+
height: number;
|
|
36
|
+
}[];
|
|
37
|
+
}
|
|
38
|
+
interface PixivFollowingResponse {
|
|
39
|
+
error: boolean;
|
|
40
|
+
body: {
|
|
41
|
+
users: {
|
|
42
|
+
userId: string;
|
|
43
|
+
userName: string;
|
|
44
|
+
}[];
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
interface PixivResponse {
|
|
48
|
+
error: boolean;
|
|
49
|
+
message: string;
|
|
50
|
+
body: {
|
|
51
|
+
illusts: {
|
|
52
|
+
id: string;
|
|
53
|
+
title: string;
|
|
54
|
+
url: string;
|
|
55
|
+
tags: string[];
|
|
56
|
+
userId: string;
|
|
57
|
+
userName: string;
|
|
58
|
+
xRestrict: number;
|
|
59
|
+
createDate: string;
|
|
60
|
+
}[];
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
interface PixivFollowingRequest {
|
|
64
|
+
userId?: string;
|
|
65
|
+
offset?: number;
|
|
66
|
+
limit?: number;
|
|
67
|
+
rest?: string;
|
|
68
|
+
}
|
|
69
|
+
interface PixivFollowerRequest {
|
|
70
|
+
userId?: string;
|
|
71
|
+
offset?: number;
|
|
72
|
+
limit?: number;
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/types/index.d.ts
|
|
76
|
+
interface SumireConfig {
|
|
77
|
+
apiDelay?: number;
|
|
78
|
+
proxy?: {
|
|
79
|
+
protocol: string;
|
|
80
|
+
host: string;
|
|
81
|
+
port: number;
|
|
82
|
+
};
|
|
83
|
+
yandere?: {
|
|
84
|
+
auth?: {
|
|
85
|
+
username?: string;
|
|
86
|
+
password?: string;
|
|
87
|
+
};
|
|
88
|
+
r18?: boolean;
|
|
89
|
+
};
|
|
90
|
+
pixiv?: {
|
|
91
|
+
mode?: 'r18' | 'safe' | 'all';
|
|
92
|
+
phpSessId?: string;
|
|
93
|
+
mirror?: string;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region src/core/pixiv.d.ts
|
|
98
|
+
interface Params$1 {
|
|
99
|
+
tags?: string;
|
|
100
|
+
mode?: string;
|
|
101
|
+
limit?: number;
|
|
102
|
+
}
|
|
103
|
+
declare function pixivDiscovery(params: Params$1, config?: SumireConfig): Promise<PixivResponse | null>;
|
|
104
|
+
declare function pixivIllust(artworkId: string, config?: SumireConfig): Promise<Record<string, any> | null>;
|
|
105
|
+
declare function pixivUserProfile(userId: string, config?: SumireConfig): Promise<Record<string, any>>;
|
|
106
|
+
declare function pixivFollowingSource(params: Partial<PixivFollowingRequest>, config: SumireConfig): Promise<any>;
|
|
107
|
+
declare function pixivFollowerSource(params: Partial<PixivFollowerRequest>, config: SumireConfig): Promise<any>;
|
|
108
|
+
//#endregion
|
|
109
|
+
//#region src/core/yandere.d.ts
|
|
110
|
+
interface Params {
|
|
111
|
+
tags?: string;
|
|
112
|
+
limit?: number;
|
|
113
|
+
login?: string;
|
|
114
|
+
password_hash?: string;
|
|
115
|
+
api_version?: number;
|
|
116
|
+
}
|
|
117
|
+
declare function yandere(params: Partial<Params>, config?: SumireConfig): Promise<Record<string, any>>;
|
|
118
|
+
//#endregion
|
|
119
|
+
export { PixivFollowerRequest, PixivFollowingRequest, PixivFollowingResponse, PixivIllustResponse, PixivResponse, SumireConfig, lolicon, pixivDiscovery, pixivFollowerSource, pixivFollowingSource, pixivIllust, pixivUserProfile, yandere };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
//#region src/core/lolicon-api.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Lolicon API v2 for Pixiv.net
|
|
4
|
+
*
|
|
5
|
+
* https://docs.api.lolicon.app/
|
|
6
|
+
*/
|
|
7
|
+
interface LoliconParams {
|
|
8
|
+
r18?: number;
|
|
9
|
+
num?: number;
|
|
10
|
+
uid?: number[];
|
|
11
|
+
keyword?: string;
|
|
12
|
+
tag?: string[] | string[][];
|
|
13
|
+
size?: string[];
|
|
14
|
+
proxy?: string;
|
|
15
|
+
dateAfter?: number;
|
|
16
|
+
dateBefore?: number;
|
|
17
|
+
dsc?: boolean;
|
|
18
|
+
excludeAI?: boolean;
|
|
19
|
+
aspectRatio?: string;
|
|
20
|
+
}
|
|
21
|
+
declare function lolicon(params: LoliconParams): Promise<any>;
|
|
22
|
+
//#endregion
|
|
1
23
|
//#region src/types/pixivTypes.d.ts
|
|
2
24
|
interface PixivIllustResponse {
|
|
3
25
|
error: boolean;
|
|
@@ -22,14 +44,6 @@ interface PixivFollowingResponse {
|
|
|
22
44
|
}[];
|
|
23
45
|
};
|
|
24
46
|
}
|
|
25
|
-
interface PixivUserProfileResponse {
|
|
26
|
-
error: boolean;
|
|
27
|
-
body: {
|
|
28
|
-
illusts: {
|
|
29
|
-
[key: string]: any;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
47
|
interface PixivResponse {
|
|
34
48
|
error: boolean;
|
|
35
49
|
message: string;
|
|
@@ -46,9 +60,21 @@ interface PixivResponse {
|
|
|
46
60
|
}[];
|
|
47
61
|
};
|
|
48
62
|
}
|
|
63
|
+
interface PixivFollowingRequest {
|
|
64
|
+
userId?: string;
|
|
65
|
+
offset?: number;
|
|
66
|
+
limit?: number;
|
|
67
|
+
rest?: string;
|
|
68
|
+
}
|
|
69
|
+
interface PixivFollowerRequest {
|
|
70
|
+
userId?: string;
|
|
71
|
+
offset?: number;
|
|
72
|
+
limit?: number;
|
|
73
|
+
}
|
|
49
74
|
//#endregion
|
|
50
75
|
//#region src/types/index.d.ts
|
|
51
76
|
interface SumireConfig {
|
|
77
|
+
apiDelay?: number;
|
|
52
78
|
proxy?: {
|
|
53
79
|
protocol: string;
|
|
54
80
|
host: string;
|
|
@@ -76,6 +102,9 @@ interface Params$1 {
|
|
|
76
102
|
}
|
|
77
103
|
declare function pixivDiscovery(params: Params$1, config?: SumireConfig): Promise<PixivResponse | null>;
|
|
78
104
|
declare function pixivIllust(artworkId: string, config?: SumireConfig): Promise<Record<string, any> | null>;
|
|
105
|
+
declare function pixivUserProfile(userId: string, config?: SumireConfig): Promise<Record<string, any>>;
|
|
106
|
+
declare function pixivFollowingSource(params: Partial<PixivFollowingRequest>, config: SumireConfig): Promise<any>;
|
|
107
|
+
declare function pixivFollowerSource(params: Partial<PixivFollowerRequest>, config: SumireConfig): Promise<any>;
|
|
79
108
|
//#endregion
|
|
80
109
|
//#region src/core/yandere.d.ts
|
|
81
110
|
interface Params {
|
|
@@ -87,4 +116,4 @@ interface Params {
|
|
|
87
116
|
}
|
|
88
117
|
declare function yandere(params: Partial<Params>, config?: SumireConfig): Promise<Record<string, any>>;
|
|
89
118
|
//#endregion
|
|
90
|
-
export {
|
|
119
|
+
export { PixivFollowerRequest, PixivFollowingRequest, PixivFollowingResponse, PixivIllustResponse, PixivResponse, SumireConfig, lolicon, pixivDiscovery, pixivFollowerSource, pixivFollowingSource, pixivIllust, pixivUserProfile, yandere };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"axios";import{consola as t}from"consola";import{createHash as n}from"node:crypto";
|
|
1
|
+
import e from"axios";import{consola as t}from"consola";import{createHash as n}from"node:crypto";async function r(t){let{data:n}=await e.post(`https://api.lolicon.app/setu/v2`,t,{headers:{"Content-Type":`application/json`}});return n}const i=t.withTag(`sumire`);function a(e){return e[Math.floor(Math.random()*e.length)]}const o=[`Mozilla/5.0 (X11; U; Linux x86_64; zh-CN; rv:1.9.2.10) Gecko/20100922 Ubuntu/10.10 (maverick) Firefox/3.6.10`,`Mozilla/5.0 (Windows NT 6.1; rv,2.0.1) Gecko/20100101 Firefox/4.0.1`,`Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36`,`Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.94 Safari/537.36`,`Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Ubuntu/11.10 Chromium/27.0.1453.93 Chrome/27.0.1453.93 Safari/537.36`];function s(){return a(o)}async function c(t,n){let r=t.tags||``;r&&(t.tags=r),n?.pixiv?.mode&&(t.mode=n.pixiv.mode);try{let{data:r}=await e({url:`https://www.pixiv.net/ajax/illust/discovery`,method:`get`,params:t,proxy:n?.proxy,headers:{"User-Agent":s(),Referer:`https://www.pixiv.net/`,Cookie:n?.pixiv?.phpSessId?`PHPSESSID=${n.pixiv.phpSessId}`:void 0}});return r}catch(e){return i.error(`Fetch Pixiv Discovery metadata failed!${e}`),null}}async function l(t,n){let r=`https://www.pixiv.net/ajax/illust/${t}/pages`;try{let{data:t}=await e({url:r,method:`get`,params:{},proxy:n?.proxy,headers:{"User-Agent":s(),Referer:`https://www.pixiv.net/`,Cookie:n?.pixiv?.phpSessId?`PHPSESSID=${n.pixiv.phpSessId}`:void 0}}),i=t,a=i.body[0].urls;if(n?.pixiv?.mirror)for(let[e,t]of Object.entries(a))a[e]=t.replace(`i.pximg.net`,n.pixiv.mirror);return i.body[0].urls=a,i}catch(e){return i.error(`Connot fetch original picture link: ${e}`),null}}async function u(t,n){let{data:r}=await e({url:`https://www.pixiv.net/ajax/user/${t}/profile/all`,method:`get`,params:{},proxy:n?.proxy,headers:{"User-Agent":s(),Referer:`https://www.pixiv.net/`,Cookie:n?.pixiv?.phpSessId?`PHPSESSID=${n.pixiv.phpSessId}`:void 0}});return r}async function d(t,n){if(!n.pixiv?.phpSessId)return{error:!0,data:Error(`You haven't provide Pixiv PHPSESSID!`)};let{data:r}=await e({url:`https://www.pixiv.net/ajax/user/${t.userId}/following?offset=${t.offset}&limit=${t.limit}&rest=${t.rest}`,method:`get`,params:{},proxy:n?.proxy,headers:{"User-Agent":s(),Referer:`https://www.pixiv.net/`,Cookie:n?.pixiv?.phpSessId?`PHPSESSID=${n.pixiv.phpSessId}`:void 0}});return r}async function f(t,n){if(!n.pixiv?.phpSessId)return{error:!0,data:Error(`You haven't provide Pixiv PHPSESSID!`)};let{data:r}=await e({url:`https://www.pixiv.net/ajax/user/${t.userId}/followers?offset=${t.offset}&limit=${t.limit}`,method:`get`,params:{},proxy:n?.proxy,headers:{"User-Agent":s(),Referer:`https://www.pixiv.net/`,Cookie:n?.pixiv?.phpSessId?`PHPSESSID=${n.pixiv.phpSessId}`:void 0}});return r}function p(e){let t=`choujin-steiner--${e}--`,r=n(`sha1`);return r.update(t),r.digest(`hex`)}async function m(t,n){if(t.api_version||=2,n?.yandere){let{auth:e,r18:r}=n.yandere;e&&(t.login=e.username,t.password_hash=p(e.password));let i=t.tags;r?t.tags=`rating:explicit ${i}`:t.tags=`rating:safe ${i}`}let{data:r}=await e({method:`get`,url:`https://yande.re/post.json`,params:t,proxy:n?.proxy});return r}export{r as lolicon,c as pixivDiscovery,f as pixivFollowerSource,d as pixivFollowingSource,l as pixivIllust,u as pixivUserProfile,m as yandere};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vince-gamer/sumire",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.1",
|
|
5
5
|
"description": "Picture sources collection.",
|
|
6
6
|
"author": "Vincent-the-gamer",
|
|
7
7
|
"license": "MIT",
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
"typesVersions": {
|
|
32
32
|
"*": {
|
|
33
33
|
".": [
|
|
34
|
-
"./dist/index.d.mts"
|
|
34
|
+
"./dist/index.d.mts",
|
|
35
|
+
"./dist/index.d.cts"
|
|
35
36
|
]
|
|
36
37
|
}
|
|
37
38
|
},
|
|
@@ -48,13 +49,13 @@
|
|
|
48
49
|
"@types/node": "^24.10.1",
|
|
49
50
|
"eslint": "^9.39.1",
|
|
50
51
|
"taze": "^19.9.0",
|
|
51
|
-
"tsdown": "^0.16.
|
|
52
|
+
"tsdown": "^0.16.7",
|
|
52
53
|
"tsx": "^4.20.6",
|
|
53
54
|
"typescript": "^5.9.3",
|
|
54
|
-
"vitest": "^4.0.
|
|
55
|
+
"vitest": "^4.0.14"
|
|
55
56
|
},
|
|
56
57
|
"scripts": {
|
|
57
|
-
"
|
|
58
|
+
"tsx": "tsx",
|
|
58
59
|
"build": "tsdown",
|
|
59
60
|
"test": "vitest",
|
|
60
61
|
"dep": "taze major -I",
|