-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-existing-app.ts
More file actions
85 lines (76 loc) · 3.3 KB
/
test-existing-app.ts
File metadata and controls
85 lines (76 loc) · 3.3 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/**
* Existing App ASO Generation — Live Test
* Scenario: ASO improvement for the Shazam app
*/
import { getAppDetails, searchApps } from "./src/data-sources/app-store.js";
import { getScores } from "./src/data-sources/aso-scoring.js";
import { initCache } from "./src/cache/sqlite-cache.js";
import { extractTitleKeywords } from "./src/data-sources/custom-scoring.js";
import { CHAR_LIMITS } from "./src/utils/constants.js";
initCache();
const app = await getAppDetails("284993459", "tr");
console.log("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
console.log(" EXISTING APP ASO ANALYSIS: " + app.title);
console.log("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
console.log("");
console.log("Rating:", app.score, "| Reviews:", app.reviews);
console.log("Title length:", (app.title || "").length, "/", CHAR_LIMITS.TITLE);
console.log("");
// Keyword analysis
const titleKws = extractTitleKeywords(app.title || "");
console.log("Current title keywords:", titleKws);
console.log("");
for (const kw of titleKws.slice(0, 4)) {
const s = await getScores(kw, "tr");
console.log(" \"" + kw + "\": traffic=" + s.traffic + ", difficulty=" + s.difficulty);
}
// Missing keywords from competitors
const competitors = await searchApps(titleKws[0] || "music", "tr", 5);
const compKws = new Set<string>();
for (const c of competitors) {
const kws = extractTitleKeywords((c as any).title || "");
for (const k of kws) compKws.add(k);
}
const titleKwSet = new Set(titleKws);
const missing = [...compKws].filter((k) => !titleKwSet.has(k));
console.log("");
console.log("Competitors:");
for (const c of competitors.slice(0, 3)) {
const a = c as any;
console.log(" - " + a.title + " (" + (a.reviews || 0) + " reviews)");
}
console.log("");
console.log("In competitors but not in yours:", missing.slice(0, 8));
console.log("");
// Suggestions
const allKws = [...titleKws, ...missing];
const scored: { kw: string; traffic: number }[] = [];
for (const kw of allKws.slice(0, 10)) {
const s = await getScores(kw, "tr");
scored.push({ kw, traffic: s.traffic });
}
scored.sort((a, b) => b.traffic - a.traffic);
const appBaseName = (app.title || "").split(/[-:|&]/)[0].trim();
const titleSugg = (appBaseName + " - " + scored.slice(0, 2).map((k) => k.kw).join(" ")).slice(
0,
CHAR_LIMITS.TITLE
);
const subtitleSugg = scored
.slice(2, 5)
.map((k) => k.kw)
.join(", ")
.slice(0, CHAR_LIMITS.SUBTITLE);
const fieldKws = scored
.slice(5)
.map((k) => k.kw)
.join(",")
.slice(0, CHAR_LIMITS.KEYWORD_FIELD);
console.log("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
console.log(" ASO SUGGESTIONS");
console.log("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
console.log("");
console.log("Title: \"" + titleSugg + "\" (" + titleSugg.length + "/" + CHAR_LIMITS.TITLE + ")");
console.log("Subtitle: \"" + subtitleSugg + "\" (" + subtitleSugg.length + "/" + CHAR_LIMITS.SUBTITLE + ")");
console.log("Keywords: \"" + fieldKws + "\" (" + fieldKws.length + "/" + CHAR_LIMITS.KEYWORD_FIELD + ")");
console.log("");
console.log("✅ Existing app ASO generation successful!");