1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "publications": [
12 "astralcodexten",
13 "https://www.lennysnewsletter.com"
14 ],
15 "maxPostsPerPublication": 20,
16 "includeBody": true,
17 "sort": "new",
18 "postTypes": [
19 "newsletter",
20 "podcast",
21 "thread",
22 "video"
23 ],
24 "searchQueries": [],
25 "maxResultsPerQuery": 20,
26 "search": "",
27 "since": "",
28 "includeComments": false,
29 "maxCommentsPerPost": 100,
30 "commentSort": "best_first",
31 "includeHtml": false,
32 "includePublicationInfo": true,
33 "maxConcurrency": 4,
34 "proxyConfiguration": {
35 "useApifyProxy": true
36 }
37};
38
39
40const run = await client.actor("insight.solutions/substack-scraper").call(input);
41
42
43console.log('Results from dataset');
44console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
45const { items } = await client.dataset(run.defaultDatasetId).listItems();
46items.forEach((item) => {
47 console.dir(item);
48});
49
50