@kongyo2/nicotag-api 0.1.0

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.
Files changed (63) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +118 -0
  3. package/dist/errors.js +69 -0
  4. package/dist/errors.js.map +1 -0
  5. package/dist/extractors/cheerio.js +17 -0
  6. package/dist/extractors/cheerio.js.map +1 -0
  7. package/dist/extractors/index.js +24 -0
  8. package/dist/extractors/index.js.map +1 -0
  9. package/dist/extractors/manual-decode.js +41 -0
  10. package/dist/extractors/manual-decode.js.map +1 -0
  11. package/dist/extractors/node-html-parser.js +19 -0
  12. package/dist/extractors/node-html-parser.js.map +1 -0
  13. package/dist/extractors/regex-he.js +20 -0
  14. package/dist/extractors/regex-he.js.map +1 -0
  15. package/dist/extractors/regex-manual.js +20 -0
  16. package/dist/extractors/regex-manual.js.map +1 -0
  17. package/dist/extractors/types.js +2 -0
  18. package/dist/extractors/types.js.map +1 -0
  19. package/dist/fetcher.js +145 -0
  20. package/dist/fetcher.js.map +1 -0
  21. package/dist/index.js +10 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/parsers/server-response.js +28 -0
  24. package/dist/parsers/server-response.js.map +1 -0
  25. package/dist/types.js +68 -0
  26. package/dist/types.js.map +1 -0
  27. package/dist/url.js +9 -0
  28. package/dist/url.js.map +1 -0
  29. package/dist/video-id.js +22 -0
  30. package/dist/video-id.js.map +1 -0
  31. package/dist/watch.js +59 -0
  32. package/dist/watch.js.map +1 -0
  33. package/dist-types/errors.d.ts +55 -0
  34. package/dist-types/errors.d.ts.map +1 -0
  35. package/dist-types/extractors/cheerio.d.ts +3 -0
  36. package/dist-types/extractors/cheerio.d.ts.map +1 -0
  37. package/dist-types/extractors/index.d.ts +10 -0
  38. package/dist-types/extractors/index.d.ts.map +1 -0
  39. package/dist-types/extractors/manual-decode.d.ts +2 -0
  40. package/dist-types/extractors/manual-decode.d.ts.map +1 -0
  41. package/dist-types/extractors/node-html-parser.d.ts +3 -0
  42. package/dist-types/extractors/node-html-parser.d.ts.map +1 -0
  43. package/dist-types/extractors/regex-he.d.ts +3 -0
  44. package/dist-types/extractors/regex-he.d.ts.map +1 -0
  45. package/dist-types/extractors/regex-manual.d.ts +3 -0
  46. package/dist-types/extractors/regex-manual.d.ts.map +1 -0
  47. package/dist-types/extractors/types.d.ts +6 -0
  48. package/dist-types/extractors/types.d.ts.map +1 -0
  49. package/dist-types/fetcher.d.ts +26 -0
  50. package/dist-types/fetcher.d.ts.map +1 -0
  51. package/dist-types/index.d.ts +10 -0
  52. package/dist-types/index.d.ts.map +1 -0
  53. package/dist-types/parsers/server-response.d.ts +3 -0
  54. package/dist-types/parsers/server-response.d.ts.map +1 -0
  55. package/dist-types/types.d.ts +239 -0
  56. package/dist-types/types.d.ts.map +1 -0
  57. package/dist-types/url.d.ts +7 -0
  58. package/dist-types/url.d.ts.map +1 -0
  59. package/dist-types/video-id.d.ts +7 -0
  60. package/dist-types/video-id.d.ts.map +1 -0
  61. package/dist-types/watch.d.ts +40 -0
  62. package/dist-types/watch.d.ts.map +1 -0
  63. package/package.json +67 -0
