1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "JSON": `[
12 {
13 "title": "Apify: Full-stack web scraping and data extraction platform",
14 "url": "https://apify.com/",
15 "displayedUrl": "https://apify.com",
16 "description": "Crawls arbitrary websites using the Chrome browser and extracts data from pages using a provided JavaScript code. The actor supports both recursive crawling and ...",
17 "emphasizedKeywords": [],
18 "productInfo": {},
19 "type": "organic",
20 "position": 1
21 },
22 {
23 "title": "Apify (@apify) · X",
24 "url": "https://twitter.com/apify?ref_src=twsrc%5Egoogle%7Ctwcamp%5Eserp%7Ctwgr%5Eauthor",
25 "displayedUrl": "https://twitter.com/apify",
26 "description": "",
27 "emphasizedKeywords": [],
28 "siteLinks": [],
29 "productInfo": {},
30 "type": "organic",
31 "position": 2
32 },
33 {
34 "title": "Apify",
35 "url": "https://github.com/apify",
36 "displayedUrl": "https://github.com › apify",
37 "description": "Generic REST API for scraping websites. Drop-in replacement for ScrapingBee, ScrapingAnt, and ScraperAPI services. And it is open-source!",
38 "emphasizedKeywords": [],
39 "siteLinks": [],
40 "productInfo": {},
41 "type": "organic",
42 "position": 3
43 },
44 {
45 "title": "Apify Pricing, Alternatives & More 2024",
46 "url": "https://www.capterra.com/p/150854/Apify/",
47 "displayedUrl": "https://www.capterra.com › Data Extraction Software",
48 "description": "Apify is used by large enterprises, SMEs, and independent developers. The Apify platform lets you turn any website into an API and reliably extract data at any ...",
49 "emphasizedKeywords": [
50 "Apify"
51 ],
52 "siteLinks": [],
53 "productInfo": {
54 "rating": 4.8,
55 "numberOfReviews": 150
56 },
57 "type": "organic",
58 "position": 4
59 },
60 {
61 "title": "Apify",
62 "url": "https://cz.linkedin.com/company/apifytech",
63 "displayedUrl": "6.6K+ followers",
64 "description": "Apify is a full-stack web scraping and browser automation platform that lets you extract data from websites and automate workflows on the web.",
65 "emphasizedKeywords": [
66 "Apify"
67 ],
68 "siteLinks": [],
69 "productInfo": {},
70 "type": "organic",
71 "position": 5
72 },
73 {
74 "title": "Apify Reviews 2024: Details, Pricing, & Features",
75 "url": "https://www.g2.com/products/apify/reviews",
76 "displayedUrl": "https://www.g2.com › ... › Apify › Apify Reviews",
77 "description": "One of the best features of Apify is their own free scrapers. They provide a variety of ready-made solutions for common web scraping tasks, such as extracting ...",
78 "emphasizedKeywords": [
79 "Apify"
80 ],
81 "siteLinks": [],
82 "productInfo": {
83 "rating": 4.8,
84 "numberOfReviews": 112
85 },
86 "type": "organic",
87 "position": 6
88 },
89 {
90 "title": "Apify Tutorial For Beginners | How To Use Apify",
91 "url": "https://www.youtube.com/watch?v=3rrpfW0bEdc",
92 "displayedUrl": "4.9K+ views · 9 months ago",
93 "description": "Apify review: https://speakaboutdigital.com/apify-review/ Apify Tutorial For Beginners | How To Use Apify This is my video tutorial on Apify ...",
94 "emphasizedKeywords": [
95 "Apify"
96 ],
97 "siteLinks": [],
98 "productInfo": {},
99 "type": "organic",
100 "position": 7
101 }]`
102};
103
104
105const run = await client.actor("zuzka/json-to-excel").call(input);
106
107
108console.log('Results from dataset');
109console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
110const { items } = await client.dataset(run.defaultDatasetId).listItems();
111items.forEach((item) => {
112 console.dir(item);
113});
114
115