New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@book000/pixivts

Package Overview
Dependencies
Maintainers
1
Versions
890
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@book000/pixivts - npm Package Compare versions

Comparing version 0.2.2 to 0.3.0

162

dist/options.d.ts

@@ -0,68 +1,230 @@

/** 検索対象 */
export type SearchTargets = 'partial_match_for_tags' | 'exact_match_for_tags' | 'title_and_caption' | 'keyword';
/** ソート */
export type SearchSorts = 'date_desc' | 'date_asc' | 'popular_desc';
/** 対象期間 */
export type SearchIllustDurations = 'within_last_day' | 'within_last_week' | 'within_last_month';
/** OSフィルタ */
export type Filters = 'for_ios' | 'for_android';
/** コンテンツタイプ */
export type ContentType = 'illust' | 'manga';
/** 公開範囲 */
export type BookmarkRestrict = 'public' | 'private';
/**
* イラスト検索オプション
*/
export interface SearchIllustOptions {
/**
* 検索ワード
*/
word: string;
/**
* 検索対象
*/
searchTarget?: SearchTargets;
/**
* ソート順
*/
sort?: SearchSorts;
/**
* 対象期間
*/
duration?: SearchIllustDurations;
/**
* 開始日時
*/
startDate?: string;
/**
* 終了日時
*/
endDate?: string;
/**
* OSフィルタ
*/
filter?: Filters;
/**
* オフセット
*/
offset?: number;
}
/**
* イラスト詳細取得オプション
*/
export interface GetIllustDetailOptions {
/**
* イラストID
*/
illustId: number;
}
/**
* おすすめイラスト取得オプション
*/
export interface RecommendedIllustOptions {
/**
* コンテンツタイプ (illust or manga)
*/
contentType: ContentType;
/**
* ランキングラベルを含めるか
*/
includeRankingLabel?: boolean;
/**
* OSフィルタ
*/
filter?: Filters;
/**
* おすすめイラストの最大ブックマークID (?)
*/
maxBookmarkIdForRecommend?: number;
/**
* 最近のイラストの最小ブックマークID (?)
*/
minBookmarkIdForRecentIllust?: number;
/**
* オフセット
*/
offset?: number;
/**
* ランキングイラストを含めるか (?)
*/
includeRankingIllusts?: boolean;
/**
* ブックマーク済みのイラストID
*/
bookmarkIllustIds?: number[];
/**
* プライバシーポリシーを含めるか (?)
*/
includePrivacyPolicy?: boolean;
}
/**
* イラストブックマーク追加オプション
*/
export interface IllustBookmarkAddOptions {
/**
* イラストID
*/
illustId: number;
/**
* 公開範囲
*/
restrict?: BookmarkRestrict;
/**
* タグ
*/
tags?: string[];
}
/**
* 小説詳細取得オプション
*/
export interface GetNovelDetailOptions {
/**
* 小説ID
*/
novelId: number;
}
/**
* 小説検索オプション
*/
export interface SearchNovelOptions {
/**
* 検索ワード
*/
word: string;
/**
* 検索対象
*/
searchTarget?: SearchTargets;
/**
* ソート順
*/
sort?: SearchSorts;
/**
* プレーンキーワード検索結果をマージするか (?)
*/
mergePlainKeywordResults?: boolean;
/**
* 翻訳タグ検索結果を含むか
*/
includeTranslatedTagResults?: boolean;
/**
* 開始日時
*/
startDate?: string;
/**
* 終了日時
*/
endDate?: string;
/**
* OSフィルタ
*/
filter?: Filters;
/**
* オフセット
*/
offset?: number;
}
/**
* おすすめ小説取得オプション
*/
export interface RecommendedNovelOptions {
/**
* ランキングラベルを含めるか
*/
includeRankingLabel?: boolean;
/**
* OSフィルタ
*/
filter?: Filters;
/**
* オフセット
*/
offset?: number;
/**
* ランキング小説を含めるか (?)
*/
includeRankingNovels?: boolean;
/**
* おすすめ済みの小説ID
*/
alreadyRecommended?: number[];
/**
* おすすめ小説の最大ブックマークID (?)
*/
maxBookmarkIdForRecommend?: number;
/**
* プライバシーポリシーを含めるか (?)
*/
includePrivacyPolicy?: boolean;
}
/**
* 小説シリーズ詳細取得オプション
*/
export interface GetNovelSeriesOptions {
/**
* 小説シリーズID
*/
seriesId: number;
/**
* OSフィルタ
*/
filter?: Filters;
/**
* (?)
*/
lastOrder?: string;
}
/**
* ユーザー詳細取得オプション
*/
export interface GetUserDetailOptions {
/**
* ユーザーID
*/
userId: number;
/**
* OSフィルタ
*/
filter?: Filters;
}
//# sourceMappingURL=options.d.ts.map

