twitter-snap 0.0.23 → 0.0.24
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 +3 -3
- package/bin/run.js +1 -1
- package/dist/commands/index.d.ts +14 -9
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +101 -44
- package/dist/commands/index.js.map +1 -1
- package/dist/core/core.d.ts +10 -9
- package/dist/core/core.d.ts.map +1 -1
- package/dist/core/core.js +52 -43
- package/dist/core/core.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/fonts.d.ts +4 -0
- package/dist/utils/fonts.d.ts.map +1 -1
- package/dist/utils/fonts.js +10 -26
- package/dist/utils/fonts.js.map +1 -1
- package/dist/utils/logger.d.ts +35 -13
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +165 -72
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/types.d.ts +1 -1
- package/dist/utils/types.d.ts.map +1 -1
- package/oclif.manifest.json +95 -39
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ Create beautiful Tweet images fast
|
|
|
22
22
|
USAGE
|
|
23
23
|
$ twitter-snap ID [--api
|
|
24
24
|
getTweetResultByRestId|getTweetDetail|getSearchTimeline|getHomeTimeline|getHomeLatestTimeline|getListLatestTweetsTimeline|getUserTweets|getUserTweetsAndReplies|getUserMedia|getLikes|ge
|
|
25
|
-
tBookmarks] [--theme RenderBasic] [-o <value>] [--cleanup] [--
|
|
25
|
+
tBookmarks] [--theme RenderBasic] [-o <value>] [--cleanup] [--limit <value>] [--debug] [--sleep <value>] [--session_type <value>] [--cookies_file <value>] [--browser_profile <value>]
|
|
26
26
|
[--browser_headless]
|
|
27
27
|
|
|
28
28
|
ARGUMENTS
|
|
@@ -38,7 +38,7 @@ FLAGS
|
|
|
38
38
|
--cleanup Cleanup
|
|
39
39
|
--cookies_file=<value> [default: cookies.json] Cookies file
|
|
40
40
|
--debug Debug
|
|
41
|
-
--
|
|
41
|
+
--limit=<value> [default: 30] Limit count
|
|
42
42
|
--session_type=<value> [default: guest] Session type
|
|
43
43
|
--sleep=<value> Sleep (ms)
|
|
44
44
|
--theme=<option> [default: RenderBasic] Theme type
|
|
@@ -55,7 +55,7 @@ EXAMPLES
|
|
|
55
55
|
|
|
56
56
|
$ twitter-snap 1765415187161464972 --session_type file --cookies_file cookies.json
|
|
57
57
|
|
|
58
|
-
$ twitter-snap 44196397 --api getUserTweets --
|
|
58
|
+
$ twitter-snap 44196397 --api getUserTweets --limit 10
|
|
59
59
|
|
|
60
60
|
$ twitter-snap 44196397 --api getUserTweets --output "data/{user-screen-name}/{id}.{if-photo:png:mp4}"
|
|
61
61
|
```
|
package/bin/run.js
CHANGED
package/dist/commands/index.d.ts
CHANGED
|
@@ -3,22 +3,27 @@ export default class Default extends Command {
|
|
|
3
3
|
static args: {
|
|
4
4
|
id: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
5
5
|
};
|
|
6
|
+
static browserProfile: string;
|
|
6
7
|
static description: string;
|
|
7
8
|
static examples: string[];
|
|
8
|
-
static browser_profile: string;
|
|
9
9
|
static flags: {
|
|
10
10
|
api: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<"getTweetDetail" | "getSearchTimeline" | "getHomeTimeline" | "getHomeLatestTimeline" | "getListLatestTweetsTimeline" | "getUserTweets" | "getUserTweetsAndReplies" | "getUserMedia" | "getLikes" | "getBookmarks" | "getTweetResultByRestId", import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
max: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<number, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
11
|
+
browserHeadless: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
12
|
+
browserProfile: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
13
|
+
cookiesFile: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
15
14
|
debug: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
15
|
+
limit: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<number, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
16
|
+
noCleanup: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
17
|
+
output: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
18
|
+
sessionType: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<"browser" | "file" | "guest", import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
19
|
+
simpleLog: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
16
20
|
sleep: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<number, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
theme: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<"RenderBasic", import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
22
|
+
ffmpegAdditonalOption: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
23
|
+
ffmpegPath: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
24
|
+
ffprobePath: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
21
25
|
};
|
|
26
|
+
main(): Promise<void>;
|
|
22
27
|
run(): Promise<void>;
|
|
23
28
|
}
|
|
24
29
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,OAAO,EAAQ,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,OAAO,EAAQ,MAAM,aAAa,CAAA;AAQhD,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,OAAO;IAC1C,MAAM,CAAC,IAAI;;MAEV;IAED,MAAM,CAAC,cAAc,SAAiD;IACtE,MAAM,CAAC,WAAW,SAA8F;IAEhH,MAAM,CAAC,QAAQ,WAMd;IAED,MAAM,CAAC,KAAK;;;;;;;;;;;;;;;;MAwEX;IAEK,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAiErB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAK3B"}
|
package/dist/commands/index.js
CHANGED
|
@@ -1,44 +1,30 @@
|
|
|
1
1
|
var _a;
|
|
2
2
|
import { Args, Command, Flags } from '@oclif/core';
|
|
3
|
-
import os from 'os';
|
|
4
|
-
import { themeList } from 'twitter-snap-core';
|
|
3
|
+
import os from 'node:os';
|
|
4
|
+
import { FFmpegInfrastructure, themeList } from 'twitter-snap-core';
|
|
5
5
|
import { twitterSnapCookies, twitterSnapGuest, twitterSnapPuppeteer } from '../core/core.js';
|
|
6
|
-
import { Logger } from '../utils/logger.js';
|
|
6
|
+
import { Logger, LoggerSimple } from '../utils/logger.js';
|
|
7
7
|
import { getTweetList } from './../utils/types.js';
|
|
8
|
-
const apiFlag = Flags.custom({
|
|
9
|
-
description: 'API type',
|
|
10
|
-
options: ['getTweetResultByRestId', ...getTweetList],
|
|
11
|
-
default: 'getTweetResultByRestId',
|
|
12
|
-
});
|
|
13
|
-
const themeNameFlag = Flags.custom({
|
|
14
|
-
description: 'Theme type',
|
|
15
|
-
options: Object.keys(themeList),
|
|
16
|
-
default: 'RenderBasic',
|
|
17
|
-
});
|
|
18
|
-
const sessionType = Flags.custom({
|
|
19
|
-
description: 'Session type',
|
|
20
|
-
default: 'guest',
|
|
21
|
-
});
|
|
22
8
|
class Default extends Command {
|
|
23
|
-
async
|
|
9
|
+
async main() {
|
|
24
10
|
const { args, flags } = await this.parse(_a);
|
|
25
|
-
const logger = new Logger();
|
|
11
|
+
const logger = flags.simpleLog ? new LoggerSimple(this.log.bind(this)) : new Logger();
|
|
26
12
|
console.log = flags.debug ? logger.log.bind(logger) : (_) => { };
|
|
27
|
-
console.debug = flags.debug ? logger.
|
|
13
|
+
console.debug = flags.debug ? logger.log.bind(logger) : (_) => { };
|
|
28
14
|
console.warn = logger.warn.bind(logger);
|
|
29
15
|
console.error = logger.error.bind(logger);
|
|
30
16
|
const getClient = (() => {
|
|
31
|
-
switch (flags.
|
|
17
|
+
switch (flags.sessionType) {
|
|
32
18
|
case 'guest':
|
|
33
19
|
return twitterSnapGuest();
|
|
34
20
|
case 'browser':
|
|
35
|
-
return twitterSnapPuppeteer(flags.
|
|
21
|
+
return twitterSnapPuppeteer(flags.browserHeadless, flags.browserProfile);
|
|
36
22
|
case 'file':
|
|
37
|
-
return twitterSnapCookies(flags.
|
|
23
|
+
return twitterSnapCookies(flags.cookiesFile);
|
|
38
24
|
}
|
|
39
25
|
})();
|
|
40
26
|
const client = await logger.guard({ text: 'Loading Client' }, getClient);
|
|
41
|
-
const logHandler = async ({ type, user
|
|
27
|
+
const logHandler = async ({ id, type, user }) => {
|
|
42
28
|
switch (type) {
|
|
43
29
|
case 'start':
|
|
44
30
|
return logger.update(`Rendering tweet ${user}/${id}`);
|
|
@@ -49,54 +35,125 @@ class Default extends Command {
|
|
|
49
35
|
}
|
|
50
36
|
};
|
|
51
37
|
const sleep = async (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
52
|
-
const render = client({ id: args.id,
|
|
38
|
+
const render = client({ id: args.id, limit: flags.limit, type: flags.api }, async (render) => {
|
|
53
39
|
try {
|
|
54
40
|
const finalize = await render({
|
|
41
|
+
handler: logHandler,
|
|
42
|
+
output: flags.output,
|
|
55
43
|
themeName: flags.theme,
|
|
56
44
|
themeParam: {
|
|
45
|
+
ffmpeg: new FFmpegInfrastructure({
|
|
46
|
+
ffmpegPath: flags.ffmpegPath,
|
|
47
|
+
ffprobePath: flags.ffprobePath,
|
|
48
|
+
}),
|
|
49
|
+
ffmpegAdditonalOption: flags.ffmpegAdditonalOption?.split(' ') ?? [],
|
|
57
50
|
width: 600,
|
|
58
51
|
},
|
|
59
|
-
output: flags.output,
|
|
60
|
-
handler: logHandler,
|
|
61
52
|
});
|
|
62
53
|
await finalize({
|
|
63
|
-
cleanup:
|
|
54
|
+
cleanup: !flags.noCleanup,
|
|
64
55
|
});
|
|
65
56
|
logger.succeed();
|
|
66
57
|
}
|
|
67
|
-
catch (
|
|
68
|
-
logger.
|
|
58
|
+
catch (error) {
|
|
59
|
+
logger.catchFail(error);
|
|
69
60
|
}
|
|
70
61
|
await sleep(flags.sleep);
|
|
71
62
|
});
|
|
72
|
-
await logger.guardProgress({ text: 'Rendering tweet'
|
|
63
|
+
await logger.guardProgress({ max: flags.limit, text: 'Rendering tweet' }, render);
|
|
64
|
+
}
|
|
65
|
+
async run() {
|
|
66
|
+
try {
|
|
67
|
+
await this.main();
|
|
68
|
+
}
|
|
69
|
+
catch { }
|
|
73
70
|
}
|
|
74
71
|
}
|
|
75
72
|
_a = Default;
|
|
76
73
|
Default.args = {
|
|
77
74
|
id: Args.string({ description: 'Twitter status id', required: true }),
|
|
78
75
|
};
|
|
76
|
+
Default.browserProfile = `${os.homedir()}/.cache/twitter-snap/profiles`;
|
|
79
77
|
Default.description = ['Create beautiful Tweet images fast', 'https://github.com/fa0311/twitter-snap'].join('\n');
|
|
80
78
|
Default.examples = [
|
|
81
79
|
'twitter-snap 1765415187161464972',
|
|
82
80
|
'twitter-snap 1765415187161464972 --session_type browser',
|
|
83
81
|
'twitter-snap 1765415187161464972 --session_type file --cookies_file cookies.json',
|
|
84
|
-
'twitter-snap 44196397 --api getUserTweets --
|
|
82
|
+
'twitter-snap 44196397 --api getUserTweets --limit 10',
|
|
85
83
|
'twitter-snap 44196397 --api getUserTweets --output "data/{user-screen-name}/{id}.{if-photo:png:mp4}"',
|
|
86
84
|
];
|
|
87
|
-
Default.browser_profile = `${os.homedir()}/.cache/twitter-snap/profiles`;
|
|
88
85
|
Default.flags = {
|
|
89
|
-
api:
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
86
|
+
api: Flags.custom({
|
|
87
|
+
default: 'getTweetResultByRestId',
|
|
88
|
+
description: 'API type',
|
|
89
|
+
options: ['getTweetResultByRestId', ...getTweetList],
|
|
90
|
+
})(),
|
|
91
|
+
browserHeadless: Flags.boolean({
|
|
92
|
+
aliases: ['browser-headless'],
|
|
93
|
+
default: false,
|
|
94
|
+
description: 'Browser headless',
|
|
95
|
+
}),
|
|
96
|
+
browserProfile: Flags.string({
|
|
97
|
+
aliases: ['browser-profile'],
|
|
98
|
+
default: _a.browserProfile,
|
|
99
|
+
description: 'Browser profile',
|
|
100
|
+
}),
|
|
101
|
+
cookiesFile: Flags.file({
|
|
102
|
+
aliases: ['cookies-file'],
|
|
103
|
+
default: 'cookies.json',
|
|
104
|
+
description: 'Cookies file',
|
|
105
|
+
}),
|
|
106
|
+
debug: Flags.boolean({
|
|
107
|
+
default: false,
|
|
108
|
+
description: 'Debug',
|
|
109
|
+
}),
|
|
110
|
+
limit: Flags.integer({
|
|
111
|
+
default: 30,
|
|
112
|
+
description: 'Limit count',
|
|
113
|
+
}),
|
|
114
|
+
noCleanup: Flags.boolean({
|
|
115
|
+
aliases: ['no-cleanup'],
|
|
116
|
+
default: false,
|
|
117
|
+
description: 'Cleanup',
|
|
118
|
+
}),
|
|
119
|
+
output: Flags.string({
|
|
120
|
+
char: 'o',
|
|
121
|
+
default: '{id}.{if-photo:png:mp4}',
|
|
122
|
+
description: 'Output file name',
|
|
123
|
+
}),
|
|
124
|
+
sessionType: Flags.custom({
|
|
125
|
+
aliases: ['session-type'],
|
|
126
|
+
default: 'guest',
|
|
127
|
+
description: 'Session type',
|
|
128
|
+
})(),
|
|
129
|
+
simpleLog: Flags.boolean({
|
|
130
|
+
aliases: ['simple-log'],
|
|
131
|
+
default: false,
|
|
132
|
+
description: 'Simple log',
|
|
133
|
+
}),
|
|
134
|
+
sleep: Flags.integer({
|
|
135
|
+
default: 0,
|
|
136
|
+
description: 'Sleep (ms)',
|
|
137
|
+
}),
|
|
138
|
+
theme: Flags.custom({
|
|
139
|
+
default: 'RenderBasic',
|
|
140
|
+
description: 'Theme type',
|
|
141
|
+
options: Object.keys(themeList),
|
|
142
|
+
})(),
|
|
143
|
+
ffmpegAdditonalOption: Flags.string({
|
|
144
|
+
aliases: ['ffmpeg-additonal-option'],
|
|
145
|
+
description: 'FFmpeg additonal option',
|
|
146
|
+
}),
|
|
147
|
+
ffmpegPath: Flags.string({
|
|
148
|
+
aliases: ['ffmpeg-path'],
|
|
149
|
+
default: 'ffmpeg',
|
|
150
|
+
description: 'FFmpeg path',
|
|
151
|
+
}),
|
|
152
|
+
ffprobePath: Flags.string({
|
|
153
|
+
aliases: ['ffprobe-path'],
|
|
154
|
+
default: 'ffprobe',
|
|
155
|
+
description: 'FFprobe path',
|
|
156
|
+
}),
|
|
100
157
|
};
|
|
101
158
|
export default Default;
|
|
102
159
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot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
import { ThemeNameType } from 'twitter-snap-core';
|
|
3
3
|
import { GetTweetApi, ThemeParamType } from '../utils/types.js';
|
|
4
|
-
export declare const twitterSnapGuest: () => Promise<({ id,
|
|
5
|
-
export declare const twitterSnapPuppeteer: (headless?: boolean, userDataDir?: string) => Promise<({ id,
|
|
6
|
-
export declare const twitterSnapCookies: (path: string) => Promise<({ id,
|
|
4
|
+
export declare const twitterSnapGuest: () => Promise<({ id, limit, type }: tweetApiSnapParam, handler: handlerType) => Promise<void>>;
|
|
5
|
+
export declare const twitterSnapPuppeteer: (headless?: boolean, userDataDir?: string) => Promise<({ id, limit, type }: tweetApiSnapParam, handler: handlerType) => Promise<void>>;
|
|
6
|
+
export declare const twitterSnapCookies: (path: string) => Promise<({ id, limit, type }: tweetApiSnapParam, handler: handlerType) => Promise<void>>;
|
|
7
7
|
type tweetApiSnapParam = {
|
|
8
8
|
id: string;
|
|
9
|
+
limit: number;
|
|
9
10
|
type?: 'getTweetResultByRestId' | keyof GetTweetApi;
|
|
10
|
-
max: number;
|
|
11
11
|
};
|
|
12
|
-
type
|
|
12
|
+
type handlerType = (e: ReturnType<typeof twitterRender>) => Promise<void>;
|
|
13
|
+
type HandlerTypeLiteral = 'image' | 'start' | 'video';
|
|
13
14
|
export type HandlerType = {
|
|
15
|
+
id: string;
|
|
14
16
|
type: HandlerTypeLiteral;
|
|
15
17
|
user: string;
|
|
16
|
-
id: string;
|
|
17
18
|
};
|
|
18
19
|
type twitterRenderParam = {
|
|
20
|
+
handler?: (e: HandlerType) => void;
|
|
21
|
+
output: string;
|
|
19
22
|
themeName: ThemeNameType;
|
|
20
23
|
themeParam: ThemeParamType;
|
|
21
|
-
output: string;
|
|
22
|
-
handler?: (e: HandlerType) => void;
|
|
23
24
|
};
|
|
24
|
-
declare const twitterRender: (data: TweetApiUtilsData) => ({
|
|
25
|
+
declare const twitterRender: (data: TweetApiUtilsData, count: number) => ({ handler, output, themeName, themeParam }: twitterRenderParam) => Promise<({ cleanup }: FinalizeParam) => Promise<void>>;
|
|
25
26
|
type FinalizeParam = {
|
|
26
27
|
cleanup: boolean;
|
|
27
28
|
};
|
package/dist/core/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/core/core.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/core/core.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,iBAAiB,EAAuC,MAAM,4BAA4B,CAAA;AAClG,OAAO,EAAC,aAAa,EAAY,MAAM,mBAAmB,CAAA;AAE1D,OAAO,EAAC,WAAW,EAAE,cAAc,EAAe,MAAM,mBAAmB,CAAA;AAE3E,eAAO,MAAM,gBAAgB,sCA6CM,iBAAiB,WAAW,WAAW,mBAzCzE,CAAA;AAED,eAAO,MAAM,oBAAoB,cAAqB,OAAO,gBAAgB,MAAM,mCAuChD,iBAAiB,WAAW,WAAW,mBAnBzE,CAAA;AAED,eAAO,MAAM,kBAAkB,SAAgB,MAAM,mCAiBlB,iBAAiB,WAAW,WAAW,mBAXzE,CAAA;AAED,KAAK,iBAAiB,GAAG;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,wBAAwB,GAAG,MAAM,WAAW,CAAA;CACpD,CAAA;AAED,KAAK,WAAW,GAAG,CAAC,CAAC,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;AAyCzE,KAAK,kBAAkB,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAA;AACrD,MAAM,MAAM,WAAW,GAAG;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,kBAAkB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,CAAA;AAE9E,KAAK,kBAAkB,GAAG;IACxB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,WAAW,KAAK,IAAI,CAAA;IAClC,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,aAAa,CAAA;IACxB,UAAU,EAAE,cAAc,CAAA;CAC3B,CAAA;AAED,QAAA,MAAM,aAAa,SAAU,iBAAiB,SAAS,MAAM,kDAMH,kBAAkB,2BAqExD,aAAa,mBAPhC,CAAA;AAED,KAAK,aAAa,GAAG;IACnB,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA"}
|
package/dist/core/core.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ImageResponse } from '@vercel/og';
|
|
2
|
-
import { promises as fs } from 'fs';
|
|
2
|
+
import { promises as fs } from 'node:fs';
|
|
3
|
+
import { launch } from 'puppeteer';
|
|
3
4
|
import { TwitterOpenApi } from 'twitter-openapi-typescript';
|
|
4
|
-
import puppeteer from 'puppeteer';
|
|
5
5
|
import { themeList } from 'twitter-snap-core';
|
|
6
6
|
import { getTweetList } from '../utils/types.js';
|
|
7
7
|
export const twitterSnapGuest = async () => {
|
|
@@ -10,53 +10,52 @@ export const twitterSnapGuest = async () => {
|
|
|
10
10
|
return tweetApiSnap(api);
|
|
11
11
|
};
|
|
12
12
|
export const twitterSnapPuppeteer = async (headless, userDataDir) => {
|
|
13
|
-
const browser = await
|
|
14
|
-
headless
|
|
13
|
+
const browser = await launch({
|
|
14
|
+
headless,
|
|
15
15
|
timeout: 0,
|
|
16
|
-
userDataDir
|
|
16
|
+
userDataDir,
|
|
17
17
|
});
|
|
18
18
|
const [page] = await browser.pages();
|
|
19
19
|
await page.goto('https://twitter.com/login');
|
|
20
20
|
page.setDefaultNavigationTimeout(0);
|
|
21
21
|
page.setDefaultTimeout(0);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
});
|
|
22
|
+
const pattern = 'https://twitter.com/i/api/graphql/[a-zA-Z0-9_-]+/HomeTimeline?.*';
|
|
23
|
+
await page.waitForResponse((res) => new RegExp(pattern).test(res.url()));
|
|
25
24
|
const cookies = await page.cookies();
|
|
26
25
|
await browser.close();
|
|
27
26
|
const twitter = new TwitterOpenApi();
|
|
28
|
-
const api = await twitter.getClientFromCookies(cookies.
|
|
27
|
+
const api = await twitter.getClientFromCookies(Object.fromEntries(cookies.map((e) => [e.name, e.value])));
|
|
29
28
|
return tweetApiSnap(api);
|
|
30
29
|
};
|
|
31
30
|
export const twitterSnapCookies = async (path) => {
|
|
32
|
-
const data = await fs.readFile(path, '
|
|
31
|
+
const data = await fs.readFile(path, 'utf8');
|
|
33
32
|
const cookies = JSON.parse(data);
|
|
34
33
|
const twitter = new TwitterOpenApi();
|
|
35
|
-
const api = await twitter.getClientFromCookies(cookies.
|
|
34
|
+
const api = await twitter.getClientFromCookies(Object.fromEntries(cookies.map((e) => [e.name, e.value])));
|
|
36
35
|
return tweetApiSnap(api);
|
|
37
36
|
};
|
|
38
37
|
const tweetApiSnap = (client) => {
|
|
39
|
-
return async ({ id,
|
|
40
|
-
const key = getTweetList.find((k) => k
|
|
38
|
+
return async ({ id, limit, type }, handler) => {
|
|
39
|
+
const key = getTweetList.find((k) => k === type);
|
|
41
40
|
if (key) {
|
|
42
41
|
const that = client.getTweetApi();
|
|
43
42
|
const api = that[key].bind(that);
|
|
44
43
|
let count = 0;
|
|
45
44
|
const cursor = [];
|
|
46
|
-
while (count <
|
|
45
|
+
while (count < limit) {
|
|
47
46
|
const res = await api({
|
|
47
|
+
cursor: cursor.length > 0 ? cursor.pop() : undefined,
|
|
48
48
|
focalTweetId: id,
|
|
49
|
-
rawQuery: id,
|
|
50
49
|
listId: id,
|
|
50
|
+
rawQuery: id,
|
|
51
51
|
userId: id,
|
|
52
|
-
cursor: cursor.length ? cursor.pop() : undefined,
|
|
53
52
|
});
|
|
54
53
|
for (const e of res.data.data) {
|
|
55
54
|
if (e.promotedMetadata)
|
|
56
55
|
continue;
|
|
57
|
-
if (count >=
|
|
56
|
+
if (count >= limit)
|
|
58
57
|
return;
|
|
59
|
-
await handler(twitterRender(e));
|
|
58
|
+
await handler(twitterRender(e, count));
|
|
60
59
|
count++;
|
|
61
60
|
}
|
|
62
61
|
if (res.data.cursor.bottom) {
|
|
@@ -72,37 +71,51 @@ const tweetApiSnap = (client) => {
|
|
|
72
71
|
tweetId: id,
|
|
73
72
|
});
|
|
74
73
|
if (res.data)
|
|
75
|
-
await handler(twitterRender(res.data));
|
|
74
|
+
await handler(twitterRender(res.data, 0));
|
|
76
75
|
}
|
|
77
76
|
};
|
|
78
77
|
};
|
|
79
|
-
const twitterRender = (data) => {
|
|
78
|
+
const twitterRender = (data, count) => {
|
|
79
|
+
const legacy = data.tweet.legacy;
|
|
80
80
|
const extEntities = data.tweet.legacy?.extendedEntities;
|
|
81
81
|
const extMedia = extEntities?.media ?? [];
|
|
82
|
-
const isVideoData =
|
|
83
|
-
return async ({
|
|
84
|
-
handler && handler({ type: 'start', user: data.user.legacy.screenName
|
|
85
|
-
const
|
|
82
|
+
const isVideoData = extMedia.some((e) => e.type !== 'photo');
|
|
83
|
+
return async ({ handler, output, themeName, themeParam }) => {
|
|
84
|
+
handler && handler({ id: data.tweet.restId, type: 'start', user: data.user.legacy.screenName });
|
|
85
|
+
const Theme = Object.entries(themeList).find(([k, _]) => k === themeName)[1];
|
|
86
86
|
const replacData = [
|
|
87
87
|
['{id}', data.tweet.restId],
|
|
88
88
|
['{user-screen-name}', data.user.legacy.screenName],
|
|
89
89
|
['{if-photo:(?<true>.+?):(?<false>.+?)}', isVideoData ? '$2' : '$1'],
|
|
90
|
+
['{count}', count.toString()],
|
|
91
|
+
['{time-now-yyyy}', new Date().getFullYear().toString().padStart(4, '0')],
|
|
92
|
+
['{time-now-mm}', (new Date().getMonth() + 1).toString().padStart(2, '0')],
|
|
93
|
+
['{time-now-dd}', new Date().getDate().toString().padStart(2, '0')],
|
|
94
|
+
['{time-now-hh}', new Date().getHours().toString().padStart(2, '0')],
|
|
95
|
+
['{time-now-mi}', new Date().getMinutes().toString().padStart(2, '0')],
|
|
96
|
+
['{time-now-ss}', new Date().getSeconds().toString().padStart(2, '0')],
|
|
97
|
+
['{time-tweet-yyyy}', new Date(legacy.createdAt).getFullYear().toString().padStart(4, '0')],
|
|
98
|
+
['{time-tweet-mm}', (new Date(legacy.createdAt).getMonth() + 1).toString().padStart(2, '0')],
|
|
99
|
+
['{time-tweet-dd}', new Date(legacy.createdAt).getDate().toString().padStart(2, '0')],
|
|
100
|
+
['{time-tweet-hh}', new Date(legacy.createdAt).getHours().toString().padStart(2, '0')],
|
|
101
|
+
['{time-tweet-mi}', new Date(legacy.createdAt).getMinutes().toString().padStart(2, '0')],
|
|
102
|
+
['{time-tweet-ss}', new Date(legacy.createdAt).getSeconds().toString().padStart(2, '0')],
|
|
90
103
|
];
|
|
91
|
-
const repOutput = replacData.reduce((acc, [k, v]) => acc.
|
|
92
|
-
const video = repOutput.split('.').pop()
|
|
104
|
+
const repOutput = replacData.reduce((acc, [k, v]) => acc.replaceAll(new RegExp(k, 'g'), v), output);
|
|
105
|
+
const video = repOutput.split('.').pop() !== 'png';
|
|
93
106
|
const pngOutput = video ? repOutput.replace(/\.\w+$/, '.png') : repOutput;
|
|
94
|
-
const render = new
|
|
107
|
+
const render = new Theme({
|
|
95
108
|
...themeParam,
|
|
96
|
-
video
|
|
109
|
+
video,
|
|
97
110
|
});
|
|
98
|
-
handler && handler({ type: 'image', user: data.user.legacy.screenName
|
|
111
|
+
handler && handler({ id: data.tweet.restId, type: 'image', user: data.user.legacy.screenName });
|
|
99
112
|
const element = render.imageRender({
|
|
100
|
-
data
|
|
113
|
+
data,
|
|
101
114
|
});
|
|
102
115
|
const img = new ImageResponse(element, {
|
|
103
|
-
width: themeParam.width,
|
|
104
|
-
height: undefined,
|
|
105
116
|
emoji: 'twemoji',
|
|
117
|
+
height: undefined,
|
|
118
|
+
width: themeParam.width,
|
|
106
119
|
});
|
|
107
120
|
const png = Buffer.from(await img.arrayBuffer());
|
|
108
121
|
if (pngOutput.split('/').length > 1) {
|
|
@@ -110,24 +123,20 @@ const twitterRender = (data) => {
|
|
|
110
123
|
}
|
|
111
124
|
await fs.writeFile(pngOutput, png);
|
|
112
125
|
if (video) {
|
|
113
|
-
handler && handler({ type: 'video', user: data.user.legacy.screenName
|
|
126
|
+
handler && handler({ id: data.tweet.restId, type: 'video', user: data.user.legacy.screenName });
|
|
114
127
|
const res = await render.videoRender({
|
|
115
|
-
data
|
|
128
|
+
data,
|
|
116
129
|
image: pngOutput,
|
|
117
130
|
output: repOutput,
|
|
118
131
|
});
|
|
119
132
|
return finalize(res.temp);
|
|
120
133
|
}
|
|
121
|
-
|
|
122
|
-
return finalize([]);
|
|
123
|
-
}
|
|
134
|
+
return finalize([]);
|
|
124
135
|
};
|
|
125
136
|
};
|
|
126
|
-
const finalize = async (temp) => {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
};
|
|
137
|
+
const finalize = async (temp) => async ({ cleanup }) => {
|
|
138
|
+
if (cleanup) {
|
|
139
|
+
await Promise.all(temp.map((e) => fs.rm(e)));
|
|
140
|
+
}
|
|
132
141
|
};
|
|
133
142
|
//# sourceMappingURL=core.js.map
|
package/dist/core/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/core/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAA;AACxC,OAAO,EAAC,QAAQ,IAAI,EAAE,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/core/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAA;AACxC,OAAO,EAAC,QAAQ,IAAI,EAAE,EAAC,MAAM,SAAS,CAAA;AACtC,OAAO,EAAS,MAAM,EAAC,MAAM,WAAW,CAAA;AACxC,OAAO,EAAoB,cAAc,EAAuB,MAAM,4BAA4B,CAAA;AAClG,OAAO,EAAgB,SAAS,EAAC,MAAM,mBAAm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