-
-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy pathfetch-data.js
More file actions
28 lines (24 loc) · 921 Bytes
/
fetch-data.js
File metadata and controls
28 lines (24 loc) · 921 Bytes
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
import { fetchFromHashnode } from '../utils/hashnode/fetch-from-hashnode.js';
import { fetchFromGhost } from '../utils/ghost/fetch-from-ghost.js';
try {
console.log('Downloading trending data...');
await import('../tools/download-trending.js');
console.log('Trending data downloaded.');
console.log('Fetching data from Hashnode and Ghost...');
const hashnodePosts = await fetchFromHashnode('posts');
const hashnodePages = await fetchFromHashnode('pages');
const ghostPosts = await fetchFromGhost('posts');
const ghostPages = await fetchFromGhost('pages');
console.log(
[
'Fetch summary:',
` Hashnode posts: ${hashnodePosts.length}`,
` Hashnode pages: ${hashnodePages.length}`,
` Ghost posts: ${ghostPosts.length}`,
` Ghost pages: ${ghostPages.length}`
].join('\n')
);
} catch (err) {
console.error('fetch-data failed:', err);
process.exit(1);
}