@@ -14,2 +14,5 @@ /// <reference types="node" />

import { GetUserDetailApiResponse } from './types/endpoints/user/detail';
/**
* pixiv API
*/
export default class Pixiv {

@@ -24,18 +27,103 @@ private static clientId;

readonly axios: AxiosInstance;
/**
* コンストラクタ。外部からインスタンス化できないので、of メソッドを使うこと。
*
* @param userId ユーザー ID
* @param accessToken アクセストークン
* @param refreshToken リフレッシュトークン
*/
private constructor();
/**
* リフレッシュトークンからインスタンスを生成する。
*
* @param refreshToken リフレッシュトークン
* @returns Pixiv インスタンス
*/
static of(refreshToken: string): Promise<Pixiv>;
static getAxiosImageStream(url: string): Promise<AxiosResponse<ReadStream, any>>;
/**
* イラストの詳細情報を取得する。
*
* @param options オプション
* @returns レスポンス
*/
getIllustDetail(options: GetIllustDetailOptions): Promise<AxiosResponse<GetIllustDetailApiResponse, any>>;
/**
* イラストを検索する。
*
* @param options オプション
* @returns レスポンス
*/
searchIllust(options: SearchIllustOptions): Promise<AxiosResponse<SearchIllustApiResponse, any>>;
/**
* おすすめイラストを取得する。
*
* @param options オプション
* @returns レスポンス
*/
recommendedIllust(options: RecommendedIllustOptions): Promise<AxiosResponse<RecommendedIllustApiResponse, any>>;
/**
* イラストをブックマークする。
*
* @param options オプション
* @returns レスポンス
*/
illustBookmarkAdd(options: IllustBookmarkAddOptions): Promise<AxiosResponse<IllustBookmarkAddApiResponse, any>>;
/**
* 小説の詳細情報を取得する。
*
* @param options オプション
* @returns レスポンス
*/
getNovelDetail(options: GetNovelDetailOptions): Promise<AxiosResponse<GetNovelDetailApiResponse, any>>;
/**
* 小説を検索する。
*
* @param options オプション
* @returns レスポンス
*/
searchNovel(options: SearchNovelOptions): Promise<AxiosResponse<SearchNovelApiResponse, any>>;
/**
* おすすめ小説を取得する。
*
* @param options オプション
* @returns レスポンス
*/
recommendedNovel(options?: RecommendedNovelOptions): Promise<AxiosResponse<RecommendedNovelApiResponse, any>>;
/**
* 小説シリーズの詳細情報を取得する。
*
* @param options オプション
* @returns レスポンス
*/
getNovelSeries(options: GetNovelSeriesOptions): Promise<AxiosResponse<import(".").PixivNovelSeriesItem, any>>;
/**
* ユーザーの詳細情報を取得する。
*
* @param options オプション
* @returns レスポンス
*/
getUserDetail(options: GetUserDetailOptions): Promise<AxiosResponse<GetUserDetailApiResponse, any>>;
/**
* クエリストリングをパースする。
*
* @param url URL
* @returns パースしたクエリストリングオブジェクト
*/
static parseQueryString(url: string): qs.ParsedQs;
/**
* MD5ハッシュを生成する。
*
* @param str 文字列
* @returns ハッシュ
*/
private static hash;
/**
* リクエストを送信する。
*
* @param options オプション
* @returns レスポンス
*/
private request;
}
//# sourceMappingURL=pixiv.d.ts.map