package/dist/types.js ADDED
@@ -0,0 +1,68 @@
1
+ import { z } from 'zod';
2
+ export const TagItemSchema = z
3
+ .object({
4
+ name: z.string().min(1),
5
+ isCategory: z.boolean(),
6
+ isCategoryCandidate: z.boolean().optional(),
7
+ isNicodicArticleExists: z.boolean().optional(),
8
+ isLocked: z.boolean(),
9
+ })
10
+ .passthrough();
11
+ export const TagSectionSchema = z
12
+ .object({
13
+ items: z.array(TagItemSchema),
14
+ edit: z.unknown().optional(),
15
+ hasR18Tag: z.boolean().optional(),
16
+ isPublishedNicoscript: z.boolean().optional(),
17
+ viewer: z.unknown().optional(),
18
+ })
19
+ .passthrough();
20
+ export const VideoCountSchema = z
21
+ .object({
22
+ view: z.number().int().nonnegative().nullable().optional(),
23
+ comment: z.number().int().nonnegative().nullable().optional(),
24
+ mylist: z.number().int().nonnegative().nullable().optional(),
25
+ like: z.number().int().nonnegative().nullable().optional(),
26
+ })
27
+ .partial()
28
+ .passthrough();
29
+ export const VideoSectionSchema = z
30
+ .object({
31
+ id: z.string().min(1),
32
+ title: z.string(),
33
+ description: z.string().nullable().optional(),
34
+ registeredAt: z.string().nullable().optional(),
35
+ duration: z.number().int().nonnegative().nullable().optional(),
36
+ count: VideoCountSchema.optional(),
37
+ thumbnail: z
38
+ .object({
39
+ url: z.string().nullable().optional(),
40
+ middleUrl: z.string().nullable().optional(),
41
+ largeUrl: z.string().nullable().optional(),
42
+ })
43
+ .partial()
44
+ .passthrough()
45
+ .optional(),
46
+ })
47
+ .passthrough();
48
+ export const ServerResponseSchema = z
49
+ .object({
50
+ meta: z
51
+ .object({
52
+ status: z.number().int(),
53
+ code: z.string().optional(),
54
+ })
55
+ .passthrough(),
56
+ data: z
57
+ .object({
58
+ response: z
59
+ .object({
60
+ tag: TagSectionSchema,
61
+ video: VideoSectionSchema,
62
+ })
63
+ .passthrough(),
64
+ })
65
+ .passthrough(),
66
+ })
67
+ .passthrough();
68
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC;KAC3B,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE;IACvB,mBAAmB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC3C,sBAAsB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC9C,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;CACtB,CAAC;KACD,WAAW,EAAE,CAAC;AAIjB,MAAM,CAAC,MAAM,gBAAgB,GA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,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAC9C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAC9D,KAAK,EAAE,gBAAgB,CAAC,QAAQ,EAAE;IAClC,SAAS,EAAE,CAAC;SACT,MAAM,CAAC;QACN,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;QACrC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;QAC3C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;KAC3C,CAAC;SACD,OAAO,EAAE;SACT,WAAW,EAAE;SACb,QAAQ,EAAE;CACd,CAAC;KACD,WAAW,EAAE,CAAC;AA2BjB,MAAM,CAAC,MAAM,oBAAoB,GAA8B,CAAC;KAC7D,MAAM,CAAC;IACN,IAAI,EAAE,CAAC;SACJ,MAAM,CAAC;QACN,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;QACxB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAC5B,CAAC;SACD,WAAW,EAAE;IAChB,IAAI,EAAE,CAAC;SACJ,MAAM,CAAC;QACN,QAAQ,EAAE,CAAC;aACR,MAAM,CAAC;YACN,GAAG,EAAE,gBAAgB;YACrB,KAAK,EAAE,kBAAkB;SAC1B,CAAC;aACD,WAAW,EAAE;KACjB,CAAC;SACD,WAAW,EAAE;CACjB,CAAC;KACD,WAAW,EAA+B,CAAC"}
package/dist/url.js ADDED
@@ -0,0 +1,9 @@
1
+ import { normalizeVideoId } from './video-id.js';
2
+ export const WATCH_BASE_URL = 'https://www.nicovideo.jp/watch';
3
+ export function buildWatchUrl(options) {
4
+ const id = normalizeVideoId(options.videoId);
5
+ const base = options.baseUrl ?? WATCH_BASE_URL;
6
+ const url = new URL(`${base.replace(/\/+$/, '')}/${encodeURIComponent(id)}`);
7
+ return url.toString();
8
+ }
9
+ //# sourceMappingURL=url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.js","sourceRoot":"","sources":["../src/url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,MAAM,CAAC,MAAM,cAAc,GAAG,gCAAgC,CAAC;AAO/D,MAAM,UAAU,aAAa,CAAC,OAA6B;IACzD,MAAM,EAAE,GAAG,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7C,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,IAAI,cAAc,CAAC;IAC/C,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,kBAAkB,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAC7E,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;AACxB,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { z } from 'zod';
2
+ import { InvalidVideoIdError } from './errors.js';
3
+ const VIDEO_ID_RE = /^(sm|nm|so)\d+$/;
4
+ export const VideoIdSchema = z
5
+ .string()
6
+ .min(3)
7
+ .max(32)
8
+ .regex(VIDEO_ID_RE, 'video id must match /^(sm|nm|so)\\d+$/');
9
+ export function isValidVideoId(input) {
10
+ return VIDEO_ID_RE.test(input);
11
+ }
12
+ export function assertVideoId(input) {
13
+ if (!VIDEO_ID_RE.test(input)) {
14
+ throw new InvalidVideoIdError(`invalid niconico video id: ${JSON.stringify(input)} (expected /^(sm|nm|so)\\d+$/)`, { videoId: input });
15
+ }
16
+ }
17
+ export function normalizeVideoId(input) {
18
+ const trimmed = input.trim();
19
+ assertVideoId(trimmed);
20
+ return trimmed;
21
+ }
22
+ //# sourceMappingURL=video-id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"video-id.js","sourceRoot":"","sources":["../src/video-id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,WAAW,GAAG,iBAAiB,CAAC;AAEtC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC;KAC3B,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,EAAE,CAAC;KACP,KAAK,CAAC,WAAW,EAAE,wCAAwC,CAAC,CAAC;AAIhE,MAAM,UAAU,cAAc,CAAC,KAAa;IAC1C,OAAO,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,mBAAmB,CAC3B,8BAA8B,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,gCAAgC,EACnF,EAAE,OAAO,EAAE,KAAK,EAAE,CACnB,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,aAAa,CAAC,OAAO,CAAC,CAAC;IACvB,OAAO,OAAO,CAAC;AACjB,CAAC"}
package/dist/watch.js ADDED
@@ -0,0 +1,59 @@
1
+ import { DEFAULT_EXTRACTOR_CHAIN } from './extractors/index.js';
2
+ import { ExtractError, NicoTagError, describeError } from './errors.js';
3
+ import { fetchTextWithRetry } from './fetcher.js';
4
+ import { parseServerResponseJson } from './parsers/server-response.js';
5
+ import { buildWatchUrl } from './url.js';
6
+ import { normalizeVideoId } from './video-id.js';
7
+ export async function fetchVideoTags(options) {
8
+ const result = await fetchVideo(options);
9
+ return {
10
+ url: result.url,
11
+ fetchedAt: result.fetchedAt,
12
+ videoId: result.videoId,
13
+ tags: result.tag.items,
14
+ tagNames: result.tag.items.map((item) => item.name),
15
+ extractorUsed: result.extractorUsed,
16
+ fetchAttempts: result.fetchAttempts,
17
+ extractorAttempts: result.extractorAttempts,
18
+ };
19
+ }
20
+ export async function fetchVideo(options) {
21
+ const videoId = normalizeVideoId(options.videoId);
22
+ const url = buildWatchUrl({
23
+ videoId,
24
+ ...(options.baseUrl !== undefined ? { baseUrl: options.baseUrl } : {}),
25
+ });
26
+ const { text, attempts: fetchAttempts, url: finalUrl, } = await fetchTextWithRetry(url, options.http ?? {});
27
+ const parsed = extractAndParse(text, options.extractors ?? DEFAULT_EXTRACTOR_CHAIN);
28
+ return {
29
+ url: finalUrl,
30
+ fetchedAt: new Date().toISOString(),
31
+ videoId,
32
+ video: parsed.parsed.data.response.video,
33
+ tag: parsed.parsed.data.response.tag,
34
+ serverResponse: parsed.parsed,
35
+ extractorUsed: parsed.extractorUsed,
36
+ fetchAttempts,
37
+ extractorAttempts: parsed.attempts,
38
+ };
39
+ }
40
+ export function extractAndParse(html, extractors = DEFAULT_EXTRACTOR_CHAIN) {
41
+ if (extractors.length === 0) {
42
+ throw new NicoTagError('No extractors configured');
43
+ }
44
+ const attempts = [];
45
+ let lastError;
46
+ for (const extractor of extractors) {
47
+ try {
48
+ const jsonText = extractor.extract(html);
49
+ const parsed = parseServerResponseJson(jsonText);
50
+ return { parsed, extractorUsed: extractor.name, attempts };
51
+ }
52
+ catch (error) {
53
+ attempts.push({ extractor: extractor.name, error: describeError(error) });
54
+ lastError = error;
55
+ }
56
+ }
57
+ throw new ExtractError(`All ${extractors.length} extractors failed to parse server-response from HTML`, attempts, { cause: lastError });
58
+ }
59
+ //# sourceMappingURL=watch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watch.js","sourceRoot":"","sources":["../src/watch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBA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Aa,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAC1E,SAAS,GAAG,KAAK,CAAC;QACpB,CAAC;IACH,CAAC;IACD,MAAM,IAAI,YAAY,CACpB,OAAO,UAAU,CAAC,MAAM,uDAAuD,EAC/E,QAAQ,EACR,EAAE,KAAK,EAAE,SAAS,EAAE,CACrB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,55 @@
1
+ import type { ZodIssue } from 'zod';
2
+ export type NicoTagErrorOptions = {
3
+ cause?: unknown;
4
+ url?: string;
5
+ videoId?: string;
6
+ attempt?: number;
7
+ };
8
+ export declare class NicoTagError extends Error {
9
+ readonly name: string;
10
+ readonly url?: string;
11
+ readonly videoId?: string;
12
+ readonly attempt?: number;
13
+ constructor(message: string, options?: NicoTagErrorOptions);
14
+ }
15
+ export declare class InvalidVideoIdError extends NicoTagError {
16
+ readonly name = "InvalidVideoIdError";
17
+ }
18
+ export declare class FetchError extends NicoTagError {
19
+ readonly name = "FetchError";
20
+ readonly status?: number;
21
+ readonly statusText?: string;
22
+ constructor(message: string, options?: NicoTagErrorOptions & {
23
+ status?: number;
24
+ statusText?: string;
25
+ });
26
+ }
27
+ export declare class TimeoutError extends NicoTagError {
28
+ readonly name = "TimeoutError";
29
+ }
30
+ export declare class AbortError extends NicoTagError {
31
+ readonly name = "AbortError";
32
+ }
33
+ export declare class ExtractError extends NicoTagError {
34
+ readonly name = "ExtractError";
35
+ readonly attempts: ReadonlyArray<ExtractorAttempt>;
36
+ constructor(message: string, attempts: ReadonlyArray<ExtractorAttempt>, options?: NicoTagErrorOptions);
37
+ }
38
+ export type ExtractorAttempt = {
39
+ readonly extractor: string;
40
+ readonly error: string;
41
+ };
42
+ export declare class ParseError extends NicoTagError {
43
+ readonly name = "ParseError";
44
+ readonly snippet?: string;
45
+ constructor(message: string, options?: NicoTagErrorOptions & {
46
+ snippet?: string;
47
+ });
48
+ }
49
+ export declare class ValidationError extends NicoTagError {
50
+ readonly name = "ValidationError";
51
+ readonly issues: ReadonlyArray<ZodIssue>;
52
+ constructor(message: string, issues: ReadonlyArray<ZodIssue>, options?: NicoTagErrorOptions);
53
+ }
54
+ export declare function describeError(error: unknown): string;
55
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,qBAAa,YAAa,SAAQ,KAAK;IACrC,SAAkB,IAAI,EAAE,MAAM,CAAkB;IAChD,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;gBACd,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB;CAM/D;AAED,qBAAa,mBAAoB,SAAQ,YAAY;IACnD,SAAkB,IAAI,yBAAyB;CAChD;AAED,qBAAa,UAAW,SAAQ,YAAY;IAC1C,SAAkB,IAAI,gBAAgB;IACtC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;gBAE3B,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,mBAAmB,GAAG;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAO;CAM/E;AAED,qBAAa,YAAa,SAAQ,YAAY;IAC5C,SAAkB,IAAI,kBAAkB;CACzC;AAED,qBAAa,UAAW,SAAQ,YAAY;IAC1C,SAAkB,IAAI,gBAAgB;CACvC;AAED,qBAAa,YAAa,SAAQ,YAAY;IAC5C,SAAkB,IAAI,kBAAkB;IACxC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;gBAEjD,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,aAAa,CAAC,gBAAgB,CAAC,EACzC,OAAO,GAAE,mBAAwB;CAKpC;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,qBAAa,UAAW,SAAQ,YAAY;IAC1C,SAAkB,IAAI,gBAAgB;IACtC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;gBACd,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAmB,GAAG;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAO;CAItF;AAED,qBAAa,eAAgB,SAAQ,YAAY;IAC/C,SAAkB,IAAI,qBAAqB;IAC3C,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;gBAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAE,mBAAwB;CAIhG;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAMpD"}
@@ -0,0 +1,3 @@
1
+ import type { Extractor } from './types.js';
2
+ export declare const cheerioExtractor: Extractor;
3
+ //# sourceMappingURL=cheerio.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cheerio.d.ts","sourceRoot":"","sources":["../../src/extractors/cheerio.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,eAAO,MAAM,gBAAgB,EAAE,SAc9B,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { cheerioExtractor } from './cheerio.js';
2
+ import { nodeHtmlParserExtractor } from './node-html-parser.js';
3
+ import { regexHeExtractor } from './regex-he.js';
4
+ import { regexManualExtractor } from './regex-manual.js';
5
+ import type { Extractor, ExtractorName } from './types.js';
6
+ export { cheerioExtractor, nodeHtmlParserExtractor, regexHeExtractor, regexManualExtractor };
7
+ export type { Extractor, ExtractorName } from './types.js';
8
+ export declare const DEFAULT_EXTRACTOR_CHAIN: readonly Extractor[];
9
+ export declare function getExtractor(name: ExtractorName): Extractor;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/extractors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3D,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,CAAC;AAC7F,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3D,eAAO,MAAM,uBAAuB,EAAE,SAAS,SAAS,EAKtD,CAAC;AAEH,wBAAgB,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,SAAS,CAW3D"}
@@ -0,0 +1,2 @@
1
+ export declare function decodeHtmlEntitiesManual(input: string): string;
2
+ //# sourceMappingURL=manual-decode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manual-decode.d.ts","sourceRoot":"","sources":["../../src/extractors/manual-decode.ts"],"names":[],"mappings":"AASA,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CA+B9D"}
@@ -0,0 +1,3 @@
1
+ import type { Extractor } from './types.js';
2
+ export declare const nodeHtmlParserExtractor: Extractor;
3
+ //# sourceMappingURL=node-html-parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-html-parser.d.ts","sourceRoot":"","sources":["../../src/extractors/node-html-parser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,eAAO,MAAM,uBAAuB,EAAE,SAgBrC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Extractor } from './types.js';
2
+ export declare const regexHeExtractor: Extractor;
3
+ //# sourceMappingURL=regex-he.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"regex-he.d.ts","sourceRoot":"","sources":["../../src/extractors/regex-he.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAO5C,eAAO,MAAM,gBAAgB,EAAE,SAe9B,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Extractor } from './types.js';
2
+ export declare const regexManualExtractor: Extractor;
3
+ //# sourceMappingURL=regex-manual.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"regex-manual.d.ts","sourceRoot":"","sources":["../../src/extractors/regex-manual.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAO5C,eAAO,MAAM,oBAAoB,EAAE,SAelC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export type ExtractorName = 'cheerio' | 'node-html-parser' | 'regex-he' | 'regex-manual';
2
+ export type Extractor = {
3
+ readonly name: ExtractorName;
4
+ extract(html: string): string;
5
+ };
6
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/extractors/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,kBAAkB,GAAG,UAAU,GAAG,cAAc,CAAC;AAEzF,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CAC/B,CAAC"}
@@ -0,0 +1,26 @@
1
+ export declare const DEFAULT_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36";
2
+ export type RetryOptions = {
3
+ maxRetries?: number;
4
+ initialDelayMs?: number;
5
+ maxDelayMs?: number;
6
+ jitterRatio?: number;
7
+ };
8
+ export type HttpFetchOptions = {
9
+ userAgent?: string;
10
+ acceptLanguage?: string;
11
+ headers?: Readonly<Record<string, string>>;
12
+ timeoutMs?: number;
13
+ signal?: AbortSignal | undefined;
14
+ retry?: RetryOptions;
15
+ fetchImpl?: typeof fetch;
16
+ redirect?: 'follow' | 'error' | 'manual';
17
+ sleep?: (ms: number, signal?: AbortSignal) => Promise<void>;
18
+ };
19
+ export type FetchTextResult = {
20
+ text: string;
21
+ url: string;
22
+ status: number;
23
+ attempts: number;
24
+ };
25
+ export declare function fetchTextWithRetry(url: string, options?: HttpFetchOptions): Promise<FetchTextResult>;
26
+ //# sourceMappingURL=fetcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetcher.d.ts","sourceRoot":"","sources":["../src/fetcher.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB,oHACoF,CAAC;AAEpH,MAAM,MAAM,YAAY,GAAG;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IACjC,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IACzB,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;IACzC,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7D,CAAC;AAWF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,eAAe,CAAC,CAgG1B"}
@@ -0,0 +1,10 @@
1
+ export { fetchVideoTags, fetchVideo, extractAndParse, type FetchVideoOptions, type FetchTagsResult, type FetchVideoResult, type ParseHtmlResult, } from './watch.js';
2
+ export { buildWatchUrl, WATCH_BASE_URL, type BuildWatchUrlOptions } from './url.js';
3
+ export { VideoIdSchema, isValidVideoId, assertVideoId, normalizeVideoId, type VideoId, } from './video-id.js';
4
+ export { fetchTextWithRetry, DEFAULT_USER_AGENT, type HttpFetchOptions, type RetryOptions, type FetchTextResult, } from './fetcher.js';
5
+ export { TagItemSchema, TagSectionSchema, VideoCountSchema, VideoSectionSchema, ServerResponseSchema, type TagItem, type TagSection, type VideoSection, type ServerResponse, } from './types.js';
6
+ export { NicoTagError, InvalidVideoIdError, FetchError, TimeoutError, AbortError, ExtractError, ParseError, ValidationError, describeError, type ExtractorAttempt, type NicoTagErrorOptions, } from './errors.js';
7
+ export { cheerioExtractor, nodeHtmlParserExtractor, regexHeExtractor, regexManualExtractor, DEFAULT_EXTRACTOR_CHAIN, getExtractor, type Extractor, type ExtractorName, } from './extractors/index.js';
8
+ export { parseServerResponseJson } from './parsers/server-response.js';
9
+ export { decodeHtmlEntitiesManual } from './extractors/manual-decode.js';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,UAAU,EACV,eAAe,EACf,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,eAAe,GACrB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,KAAK,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEpF,OAAO,EACL,aAAa,EACb,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,KAAK,OAAO,GACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,eAAe,GACrB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,OAAO,EACZ,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,cAAc,GACpB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,UAAU,EACV,eAAe,EACf,aAAa,EACb,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,GACzB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,gBAAgB,EAChB,oBAAoB,EACpB,uBAAuB,EACvB,YAAY,EACZ,KAAK,SAAS,EACd,KAAK,aAAa,GACnB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type ServerResponse } from '../types.js';
2
+ export declare function parseServerResponseJson(jsonText: string): ServerResponse;
3
+ //# sourceMappingURL=server-response.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-response.d.ts","sourceRoot":"","sources":["../../src/parsers/server-response.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwB,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAExE,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,CAqBxE"}
@@ -0,0 +1,239 @@
1
+ import { z } from 'zod';
2
+ export declare const TagItemSchema: z.ZodObject<{
3
+ name: z.ZodString;
4
+ isCategory: z.ZodBoolean;
5
+ isCategoryCandidate: z.ZodOptional<z.ZodBoolean>;
6
+ isNicodicArticleExists: z.ZodOptional<z.ZodBoolean>;
7
+ isLocked: z.ZodBoolean;
8
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
9
+ name: z.ZodString;
10
+ isCategory: z.ZodBoolean;
11
+ isCategoryCandidate: z.ZodOptional<z.ZodBoolean>;
12
+ isNicodicArticleExists: z.ZodOptional<z.ZodBoolean>;
13
+ isLocked: z.ZodBoolean;
14
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
15
+ name: z.ZodString;
16
+ isCategory: z.ZodBoolean;
17
+ isCategoryCandidate: z.ZodOptional<z.ZodBoolean>;
18
+ isNicodicArticleExists: z.ZodOptional<z.ZodBoolean>;
19
+ isLocked: z.ZodBoolean;
20
+ }, z.ZodTypeAny, "passthrough">>;
21
+ export type TagItem = z.infer<typeof TagItemSchema>;
22
+ export declare const TagSectionSchema: z.ZodObject<{
23
+ items: z.ZodArray<z.ZodObject<{
24
+ name: z.ZodString;
25
+ isCategory: z.ZodBoolean;
26
+ isCategoryCandidate: z.ZodOptional<z.ZodBoolean>;
27
+ isNicodicArticleExists: z.ZodOptional<z.ZodBoolean>;
28
+ isLocked: z.ZodBoolean;
29
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
30
+ name: z.ZodString;
31
+ isCategory: z.ZodBoolean;
32
+ isCategoryCandidate: z.ZodOptional<z.ZodBoolean>;
33
+ isNicodicArticleExists: z.ZodOptional<z.ZodBoolean>;
34
+ isLocked: z.ZodBoolean;
35
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
36
+ name: z.ZodString;
37
+ isCategory: z.ZodBoolean;
38
+ isCategoryCandidate: z.ZodOptional<z.ZodBoolean>;
39
+ isNicodicArticleExists: z.ZodOptional<z.ZodBoolean>;
40
+ isLocked: z.ZodBoolean;
41
+ }, z.ZodTypeAny, "passthrough">>, "many">;
42
+ edit: z.ZodOptional<z.ZodUnknown>;
43
+ hasR18Tag: z.ZodOptional<z.ZodBoolean>;
44
+ isPublishedNicoscript: z.ZodOptional<z.ZodBoolean>;
45
+ viewer: z.ZodOptional<z.ZodUnknown>;
46
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
47
+ items: z.ZodArray<z.ZodObject<{
48
+ name: z.ZodString;
49
+ isCategory: z.ZodBoolean;
50
+ isCategoryCandidate: z.ZodOptional<z.ZodBoolean>;
51
+ isNicodicArticleExists: z.ZodOptional<z.ZodBoolean>;
52
+ isLocked: z.ZodBoolean;
53
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
54
+ name: z.ZodString;
55
+ isCategory: z.ZodBoolean;
56
+ isCategoryCandidate: z.ZodOptional<z.ZodBoolean>;
57
+ isNicodicArticleExists: z.ZodOptional<z.ZodBoolean>;
58
+ isLocked: z.ZodBoolean;
59
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
60
+ name: z.ZodString;
61
+ isCategory: z.ZodBoolean;
62
+ isCategoryCandidate: z.ZodOptional<z.ZodBoolean>;
63
+ isNicodicArticleExists: z.ZodOptional<z.ZodBoolean>;
64
+ isLocked: z.ZodBoolean;
65
+ }, z.ZodTypeAny, "passthrough">>, "many">;
66
+ edit: z.ZodOptional<z.ZodUnknown>;
67
+ hasR18Tag: z.ZodOptional<z.ZodBoolean>;
68
+ isPublishedNicoscript: z.ZodOptional<z.ZodBoolean>;
69
+ viewer: z.ZodOptional<z.ZodUnknown>;
70
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
71
+ items: z.ZodArray<z.ZodObject<{
72
+ name: z.ZodString;
73
+ isCategory: z.ZodBoolean;
74
+ isCategoryCandidate: z.ZodOptional<z.ZodBoolean>;
75
+ isNicodicArticleExists: z.ZodOptional<z.ZodBoolean>;
76
+ isLocked: z.ZodBoolean;
77
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
78
+ name: z.ZodString;
79
+ isCategory: z.ZodBoolean;
80
+ isCategoryCandidate: z.ZodOptional<z.ZodBoolean>;
81
+ isNicodicArticleExists: z.ZodOptional<z.ZodBoolean>;
82
+ isLocked: z.ZodBoolean;
83
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
84
+ name: z.ZodString;
85
+ isCategory: z.ZodBoolean;
86
+ isCategoryCandidate: z.ZodOptional<z.ZodBoolean>;
87
+ isNicodicArticleExists: z.ZodOptional<z.ZodBoolean>;
88
+ isLocked: z.ZodBoolean;
89
+ }, z.ZodTypeAny, "passthrough">>, "many">;
90
+ edit: z.ZodOptional<z.ZodUnknown>;
91
+ hasR18Tag: z.ZodOptional<z.ZodBoolean>;
92
+ isPublishedNicoscript: z.ZodOptional<z.ZodBoolean>;
93
+ viewer: z.ZodOptional<z.ZodUnknown>;
94
+ }, z.ZodTypeAny, "passthrough">>;
95
+ export type TagSection = z.infer<typeof TagSectionSchema>;
96
+ export declare const VideoCountSchema: z.ZodObject<{
97
+ view: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
98
+ comment: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
99
+ mylist: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
100
+ like: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
101
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
102
+ view: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
103
+ comment: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
104
+ mylist: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
105
+ like: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
106
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
107
+ view: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
108
+ comment: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
109
+ mylist: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
110
+ like: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
111
+ }, z.ZodTypeAny, "passthrough">>;
112
+ export declare const VideoSectionSchema: z.ZodObject<{
113
+ id: z.ZodString;
114
+ title: z.ZodString;
115
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
116
+ registeredAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
117
+ duration: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
118
+ count: z.ZodOptional<z.ZodObject<{
119
+ view: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
120
+ comment: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
121
+ mylist: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
122
+ like: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
123
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
124
+ view: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
125
+ comment: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
126
+ mylist: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
127
+ like: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
128
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
129
+ view: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
130
+ comment: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
131
+ mylist: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
132
+ like: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
133
+ }, z.ZodTypeAny, "passthrough">>>;
134
+ thumbnail: z.ZodOptional<z.ZodObject<{
135
+ url: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
136
+ middleUrl: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
137
+ largeUrl: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
138
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
139
+ url: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
140
+ middleUrl: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
141
+ largeUrl: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
142
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
143
+ url: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
144
+ middleUrl: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
145
+ largeUrl: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
146
+ }, z.ZodTypeAny, "passthrough">>>;
147
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
148
+ id: z.ZodString;
149
+ title: z.ZodString;
150
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
151
+ registeredAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
152
+ duration: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
153
+ count: z.ZodOptional<z.ZodObject<{
154
+ view: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
155
+ comment: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
156
+ mylist: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
157
+ like: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
158
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
159
+ view: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
160
+ comment: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
161
+ mylist: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
162
+ like: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
163
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
164
+ view: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
165
+ comment: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
166
+ mylist: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
167
+ like: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
168
+ }, z.ZodTypeAny, "passthrough">>>;
169
+ thumbnail: z.ZodOptional<z.ZodObject<{
170
+ url: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
171
+ middleUrl: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
172
+ largeUrl: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
173
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
174
+ url: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
175
+ middleUrl: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
176
+ largeUrl: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
177
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
178
+ url: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
179
+ middleUrl: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
180
+ largeUrl: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
181
+ }, z.ZodTypeAny, "passthrough">>>;
182
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
183
+ id: z.ZodString;
184
+ title: z.ZodString;
185
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
186
+ registeredAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
187
+ duration: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
188
+ count: z.ZodOptional<z.ZodObject<{
189
+ view: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
190
+ comment: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
191
+ mylist: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
192
+ like: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
193
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
194
+ view: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
195
+ comment: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
196
+ mylist: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
197
+ like: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
198
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
199
+ view: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
200
+ comment: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
201
+ mylist: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
202
+ like: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
203
+ }, z.ZodTypeAny, "passthrough">>>;
204
+ thumbnail: z.ZodOptional<z.ZodObject<{
205
+ url: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
206
+ middleUrl: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
207
+ largeUrl: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
208
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
209
+ url: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
210
+ middleUrl: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
211
+ largeUrl: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
212
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
213
+ url: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
214
+ middleUrl: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
215
+ largeUrl: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
216
+ }, z.ZodTypeAny, "passthrough">>>;
217
+ }, z.ZodTypeAny, "passthrough">>;
218
+ export type VideoSection = z.infer<typeof VideoSectionSchema>;
219
+ export type ServerResponseMeta = {
220
+ status: number;
221
+ code?: string;
222
+ [key: string]: unknown;
223
+ };
224
+ export type ServerResponseInnerResponse = {
225
+ tag: TagSection;
226
+ video: VideoSection;
227
+ [key: string]: unknown;
228
+ };
229
+ export type ServerResponseData = {
230
+ response: ServerResponseInnerResponse;
231
+ [key: string]: unknown;
232
+ };
233
+ export type ServerResponse = {
234
+ meta: ServerResponseMeta;
235
+ data: ServerResponseData;
236
+ [key: string]: unknown;
237
+ };
238
+ export declare const ServerResponseSchema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E,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,kBAAkB,CAAC;IACzB,IAAI,EAAE,kBAAkB,CAAC;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,CAmBd,CAAC"}
@@ -0,0 +1,7 @@
1
+ export declare const WATCH_BASE_URL = "https://www.nicovideo.jp/watch";
2
+ export type BuildWatchUrlOptions = {
3
+ videoId: string;
4
+ baseUrl?: string;
5
+ };
6
+ export declare function buildWatchUrl(options: BuildWatchUrlOptions): string;
7
+ //# sourceMappingURL=url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../src/url.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,mCAAmC,CAAC;AAE/D,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CAKnE"}