-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathupdate.mjs
50 lines (33 loc) · 1.03 KB
/
update.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { promises as fs } from 'fs';
import path from 'path';
async function update() {
let i = 0;
const combinedFilePath = './data/combined.json';
const jsonContents = await fs.readFile(combinedFilePath, 'utf8');
const latest2 = JSON.parse(jsonContents);
for (const prop of latest2) {
const gpt = prop.pageProps.gpt;
//if (!prop.flow || prop.flow.nsfw) continue;
let initPrompt = !prop.flow?'':`
<details>
<summary>initPrompt</summary>
\`\`\`
${prop.flow.initPrompt}
\`\`\`
</details>
`;
const photo = gpt.openAiMetadata.gizmo.display.profile_picture_url;
const gptContent = `
[![${gpt.name}](${photo})](${gpt.url})
# ${gpt.name} [ChatGPT Plus](${gpt.url}) / [Search ChatGPT Free](https://gptcall.net/index.html#/?search=${encodeURIComponent(gpt.name)})
${gpt.descriptionGenerated}
${gpt.guideGenerated}
${initPrompt}
`;
const gptFileName = `${gpt.slug}.md`;
const gptFilePath = path.join("gpts", gptFileName);
await fs.writeFile(gptFilePath, gptContent);
//console.log(i++);
}
}
update();