@@ -9,3 +9,13 @@ "use strict";

const qs_1 = __importDefault(require("qs"));
/**
* pixiv API
*/
class Pixiv {
/**
* コンストラクタ。外部からインスタンス化できないので、of メソッドを使うこと。
*
* @param userId ユーザー ID
* @param accessToken アクセストークン
* @param refreshToken リフレッシュトークン
*/
constructor(userId, accessToken, refreshToken) {

@@ -28,3 +38,11 @@ this.hosts = 'https://app-api.pixiv.net';

}
/**
* リフレッシュトークンからインスタンスを生成する。
*
* @param refreshToken リフレッシュトークン
* @returns Pixiv インスタンス
*/
static async of(refreshToken) {
// @see https://github.com/upbit/pixivpy/blob/master/pixivpy3/api.py#L120
// UTCで YYYY-MM-DDTHH:mm:ss+00:00 の形式で現在時刻を取得
const localTime = new Date().toISOString().replace(/Z$/, '+00:00');

@@ -70,2 +88,8 @@ const headers = {

}
/**
* イラストの詳細情報を取得する。
*
* @param options オプション
* @returns レスポンス
*/
async getIllustDetail(options) {

@@ -81,2 +105,8 @@ const parameters = {

}
/**
* イラストを検索する。
*
* @param options オプション
* @returns レスポンス
*/
async searchIllust(options) {

@@ -99,2 +129,8 @@ const parameters = {

}
/**
* おすすめイラストを取得する。
*
* @param options オプション
* @returns レスポンス
*/
async recommendedIllust(options) {

@@ -120,2 +156,8 @@ const parameters = {

}
/**
* イラストをブックマークする。
*
* @param options オプション
* @returns レスポンス
*/
async illustBookmarkAdd(options) {

@@ -133,2 +175,8 @@ const data = {

}
/**
* 小説の詳細情報を取得する。
*
* @param options オプション
* @returns レスポンス
*/
async getNovelDetail(options) {

@@ -144,2 +192,8 @@ const parameters = {

}
/**
* 小説を検索する。
*
* @param options オプション
* @returns レスポンス
*/
async searchNovel(options) {

@@ -163,2 +217,8 @@ const parameters = {

}
/**
* おすすめ小説を取得する。
*
* @param options オプション
* @returns レスポンス
*/
async recommendedNovel(options = {}) {

@@ -182,2 +242,8 @@ const parameters = {

}
/**
* 小説シリーズの詳細情報を取得する。
*
* @param options オプション
* @returns レスポンス
*/
async getNovelSeries(options) {

@@ -195,2 +261,8 @@ const parameters = {

}
/**
* ユーザーの詳細情報を取得する。
*
* @param options オプション
* @returns レスポンス
*/
async getUserDetail(options) {

@@ -207,2 +279,8 @@ const parameters = {

}
/**
* クエリストリングをパースする。
*
* @param url URL
* @returns パースしたクエリストリングオブジェクト
*/
static parseQueryString(url) {

@@ -215,2 +293,8 @@ let query = url;

}
/**
* MD5ハッシュを生成する。
*
* @param str 文字列
* @returns ハッシュ
*/
static hash(string_) {

@@ -220,2 +304,8 @@ const hash = node_crypto_1.default.createHash('md5');

}
/**
* リクエストを送信する。
*
* @param options オプション
* @returns レスポンス
*/
request(options) {

@@ -222,0 +312,0 @@ if (options.method === 'GET') {

3

dist/types/endpoints/illust/bookmark/add.d.ts

@@ -0,2 +1,5 @@

/**
* POST /v2/illust/bookmark/add のレスポンス
*/
export type IllustBookmarkAddApiResponse = Record<string, never>;
//# sourceMappingURL=add.d.ts.map
import { PixivIllustItem } from '../../pixiv-illust';
/**
* POST /v1/illust/detail のレスポンス
*/
export interface GetIllustDetailApiResponse {

@@ -3,0 +6,0 @@ illust: PixivIllustItem;

import { PixivIllustItem } from '../../pixiv-illust';
/**
* GET /v1/illust/recommended のレスポンス
*/
export interface RecommendedIllustApiResponse {

@@ -3,0 +6,0 @@ illusts: PixivIllustItem[];

import { PixivNovelItem } from '../../pixiv-novel';
/**
* GET /v2/novel/detail のレスポンス
*/
export interface GetNovelDetailApiResponse {

@@ -3,0 +6,0 @@ novel: PixivNovelItem;

import { PixivNovelItem } from '../../pixiv-novel';
/**
* GET /v1/novel/recommended のレスポンス
*/
export interface RecommendedNovelApiResponse {

@@ -3,0 +6,0 @@ novels: PixivNovelItem[];

import { PixivNovelSeriesItem } from '../../pixiv-novel-series';
/**
* GET /v2/novel/series のレスポンス
*/
export type GetNovelSeriesApiResponse = PixivNovelSeriesItem;
//# sourceMappingURL=series.d.ts.map
import { PixivIllustItem } from '../../pixiv-illust';
/**
* GET /v1/search/illust のレスポンス
*/
export interface SearchIllustApiResponse {

@@ -3,0 +6,0 @@ illusts: PixivIllustItem[];

import { PixivNovelItem } from '../../pixiv-novel';
/**
* GET /v1/search/novel のレスポンス
*/
export interface SearchNovelApiResponse {

@@ -3,0 +6,0 @@ novels: PixivNovelItem[];

import { PixivUserItem, PixivUserProfile, PixivUserProfilePublicity, PixivUserProfileWorkspace } from '../../pixiv-user';
/**
* GET /v1/user/detail のレスポンス
*/
export interface GetUserDetailApiResponse {

@@ -3,0 +6,0 @@ user: PixivUserItem;

@@ -0,27 +1,66 @@

/**
* 作品の画像URL群
*
* 単一画像の場合、オリジナル画像へは MetaSinglePage.original_image_url から取得
*
* 画像へのアクセスは適切なリファラを付与する必要がある
*/
export interface ImageUrls {
/** 360x360 */
square_medium: string;
/** 長辺が最大 540px */
medium: string;
/** 横幅が最大 600px, 縦幅が最大 1200px */
large: string;
/**
* オリジナル画像
*
* MetaPages.image_urls の場合のみ存在?
*/
original?: string;
}
/**
* プロフィール画像URL群
*/
export interface ProfileImageUrls {
/** 中サイズ */
medium: string;
}
/**
* ユーザー情報
*/
export interface PixivUser {
/** ユーザー内部 ID */
id: number;
/** ユーザー名 */
name: string;
/** pixiv ID (URLに使用) */
account: string;
/** プロフィール画像URL群 */
profile_image_urls: ProfileImageUrls;
/** フォローしているかどうか */
is_followed: boolean;
/** アクセスをブロックしているユーザーであるか */
is_access_blocking_user: boolean;
}
/**
* タグ情報
*/
export interface Tag {
/** タグ名 */
name: string;
/** 翻訳済みタグ名 */
translated_name: null | string;
/** 投稿者によって追加されたタグかどうか */
added_by_uploaded_user?: boolean;
}
/**
* シリーズ情報
*/
export interface Series {
/** シリーズ ID */
id: number;
/** シリーズ名 */
title: string;
}
//# sourceMappingURL=pixiv-common.d.ts.map
import { ImageUrls, PixivUser, Tag, Series } from './pixiv-common';
/** 単一イラスト詳細情報 */
export interface MetaSinglePage {
/** オリジナル画像URL */
original_image_url: string;
}
/** 複数イラスト詳細情報 */
export interface MetaPages {
/** 画像URL群 */
image_urls: Required<ImageUrls>;
}
/**
* pixiv イラストアイテム
*/
export interface PixivIllustItem {
/**
* 作品 ID
*
* イラスト・小説それぞれでIDの振り方が異なり、重複するので注意。
*/
id: number;
/**
* 作品タイトル
*/
title: string;
/**
* 作品種別
*
* illust: イラスト
* manga: マンガ
*/
type: string;
/**
* 作品の画像URL群
*
* イラスト・マンガの場合は1枚目の画像が入っている。
* 2枚目以降の画像は `meta_pages` に入っている。
*/
image_urls: ImageUrls;
/**
* キャプション(説明文)
*/
caption: string;
/**
* 公開範囲
*
* 詳細不明。0 が公開なのは確定
*/
restrict: number;
/**
* 作品投稿者情報
*/
user: PixivUser;
/**
* 作品タグ
*/
tags: Tag[];
/**
* 使用ツール
*
* SAI, CLIP STUDIO PAINT など。投稿者は最大3つまで登録できる。選択式。
*/
tools: string[];
/**
* 投稿日時
*
* ISO 8601 形式。YYYY-MM-DD'T'HH:mm:ss+09:00
*/
create_date: string;
/**
* ページ数
*/
page_count: number;
/** 画像の横幅 */
width: number;
/** 画像の縦幅 */
height: number;
/**
* 正気度? (表現内容設定?)
*
* 詳細不明。2, 4, 6 をとりうる。2 は全年齢、6 は R-18?
*/
sanity_level: number;
/**
* 年齢制限
*
* 0 が全年齢、1 が R-18、2 が R-18G
*/
x_restrict: number;
/**
* シリーズ情報
*
* イラスト・マンガの場合、シリーズに属していない場合 null が入っている。
*/
series: Series | null;
/**
* 単一イラスト詳細情報
*
* 単一ページの場合のみ利用。複数ページの場合は `meta_pages` を利用する。
* 複数ページの場合、このプロパティには `{}` が入っている。
*/
meta_single_page: MetaSinglePage | unknown[];
/**
* 複数イラスト詳細情報
*
* 複数ページの場合のみ利用。単一ページの場合は `meta_single_page` を利用する。
* 複数ページの場合、このプロパティには `[]` が入っている。
*/
meta_pages: MetaPages[];
/**
* 閲覧数
*/
total_view: number;
/**
* ブックマーク数
*/
total_bookmarks: number;
/**
* ブックマークしているかどうか
*/
is_bookmarked: boolean;
/**
* 閲覧可能かどうか
*/
visible: boolean;
/**
* この作品をミュートしているかどうか
*/
is_muted: boolean;
/**
* この作品にコメントしたユーザーの数
*/
total_comments: number;
/**
* AI使用フラグ
*
* 0: 未使用
* 1: 補助的に使用
* 2: 使用
*
* 2022/11/02時点で投稿画面に「補助的に使用」を選択できるUIは存在しないように見えるが、実際に 1 が入っている作品はある。
*
* @see https://www.pixiv.help/hc/ja/articles/11866194231577
* @see https://github.com/ArkoClub/async-pixiv/blob/fa45c81093a5c6f4eabfcc942915fc479e42174f/src/async_pixiv/model/other.py#L40-L48
*/
illust_ai_type: number;
/**
* 作品のスタイル?
*/
illust_book_style: number;
/**
* コメントの閲覧制御?
*/
comment_access_control: number;
}
//# sourceMappingURL=pixiv-illust.d.ts.map
import { PixivUser } from './pixiv-common';
import { PixivNovelItem } from './pixiv-novel';
/**
* pixiv 小説シリーズ詳細情報
*/
export interface NovelSeriesDetail {
/**
* シリーズ ID
*/
id: number;
/**
* シリーズタイトル
*/
title: string;
/**
* シリーズの説明文
*/
caption: string;
/**
* オリジナル作品かどうか
*/
is_original: boolean;
/**
* 完結済みかどうか
*/
is_concluded: boolean;
/**
* コンテンツ数
*/
content_count: number;
/**
* 累計文字数
*/
total_character_count: number;
/**
* ユーザー情報
*/
user: PixivUser;
/**
* シリーズ説明文
*/
display_text: string;
/**
* AI使用フラグ
*/
novel_ai_type: number;
/**
* ウォッチリストに追加済みかどうか
*/
watchlist_added: boolean;
}
/**
* pixiv 小説シリーズアイテム
*/
export interface PixivNovelSeriesItem {
/**
* シリーズ詳細
*/
novel_series_detail: NovelSeriesDetail;
/**
* シリーズの1個目の小説データ
*/
novel_series_first_novel: PixivNovelItem;
/**
* シリーズの最新の小説データ
*/
novel_series_latest_novel: PixivNovelItem;
/**
* シリーズにある小説一覧
*/
novels: PixivNovelItem[];
/**
* 次URL
*/
next_url: string | null;
}
//# sourceMappingURL=pixiv-novel-series.d.ts.map
import { ImageUrls, Tag, PixivUser, Series } from './pixiv-common';
/**
* pixiv 小説アイテム
*/
export interface PixivNovelItem {
/**
* 作品 ID
*
* イラスト・小説それぞれでIDの振り方が異なり、重複するので注意。
*/
id: number;
/**
* 作品タイトル
*/
title: string;
/**
* キャプション(説明文)
*/
caption: string;
/**
* 公開範囲
*
* 詳細不明。0 が公開なのは確定
*/
restrict: number;
/**
* 年齢制限
*
* 0 が全年齢、1 が R-18、2 が R-18G
*/
x_restrict: number;
/**
* オリジナル作品かどうか
*/
is_original: boolean;
/**
* 作品の画像URL群
*
* 小説の場合は表紙の画像が入っている。
*/
image_urls: ImageUrls;
/**
* 投稿日時
*
* ISO 8601 形式。YYYY-MM-DD'T'HH:mm:ss+09:00
*/
create_date: string;
/**
* 作品タグ
*/
tags: Tag[];
/**
* ページ数
*/
page_count: number;
/**
* 文字数
*/
text_length: number;
/**
* 作品投稿者情報
*/
user: PixivUser;
/**
* シリーズ情報
*
* 小説の場合、シリーズに属していない場合空配列が入っている。
*/
series: Series | unknown[];
/**
* ブックマークしているかどうか
*/
is_bookmarked: boolean;
/**
* ブックマーク数
*/
total_bookmarks: number;
/**
* 閲覧数
*/
total_view: number;
/**
* 閲覧可能かどうか
*/
visible: boolean;
/**
* コメント数
*/
total_comments: number;
/**
* この作品をミュートしているかどうか
*/
is_muted: boolean;
/**
* マイピクへの公開限定にしているかどう
*/
is_mypixiv_only: boolean;
/**
* 不明 (公開制限をしているかどうか?)
*/
is_x_restricted: boolean;
/**
* AI使用フラグ
*
* 0: 未使用
* 1: 補助的に使用
* 2: 使用
*
* 2022/11/02時点で投稿画面に「補助的に使用」を選択できるUIは存在しないように見えるが、実際に 1 が入っている作品はある。
*
* @see https://www.pixiv.help/hc/ja/articles/11866194231577
* @see https://github.com/ArkoClub/async-pixiv/blob/fa45c81093a5c6f4eabfcc942915fc479e42174f/src/async_pixiv/model/other.py#L40-L48
*/
novel_ai_type: number;
}
//# sourceMappingURL=pixiv-novel.d.ts.map
import { PixivUser } from './pixiv-common';
/**
* pixiv ユーザーアイテム
*/
export type PixivUserItem = PixivUser & {
/**
* 自己紹介
*
* 改行は \r\n っぽい。
*/
comment: string;
};
/**
* pixiv ユーザープロフィール
*/
export interface PixivUserProfile {

@@ -6,0 +17,0 @@ webpage: string;

2

package.json
{
"name": "@book000/pixivts",
"version": "0.2.2",
"version": "0.3.0",
"description": "pixiv Unofficial API Library for TypeScript",

@@ -5,0 +5,0 @@ "homepage": "https://www.npmjs.com/package/@book000/pixivts",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc