1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "mode": "profiles",
12 "instanceUrl": "https://mastodon.social",
13 "profileSource": "both",
14 "urls": [
15 "https://mastodon.social/explore",
16 "https://mastodon.social/@Mastodon",
17 "https://mastodon.social/@Mastodon/with_replies",
18 "https://mastodon.social/@Mastodon/117466985005297414",
19 "https://mastodon.social/tags/news",
20 "https://mastodon.social/users/Mastodon",
21 "https://mastodon.social/web/@Mastodon",
22 "https://mastodon.social/@Mastodon.rss",
23 "https://fosstodon.org/@fosstodon",
24 "https://mastodon.social/directory",
25 "https://mastodon.social/api/v1/accounts/lookup?acct=Mastodon",
26 "https://mastodon.social/@Mastodon/with_replies?max_id=1",
27 "https://mastodon.social/@Mastodon/117466983307949301/embed",
28 "https://mastodon.social/users/Mastodon/statuses/117411420916699261",
29 "https://mastodon.social/web/statuses/117156549508722805",
30 "https://mastodon.social/explore/posts",
31 "https://mastodon.social/api/v1/timelines/tag/fediverse?limit=2",
32 "https://mastodon.social/api/v1/trends/statuses?limit=2",
33 "https://mastodon.social/api/v1/directory?limit=2",
34 "https://mastodon.social/api/v1/statuses/117128801091131239/context"
35 ],
36 "accounts": [],
37 "keywords": [
38 "news"
39 ],
40 "maxProfiles": 10,
41 "maxReviewsPerProfile": 5,
42 "maxRepliesPerPost": 10,
43 "maxPosts": 500,
44 "proxy": {
45 "useApifyProxy": true
46 },
47 "incrementalMode": false,
48 "emitUnchanged": false,
49 "emitExpired": false,
50 "ignoreFieldsForChanges": []
51};
52
53
54const run = await client.actor("abotapi/mastodon-social-scraper").call(input);
55
56
57console.log('Results from dataset');
58console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
59const { items } = await client.dataset(run.defaultDatasetId).listItems();
60items.forEach((item) => {
61 console.dir(item);
62});
63
64