Commit 8187cc70 authored by duanjinfei's avatar duanjinfei

fix crawl data

parent bec1aab6
...@@ -105,16 +105,16 @@ async function cleanAppData(app, supabase, tableName) { ...@@ -105,16 +105,16 @@ async function cleanAppData(app, supabase, tableName) {
} }
async function getTonAppInfo(supabase) { async function getTonAppInfo(supabase) {
const databaseCache = new DatabaseCache();
await databaseCache.init(supabase, 'app');
const categories = [ const categories = [
"exchanges", "wallets", "staking", "explorers", "bridges", "exchanges", "wallets", "staking", "explorers", "bridges",
"utilities", "channels", "nft", "vpn", "nftservices", "utilities", "channels", "nft", "vpn", "nftservices",
"chats", "social", "gambling", "dex", "chats", "social", "gambling", "dex",
"games", "devtools", "shopping", "launchpads" "games", "devtools", "shopping", "launchpads"
]; ];
const baseUrl = "https://ton.app/_next/data/xTw0Vxd8Pu6ky2epaEtZJ/en/"; const baseUrl = "https://ton.app/_next/data/xTw0Vxd8Pu6ky2epaEtZJ/en/";
const databaseCache = new DatabaseCache();
await databaseCache.init(supabase, 'app');
const appsToInsert = []; const appsToInsert = [];
for (const category of categories) { for (const category of categories) {
...@@ -160,8 +160,10 @@ async function getTonAppInfo(supabase) { ...@@ -160,8 +160,10 @@ async function getTonAppInfo(supabase) {
} }
// 批量插入应用 // 批量插入应用
await databaseCache.batchInsertApps(supabase, appsToInsert); console.log("await app to insert length", appsToInsert.length);
if (appsToInsert.length > 0) {
await databaseache.batchInsertApps(supabase, appsToInsert);
}
return appsToInsert.length; return appsToInsert.length;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment